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.
This commit is contained in:
Clément Foucault 2017-06-29 17:06:09 +02:00
parent 95797336f5
commit 790b15112b
Notes: blender-bot 2023-02-14 06:51:01 +01:00
Referenced by issue #51922, Eevee: Probe and AO issues
1 changed files with 2 additions and 1 deletions

View File

@ -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. */