diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-03-06 18:15:26 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-03-06 18:15:26 +0300 |
commit | 9d3eec785b492b7e7a545efd62e1c906d4a574ff (patch) | |
tree | 005e8b6aa4c27e44430df3b211f9029b55c37784 | |
parent | 61039bf71376f1b57cd8df7ff3deb285099becba (diff) |
Fix T62220: Solid shading mode - Shadow glitch
The degenerate triangle threshold was too big. Making it an equal test can
introduce problems in other cases but I could not make it fail.
-rw-r--r-- | source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl | 8 |
1 files changed, 4 insertions, 4 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 14f47556896..00213260df0 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl @@ -34,7 +34,7 @@ in VertexData { vec4 backPosition; } vData[]; -#define DEGENERATE_THRESHOLD 1e-12 +#define DEGENERATE_TRIS_WORKAROUND #define len_sqr(a) dot(a, a) @@ -58,10 +58,10 @@ void main() vec3 n1 = cross(v12, v10); vec3 n2 = cross(v13, v12); -#ifdef DEGENERATE_THRESHOLD +#ifdef DEGENERATE_TRIS_WORKAROUND /* Check if area is null */ vec2 faces_area = vec2(len_sqr(n1), len_sqr(n2)); - bvec2 degen_faces = lessThan(abs(faces_area), vec2(DEGENERATE_THRESHOLD)); + bvec2 degen_faces = equal(abs(faces_area), vec2(0.0)); /* Both triangles are degenerate, abort. */ if (all(degen_faces)) { @@ -77,7 +77,7 @@ void main() bvec2 backface = greaterThan(facing, vec2(0.0)); -#ifdef DEGENERATE_THRESHOLD +#ifdef DEGENERATE_TRIS_WORKAROUND # ifndef DOUBLE_MANIFOLD /* If the mesh is known to be manifold and we don't use double count, * only create an quad if the we encounter a facing geom. */ |