medfall

A super great game engine
Log | Files | Refs

commit fcbe68c1337ee1d775e40d0f9f071141b16c01e8
parent 23a8978e84489fb13d966c2319e1c9fd22bd58a0
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Fri Jul 21 00:03:53 +0300

Maybe better dithering

Diffstat:
shaders/terrain.glsl | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/shaders/terrain.glsl b/shaders/terrain.glsl @@ -41,7 +41,8 @@ uniform samplerBuffer point_light_colours; vec3 noise( vec2 uv ) { vec3 dither = vec3( dot( vec2( 171.0, 231.0 ), uv ) ); - return fract( dither / vec3( 103.0, 71.0, 97.0 ) ) - vec3( 0.5, 0.5, 0.5 ); + dither = fract( dither / vec3( 103.0, 71.0, 97.0 ) ) - vec3( 0.5, 0.5, 0.5 ); + return ( dither / 256.0 ) * 0.375; } void main() { @@ -102,7 +103,7 @@ void main() { vec2 ndc = v2f.screen_position.xy / v2f.screen_position.w; // seems to produce good results even at other resolutions - vec3 dither_noise = noise( ndc * vec2( 1920, 1080 ) ) / 512.0; + vec3 dither_noise = noise( ndc * vec2( 1920, 1080 ) ); colour = vec4( mix( c, fog_colour, fog_t ) + dither_noise, 1.0 ); }