diff --git a/src/AcDream.App/Rendering/Shaders/sky.frag b/src/AcDream.App/Rendering/Shaders/sky.frag index 8276be6..7015957 100644 --- a/src/AcDream.App/Rendering/Shaders/sky.frag +++ b/src/AcDream.App/Rendering/Shaders/sky.frag @@ -50,10 +50,11 @@ void main() { float flash = uFogParams.z; rgb += flash * vec3(1.5, 1.5, 1.8); - // Soft clamp. Normal frame caps at 1.2 so the D3D-style overbright - // from Emissive+Ambient+Diffuse at day-time saturates cleanly; during + // Normal-frame cap at 1.0 (retail D3D framebuffer clamps at 1.0 + // per channel for RGBA8 output; vTint is already vertex-clamped so + // the only path above 1 is lightning flash additive bump). During // a flash the ceiling relaxes so the strobe blows out visibly. - float cap = mix(1.2, 3.0, clamp(flash, 0.0, 1.0)); + float cap = mix(1.0, 3.0, clamp(flash, 0.0, 1.0)); rgb = min(rgb, vec3(cap)); float a = sampled.a * (1.0 - uTransparency); diff --git a/src/AcDream.App/Rendering/Shaders/sky.vert b/src/AcDream.App/Rendering/Shaders/sky.vert index 87e011d..48e5987 100644 --- a/src/AcDream.App/Rendering/Shaders/sky.vert +++ b/src/AcDream.App/Rendering/Shaders/sky.vert @@ -61,8 +61,15 @@ void main() { // Retail per-vertex fixed-function lighting (AMBIENT=0 globally, // so the global ambient term drops; only light.Ambient contributes). + // Clamp to [0,1] at the vertex — retail's D3DRS_COLORCLAMP defaults + // to clamping lit vertex colours to 1.0 BEFORE texture modulate. + // Without this, a dome vertex (uEmissive=1) picks up ambient+diff + // on top of already-saturated emissive, producing > 1.5 lit values + // that our framebuffer cap (1.2) lets through as 20% overbright + // vs retail's 1.0-clamped reference. User-observed 2026-04-23. float diff = max(dot(worldNormal, uSunDir), 0.0); - vTint = vec3(uEmissive) // material.Emissive - + uAmbientColor // material.Ambient(1) × light.Ambient - + uSunColor * diff; // material.Diffuse(1) × light.Diffuse × N·L + vec3 lit = vec3(uEmissive) // material.Emissive + + uAmbientColor // material.Ambient(1) × light.Ambient + + uSunColor * diff; // material.Diffuse(1) × light.Diffuse × N·L + vTint = clamp(lit, 0.0, 1.0); }