commit 51ab9f917d5458d1847a69712b59cde974dc7a32 parent 8b6c14e8e4575c6c594066e1f7dbfd00ee181c7c Author: Michael Savage <mikejsavage@gmail.com> Date: Wed Dec 28 10:51:00 +0200 Tweak fog again Diffstat:
terrain_manager.cc | | | 8 | +++++--- |
diff --git a/terrain_manager.cc b/terrain_manager.cc @@ -101,9 +101,11 @@ static const char * frag_src = GLSL( } // fog - vec3 fog_color = vec3( 0.6, 0.6, 0.6 ); - float fog_distance_bias = -500.0 * 500.0; - float fog_t = 1.0 - clamp( 1.0 / exp( ( fog_distance_bias + dot( vpos, vpos ) ) * 0.0005 * 0.0005 ), 0.0, 1.0 ); + vec3 fog_color = vec3( 0.5, 0.6, 0.7 ); + float fog_strength = 0.0005; + // don't draw any fog too close to the camera because the banding is quite noticable + float fog_distance_bias = 100.0; + float fog_t = 1.0 - exp( -fog_strength * max( ( length( vpos ) - fog_distance_bias ), 0.0 ) ); colour = vec4( mix( c, fog_color, fog_t ), 1.0 ); }