commit 686597c8639e50cd746eef79fa9322eb8a55fff6 parent 187b0f7d0ddfff03a9937a9478a2a2254d3bc08d Author: Michael Savage <mikejsavage@gmail.com> Date: Wed Oct 12 22:55:15 +0300 Small sun shader tweaks Diffstat:
terrain_manager.cc | | | 6 | +++--- |
diff --git a/terrain_manager.cc b/terrain_manager.cc @@ -51,7 +51,6 @@ static const GLchar * frag_src = GLSL( void main() { vec3 normal = normalize( texture( normals, smooth_position.xy / dimensions ).xyz ); - vec3 sun_direction = normalize( vec3( 1, 1, -sun ) ); float horizon = texture( horizons, smooth_position.xy / dimensions ).r; // ground colour @@ -76,10 +75,11 @@ static const GLchar * frag_src = GLSL( // sunlight + sky ambient lighting // TODO: use formula for area of a chord? - float sun_visible_fraction = smoothstep( 0, 0.5, sun - horizon ); + float sun_visible_fraction = smoothstep( 0, 0.2, sun - horizon ); + vec3 sun_direction = normalize( vec3( 1, 1, -sun ) ); float sunlight_lambert = max( 0, -dot( normal, sun_direction ) ); vec3 sunlight = sun_visible_fraction * sunlight_lambert * vec3( 0.9, 0.9, 0.5 ); - vec3 ambient = vec3( 0.0, 0.1, 0.3 ); + vec3 ambient = vec3( 0.02, 0.02, 0.15 ); vec3 c = ( sunlight + ambient ) * ground;