commit d846293606855fd89e46848cc8fb6b4a3d7bdf3d parent 65007db79acf5e098ef19f1b8e185f65bb7796c0 Author: Michael Savage <mikejsavage@gmail.com> Date: Sat Dec 3 17:46:49 +0200 Exponential fog Diffstat:
terrain_manager.cc | | | 8 | +++----- |
diff --git a/terrain_manager.cc b/terrain_manager.cc @@ -99,12 +99,10 @@ static const char * frag_src = GLSL( } // fog - vec3 fog = vec3( 0.6, 0.6, 0.6 ); + vec3 fog_color = vec3( 0.6, 0.6, 0.6 ); + float fog_t = 1.0 - clamp( 1.0 / exp( dot( vpos, vpos ) * 0.0005 * 0.0005 ), 0.0, 1.0 ); - float depth = length( vpos ); - float t = smoothstep( 1250, 2000, depth ) * 0.2; - - colour = vec4( mix( c, fog, t ), 1.0 ); + colour = vec4( mix( c, fog_color, fog_t ), 1.0 ); } );