[Bf-blender-cvs] [14f490b932a] master: EEVEE: SSR: Fix unreported smoothstep instability when border factor is 0

Clément Foucault noreply at git.blender.org
Fri Oct 16 12:57:04 CEST 2020


Commit: 14f490b932ad7b2009563c9ee21103b93143d0bb
Author: Clément Foucault
Date:   Fri Oct 16 12:56:33 2020 +0200
Branches: master
https://developer.blender.org/rB14f490b932ad7b2009563c9ee21103b93143d0bb

EEVEE: SSR: Fix unreported smoothstep instability when border factor is 0

>From the GLSL documentation: `Results are undefined if edge0 ≥ edge1.`
This is the case without this patch.

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

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

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

diff --git a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
index 39db39f8756..06a7def532f 100644
--- a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
+++ b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl
@@ -258,7 +258,7 @@ float screen_border_mask(vec2 hit_co)
 {
   const float margin = 0.003;
   float atten = ssrBorderFac + margin; /* Screen percentage */
-  hit_co = smoothstep(margin, atten, hit_co) * (1 - smoothstep(1.0 - atten, 1.0 - margin, hit_co));
+  hit_co = smoothstep(0.0, atten, hit_co) * (1.0 - smoothstep(1.0 - atten, 1.0, hit_co));
 
   float screenfade = hit_co.x * hit_co.y;



More information about the Bf-blender-cvs mailing list