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.
This commit is contained in:
Clément Foucault 2017-09-13 17:41:00 +02:00
parent 6d359e4498
commit 4088c9fa68
1 changed files with 7 additions and 3 deletions

View File

@ -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;
}