@@ -14,6 +14,7 @@ layout(set = 0, binding = 1) uniform CompositeParams {
1414 float uSaturation; // Default: 1.0
1515 float uVignetteIntensity; // Default: 0.5
1616 float uVignetteFalloff; // Default 0.5
17+ float uFogDensity;
1718};
1819
1920// add camera projection uniforms to the UBO or pass them in another way
@@ -47,7 +48,8 @@ void main() {
4748 float fogEnd = 5.0 ;
4849 float viewDistance = linearizeDepth(depth);
4950 // Calculate fog amount (0.0 = no fog, 1.0 = full fog)
50- float fogFactor = smoothstep (fogStart, fogEnd, viewDistance);
51+ // float fogFactor = smoothstep(fogStart, fogEnd, viewDistance);
52+ float fogFactor = uFogDensity;
5153 // ----------------------
5254
5355 // Sample the HDR input image
@@ -70,7 +72,7 @@ void main() {
7072 finalColor = mix (grayscale, finalColor, uSaturation);
7173
7274 // Mix the final scene color with the fog color
73- // finalColor = mix(finalColor, fogColor, fogFactor);
75+ finalColor = mix (finalColor, fogColor, fogFactor);
7476
7577 outColor = vec4 (finalColor, 1.0 );
7678}
0 commit comments