sky(phase-3b): revert Phase 2 per-vertex lighting — sky meshes are UNLIT
Phase 2 added a per-vertex lighting path to the sky shader based on the Phase 1 dump showing dome surfaces with Luminosity=1.0 and cloud surfaces with Luminosity=0.0. Live visual verification vs retail at MorntideAndHalf (dayFraction=0.48, user-observed 2026-04-23) disproved the hypothesis: retail: clean blue sky + white clouds acdream: blue-green-yellow sky sweep + greyish clouds The "sweep" is exactly the signature of per-vertex `diffuse × sunColor` where sunColor=(250,215,151) warm gold at ~63° east: the west-facing cloud faces get the gold tint, east-facing stay cool, and interpolation across the mesh produces the color sweep. Retail's clean white clouds at the same time of day means retail is NOT applying per-vertex lighting to sky meshes. Revised model (unlit + SkyObjectReplace modulation): fragment.rgb = texture.rgb * uLuminosity fragment.a = texture.a * (1 - uTransparency) The "purple haze night / warm dusk" effect users describe from retail comes from SkyObjectReplace per-keyframe Luminosity dimming + Transparent fading, NOT from a shader ambient multiply. At midnight, for example, Replace[0] dims the dome to 11% (Luminosity_raw=11) and Replace[2] fully hides the drifting cloud (Transparent_raw=100) — so the camera sees the dome texture at 11% × baked gradient colors, and any purple the user perceives is baked into the dome texture's night gradient. The retail-authoritative Surface.Luminosity flag probably feeds a separate render path (material system? D3D emissive vs diffuse coefficients?) that is NOT per-vertex GL lighting. A future phase can revive it if the decompile hunt for the DayGroup selection algorithm surfaces it. Code change: sky.vert + sky.frag only. The C# renderer still pushes uAmbientColor/uSunColor/uSunDir/uEmissive uniforms — they are declared in the shaders but unused in Phase 3b. No renderer change needed; these uniforms cost nothing and keep the port-forward path open. Build + 717 tests green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
62e9c6b9ac
commit
027ccb46b9
2 changed files with 46 additions and 59 deletions
|
|
@ -1,28 +1,29 @@
|
|||
#version 430 core
|
||||
// Sky mesh fragment shader — retail-verbatim composite:
|
||||
// Sky mesh fragment shader — UNLIT texture passthrough modulated by the
|
||||
// per-keyframe SkyObjectReplace.Luminosity and .Transparent overrides.
|
||||
//
|
||||
// fragment.rgb = texture.rgb * vTint * uLuminosity + lightning_flash
|
||||
// fragment.rgb = texture.rgb * uLuminosity + lightning_flash
|
||||
// fragment.a = texture.a * (1 - uTransparency)
|
||||
//
|
||||
// vTint arrives from the vertex shader with retail's per-vertex lighting
|
||||
// baked in (emissive + ambient + diffuse × sun, clamped to [0,1]).
|
||||
// uLuminosity is the per-keyframe SkyObjectReplace override (0..1
|
||||
// fraction after the /100 scale in SkyDescLoader) — NOT to be confused
|
||||
// with the Surface.Luminosity that feeds uEmissive in the vertex shader.
|
||||
// uTransparency is the per-keyframe SkyObjectReplace alpha-fade.
|
||||
// uLuminosity defaults to 1.0 (no dim). A SkyObjectReplace entry with
|
||||
// Luminosity_raw=11 (11%) sets uLuminosity to 0.11 — mesh renders at
|
||||
// 11% brightness. MaxBright is min-clamped into uLuminosity by the C#
|
||||
// renderer before it reaches the shader.
|
||||
// uTransparency defaults to 0.0. Replace.Transparent_raw=100 (100%) sets
|
||||
// uTransparency to 1.0 — alpha is zeroed and the pixel discarded
|
||||
// (cloud hidden so the dome behind shows through).
|
||||
//
|
||||
// See docs/research/2026-04-23-sky-retail-verbatim.md §6 + §7.
|
||||
// See `docs/research/2026-04-23-sky-retail-verbatim.md` §6 + Phase 3b
|
||||
// rationale in sky.vert.
|
||||
|
||||
in vec2 vTex;
|
||||
in vec3 vTint;
|
||||
out vec4 fragColor;
|
||||
|
||||
uniform sampler2D uDiffuse;
|
||||
uniform float uTransparency; // 0 = fully visible, 1 = fully transparent
|
||||
uniform float uLuminosity; // 1.0 = normal; <1 dims per SkyObjectReplace
|
||||
uniform float uTransparency;
|
||||
uniform float uLuminosity;
|
||||
|
||||
// Shared SceneLighting UBO — only need fog/flash channel for the
|
||||
// client-driven lightning strobe. Sun/ambient already baked into vTint.
|
||||
// Shared SceneLighting UBO — only fog-flash channel used (lightning).
|
||||
struct Light {
|
||||
vec4 posAndKind;
|
||||
vec4 dirAndRange;
|
||||
|
|
@ -40,16 +41,13 @@ layout(std140, binding = 1) uniform SceneLighting {
|
|||
void main() {
|
||||
vec4 sampled = texture(uDiffuse, vTex);
|
||||
|
||||
// Composite: texture × per-vertex lighting × per-keyframe dim.
|
||||
vec3 rgb = sampled.rgb * vTint * uLuminosity;
|
||||
// Unlit passthrough with per-keyframe dim.
|
||||
vec3 rgb = sampled.rgb * uLuminosity;
|
||||
|
||||
// Lightning additive bump (client-side during storm keyframes).
|
||||
// Lightning additive bump (client-driven during storm keyframes).
|
||||
float flash = uFogParams.z;
|
||||
rgb += flash * vec3(1.5, 1.5, 1.8);
|
||||
|
||||
// Soft clamp. Normal frame: cap at 1.2 so emissive meshes have a
|
||||
// small highlight margin. During a flash the ceiling relaxes so the
|
||||
// strobe actually blows out instead of getting pinned mid-rise.
|
||||
float cap = mix(1.2, 3.0, clamp(flash, 0.0, 1.0));
|
||||
rgb = min(rgb, vec3(cap));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue