Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2017-08-11 00:08:33 +0300
committerClément Foucault <foucault.clem@gmail.com>2017-08-11 02:26:05 +0300
commit0665f58a57b54c874f9d944cb0fbf3422cb214b0 (patch)
tree96881200383d650203f3f0def202e8aa1a3e3fbf /source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
parenta8e1a7ba6d895f1ad3e07427f1239de59171bce5 (diff)
Eevee: Fix NaN
This was surely cause by float overflow. Limit roughness in this case to limit the brdf intensity. Also compute VH faster. Add a sanitizer to the SSR pass for investigating where NANs come from. Play with the roughness until you see where the black pixel is / comes from.
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.glsl6
1 files changed, 5 insertions, 1 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 68bcf8c06e4..267c52f0508 100644
--- a/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
+++ b/source/blender/draw/engines/eevee/shaders/effect_ssr_frag.glsl
@@ -270,7 +270,7 @@ vec4 get_ssr_sample(
mask = min(mask, screen_border_mask(ref_uvs));
mask *= float(has_hit);
- float hit_dist = length(hit_vec);
+ float hit_dist = max(1e-8, length(hit_vec));
vec3 L = hit_vec / hit_dist;
float cone_footprint = hit_dist * cone_tan;
@@ -306,6 +306,10 @@ 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
+
return vec4(sample, mask) * weight;
}