[Bf-blender-cvs] [9afc5ccb6b3] temp-lineart-contained: LineArt: Consistent camera ray direction.

YimingWu noreply at git.blender.org
Wed Dec 1 10:04:29 CET 2021


Commit: 9afc5ccb6b385d3a0b168eec43aeba68b9883387
Author: YimingWu
Date:   Wed Dec 1 17:04:10 2021 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB9afc5ccb6b385d3a0b168eec43aeba68b9883387

LineArt: Consistent camera ray direction.

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

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 05647e2ba8d..0c868c0ff3f 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -1603,7 +1603,7 @@ static uint16_t lineart_identify_feature_line(LineartRenderBuffer *rb,
   if (rb->use_contour || rb->use_back_face_culling) {
 
     if (rb->cam_is_persp) {
-      sub_v3_v3v3_db(view_vector, l->gloc, rb->camera_pos);
+      sub_v3_v3v3_db(view_vector, rb->camera_pos, l->gloc);
     }
     else {
       view_vector = rb->view_vector;
@@ -1616,12 +1616,12 @@ static uint16_t lineart_identify_feature_line(LineartRenderBuffer *rb,
       edge_flag_result |= LRT_EDGE_FLAG_CONTOUR;
     }
 
-    /* Because the camera ray starts from camera, so backface is when dot value being positive. */
+    /* Because the ray points towards the camera, so backface is when dot value being negative.*/
     if (rb->use_back_face_culling) {
-      if (dot_1 > 0) {
+      if (dot_1 < 0) {
         tri1->flags |= LRT_CULL_DISCARD;
       }
-      if (dot_2 > 0) {
+      if (dot_2 < 0) {
         tri2->flags |= LRT_CULL_DISCARD;
       }
     }



More information about the Bf-blender-cvs mailing list