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
parent 6ee14c966d
commit 675d8a9c43
2 changed files with 4 additions and 3 deletions

View File

@@ -473,7 +473,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

@@ -2475,8 +2475,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 {