Browse Source

ShaderChunk: dithering_pars_fragment now using common rand() and removed unneeded constant. See #11076.

Mr.doob 8 years ago
parent
commit
489ae6bc14
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl

+ 2 - 2
src/renderers/shaders/ShaderChunk/dithering_pars_fragment.glsl

@@ -3,7 +3,7 @@
 	// based on https://www.shadertoy.com/view/MslGR8
 	vec3 dithering( vec3 color ) {
 		//Calculate grid position
-		float grid_position = fract( dot( gl_FragCoord.xy - vec2( 0.5, 0.5 ) , vec2( 1.0 / 16.0, 10.0 / 36.0 ) + 0.25 ) );
+		float grid_position = rand( gl_FragCoord.xy );
 
 		//Shift the individual colors differently, thus making it even harder to see the dithering pattern
 		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
@@ -12,7 +12,7 @@
 		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
 
 		//shift the color by dither_shift
-		return color + 0.5 / 255.0 + dither_shift_RGB;
+		return color + dither_shift_RGB;
 	}
 
 #endif