Commit: 790b15112b630b60e3bb78407f258995685b1990
Author: Clément Foucault
Date:   Thu Jun 29 17:06:09 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB790b15112b630b60e3bb78407f258995685b1990

Eevee: Fix T51922: Avoid division by 0.

Problem was caused by a division by 0 when rendering the probes. This patch 
make the visibility equal to 1.0 in this case.

===================================================================

M       source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl

===================================================================

diff --git 
a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl 
b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
index 5fcc24d1a73..77bae174985 100644
--- a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl
@@ -187,7 +187,8 @@ void gtao(vec3 normal, vec3 position, vec2 noise, out float 
visibility
                integrate_slice(i, x, normal, x_, noise, max_dist, pixel_ratio, 
pixel_len, visibility, bent_normal);
        }
 
-       visibility = clamp(visibility / aoSamples, 1e-8, 1.0);
+       /* aoSamples can be 0.0 to temporary disable the effect. */
+       visibility = clamp(max(1e-8, visibility) / max(1e-8, aoSamples), 1e-8, 
1.0);
 
 #ifdef USE_BENT_NORMAL
        /* The bent normal will show the facet look of the mesh. Try to 
minimize this. */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to