[Bf-blender-cvs] [1d6958b2c67] lineart-shadow: LineArt: Occlusion accuracy fix.
YimingWu
noreply at git.blender.org
Mon Jul 26 16:39:26 CEST 2021
Commit: 1d6958b2c67f4c41d1abc140b9465c0521bb9d82
Author: YimingWu
Date: Mon Jul 26 22:39:09 2021 +0800
Branches: lineart-shadow
https://developer.blender.org/rB1d6958b2c67f4c41d1abc140b9465c0521bb9d82
LineArt: Occlusion accuracy fix.
===================================================================
M source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
M source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
===================================================================
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index ae95bd3bdc1..3d9366dfeaf 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -402,7 +402,7 @@ typedef struct LineartCache {
#define DBL_TRIANGLE_LIM 1e-8
#define DBL_EDGE_LIM 1e-9
-#define DBL_SHADOW_LIM 1e-2
+#define DBL_SHADOW_LIM 1e-6
#define LRT_MEMORY_POOL_1MB (1 << 20)
@@ -549,7 +549,7 @@ 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
+//#define USE_VECTOR_LINE_INTERSECTION
#ifdef USE_VECTOR_LINE_INTERSECTION
/* from isect_line_line_v2_point() */
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index f615e715700..93de07dfdd3 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -2489,7 +2489,7 @@ static bool lineart_triangle_edge_image_space_occlusion(SpinLock *UNUSED(spl),
dot_r = dot_v3v3_db(Rv, tri->gn);
dot_f = dot_v3v3_db(Cv, tri->gn);
- if (e->flags & LRT_EDGE_FLAG_PROJECTED_SHADOW && LRT_SHADOW_CLOSE_ENOUGH(dot_l, 0) &&
+ if ((e->flags & LRT_EDGE_FLAG_PROJECTED_SHADOW) && LRT_SHADOW_CLOSE_ENOUGH(dot_l, 0) &&
LRT_SHADOW_CLOSE_ENOUGH(dot_r, 0)) {
/* Currently unable to precisely determine if the edge is really from this triangle. */
/*if ((dot_f > 0 && (e->flags & LRT_EDGE_FLAG_SHADOW_FACING_LIGHT)) ||
@@ -2615,8 +2615,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 {
@@ -4991,8 +4991,10 @@ static bool lineart_shadow_cast_generate_edges(LineartRenderBuffer *rb,
LineartEdge *e = &elist[i];
BLI_addtail(&e->segments, &es[i]);
LineartVert *v1 = &vlist[i * 2], *v2 = &vlist[i * 2 + 1];
+ // if (ssc->e_ref->t1 && ssc->e_ref->t2) {
copy_v3_v3_db(v1->gloc, ssc->g1);
copy_v3_v3_db(v2->gloc, ssc->g2);
+ //}
e->v1 = v1;
e->v2 = v2;
e->flags = LRT_EDGE_FLAG_PROJECTED_SHADOW;
More information about the Bf-blender-cvs
mailing list