[Bf-blender-cvs] [69c56d2819a] blender-v3.0-release: LineArt: Correct clamping of out of bound isect index

YimingWu noreply at git.blender.org
Tue Jan 11 10:38:38 CET 2022


Commit: 69c56d2819a32de3944c0c9cfe87b18a144aefbc
Author: YimingWu
Date:   Fri Dec 31 21:25:03 2021 +0800
Branches: blender-v3.0-release
https://developer.blender.org/rB69c56d2819a32de3944c0c9cfe87b18a144aefbc

LineArt: Correct clamping of out of bound isect index

Handles rare cases where line doesn't intersect the triangle correctly.

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

M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

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

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 08a0deda5dc..f417bfd6fe3 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -2577,8 +2577,12 @@ static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
         INTERSECT_JUST_GREATER(is, order, is[LCross], RCross);
       }
       else {
-        INTERSECT_JUST_GREATER(is, order, is[LCross], LCross);
-        INTERSECT_JUST_GREATER(is, order, is[LCross], RCross);
+        if (LCross >= 0) {
+          INTERSECT_JUST_GREATER(is, order, is[LCross], LCross);
+          if (LCross >= 0) {
+            INTERSECT_JUST_GREATER(is, order, is[LCross], RCross);
+          }
+        }
       }
     }
   }



More information about the Bf-blender-cvs mailing list