diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-07-09 21:38:40 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-07-09 21:38:46 +0300 |
commit | 2893417d670c935993606b860ba9aaec1b1dd6e1 (patch) | |
tree | a1792141f9146f521a255873df4308eca6d28429 /source/blender/draw/engines/workbench/shaders | |
parent | 29ebb374197d41153fd9ad297ef024d6f5b7d197 (diff) |
Fix T62580 Workbench: Shadow glitch due to degenerate threshold
Fix by adding a threshold instead of direct null comparison.
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders')
-rw-r--r-- | source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl index 8ee70c37949..2c9190bfcf4 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl @@ -37,6 +37,7 @@ in VertexData vData[]; #define DEGENERATE_TRIS_WORKAROUND +#define DEGENERATE_TRIS_AREA_THRESHOLD 4e-17 #define len_sqr(a) dot(a, a) @@ -67,7 +68,7 @@ void main() #ifdef DEGENERATE_TRIS_WORKAROUND /* Check if area is null */ vec2 faces_area = vec2(len_sqr(n1), len_sqr(n2)); - bvec2 degen_faces = equal(abs(faces_area), vec2(0.0)); + bvec2 degen_faces = lessThan(abs(faces_area), vec2(DEGENERATE_TRIS_AREA_THRESHOLD)); /* Both triangles are degenerate, abort. */ if (all(degen_faces)) { |