LineArt: Occlusion accuracy fix.

This patch fixes occlusion function to handle one specific case (when an edge shares a point with triangle) better,especially when there's overlapping edges in this case.
This commit is contained in:
YimingWu 2021-07-27 14:02:22 +08:00 committed by Jeroen Bakker
parent a818ad5a54
commit 69edb9c7d9
Notes: blender-bot 2023-02-14 05:53:42 +01:00
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
2 changed files with 4 additions and 3 deletions

View File

@ -413,7 +413,8 @@ typedef struct LineartBoundingArea {
BLI_INLINE int lineart_LineIntersectTest2d(
const double *a1, const double *a2, const double *b1, const double *b2, double *aRatio)
{
#define USE_VECTOR_LINE_INTERSECTION
/* Legacy intersection math aligns better with occlusion function quirks. */
/* #define USE_VECTOR_LINE_INTERSECTION */
#ifdef USE_VECTOR_LINE_INTERSECTION
/* from isect_line_line_v2_point() */

View File

@ -2141,8 +2141,8 @@ static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
}
}
else if (st_r == 0) {
INTERSECT_JUST_GREATER(is, order, 0, LCross);
if (LRT_ABC(LCross) && is[LCross] > 0) {
INTERSECT_JUST_GREATER(is, order, DBL_TRIANGLE_LIM, LCross);
if (LRT_ABC(LCross) && is[LCross] > DBL_TRIANGLE_LIM) {
INTERSECT_JUST_GREATER(is, order, is[LCross], RCross);
}
else {