diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-09-13 18:41:00 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-09-13 18:44:36 +0300 |
commit | 4088c9fa68b8610bb3706b8f8961faa29dd1f750 (patch) | |
tree | 9dc22a8070f6c9258e37d8379bf2cbe3d8fc461e /source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl | |
parent | 6d359e4498848d795b8043e923850d0a0da7f4ed (diff) |
Eevee: Get rid of glitchy black SSR.
Add sanitizer. I wanted to stay away from this because I think we should fix what causes NaNs in the first place. But there can be too much different factor causing NaNs and it can be because of user inputs.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl index 1f3c7822124..355c2038dd2 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl @@ -314,9 +314,13 @@ vec4 get_ssr_sample( /* Do not add light if ray has failed. */ sample *= float(has_hit); -#if 0 /* Enable to see where NANs come from. */ - sample = (any(isnan(sample))) ? vec3(0.0) : sample; -#endif + /* Protection against NaNs in the history buffer. + * This could be removed if some previous pass has already + * sanitized the input. */ + if (any(isnan(sample))) { + sample = vec3(0.0); + weight = 0.0; + } return vec4(sample, mask) * weight; } |