Switched off noise and switched back to screen space dither

This commit is contained in:
Olivier Prat 2017-11-14 10:11:39 +01:00
parent fa58cf2e60
commit 010104d42a

View file

@ -11,6 +11,9 @@
<@if not SHADOW_SLH@>
<@def SHADOW_SLH@>
#define SHADOW_NOISE_ENABLED 0
#define SHADOW_SCREEN_SPACE_DITHER 1
// the shadow texture
uniform sampler2DShadow shadowMap;
@ -65,17 +68,20 @@ float evalShadowNoise(vec4 seed) {
float evalShadowAttenuationPCF(vec4 position, vec4 shadowTexcoord) {
float shadowScale = getShadowScale();
#if 0
#if SHADOW_SCREEN_SPACE_DITHER
// Pattern dithering in screen space
ivec2 coords = ivec2(gl_FragCoord.xy);
#else
// Pattern dithering in world space (mm resolution)
ivec2 coords = ivec2(position.x, position.y+position.z);
#endif
#if SHADOW_NOISE_ENABLED
// Add some noise to break dithering
int index = int(4.0*evalShadowNoise(gl_FragCoord.xyyx))%4;
coords.x += index & 1;
coords.y += (index & 2) >> 1;
#endif
// Offset for efficient PCF, see http://http.developer.nvidia.com/GPUGems/gpugems_ch11.html
ivec2 offset = coords & ivec2(1,1);