[Bf-blender-cvs] [4da9568bfc2] temp-lineart-contained: Merge remote-tracking branch 'origin/master' into temp-lineart-contained

YimingWu noreply at git.blender.org
Fri Feb 25 07:11:47 CET 2022


Commit: 4da9568bfc277d486112c1cceadf7f2cd33c595e
Author: YimingWu
Date:   Fri Feb 25 12:51:07 2022 +0800
Branches: temp-lineart-contained
https://developer.blender.org/rB4da9568bfc277d486112c1cceadf7f2cd33c595e

Merge remote-tracking branch 'origin/master' into temp-lineart-contained

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



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

diff --cc source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 1dddb835c50,31dd37db1a7..c96361a139d
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@@ -1632,31 -1556,39 +1617,55 @@@ static uint16_t lineart_identify_featur
          tri2->flags |= LRT_CULL_DISCARD;
        }
      }
+     if (material_back_face) {
+       if (tri1->flags & LRT_TRIANGLE_MAT_BACK_FACE_CULLING && dot_1 < 0) {
+         tri1->flags |= LRT_CULL_DISCARD;
+       }
+       if (tri2->flags & LRT_TRIANGLE_MAT_BACK_FACE_CULLING && dot_2 < 0) {
+         tri2->flags |= LRT_CULL_DISCARD;
+       }
+     }
    }
 -  else {
 -    view_vector = rb->view_vector;
 +
 +  /* For when face mark filtering decided that we discard the face but keep_contour option is on.
 +   * so we still have correct full contour around the object. */
 +  if (only_contour) {
 +    return edge_flag_result;
    }
  
 -  if ((result = dot_1 * dot_2) <= 0 && (fabs(dot_1) + fabs(dot_2))) {
 -    edge_flag_result |= LRT_EDGE_FLAG_CONTOUR;
 +  if (rb->use_light_contour) {
 +    if (rb->light_is_sun) {
 +      view_vector = rb->light_vector;
 +    }
 +    else {
 +      view_vector = vv;
 +      sub_v3_v3v3_db(view_vector, l->gloc, rb->light_vector);
 +    }
 +
 +    dot_1 = dot_v3v3_db(view_vector, tri1->gn);
 +    dot_2 = dot_v3v3_db(view_vector, tri2->gn);
 +
 +    if ((result = dot_1 * dot_2) <= 0 && (dot_1 + dot_2)) {
 +      edge_flag_result |= LRT_EDGE_FLAG_LIGHT_CONTOUR;
 +    }
    }
  
+   /* For when face mark filtering decided that we discard the face but keep_contour option is on.
+    * so we still have correct full contour around the object. */
+   if (only_contour) {
+     return edge_flag_result;
+   }
+ 
+   /* Do not show lines other than contour on back face (because contour has one adjacent face that
+    * isn't a back face).
+    * TODO(Yiming): Do we need separate option for this? */
+   if (rb->use_back_face_culling ||
+       ((tri1->flags & tri2->flags) & LRT_TRIANGLE_MAT_BACK_FACE_CULLING)) {
+     if (dot_1 < 0 && dot_2 < 0) {
+       return edge_flag_result;
+     }
+   }
+ 
    if (rb->use_crease) {
      if (rb->sharp_as_crease && !BM_elem_flag_test(e, BM_ELEM_SMOOTH)) {
        edge_flag_result |= LRT_EDGE_FLAG_CREASE;
diff --cc source/blender/makesrna/intern/rna_gpencil_modifier.c
index db250f55d4a,a619d179a33..e5862d8984b
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@@ -3488,14 -3451,14 +3483,13 @@@ static void rna_def_modifier_gpencillin
        prop,
        "Image Boundary Trimming",
        "Trim all edges right at the boundary of image(including overscan region)");
-   RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
  
 -  prop = RNA_def_property(srna, "use_back_face_culling", PROP_BOOLEAN, PROP_NONE);
 -  RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_USE_BACK_FACE_CULLING);
 +  prop = RNA_def_property(srna, "use_ortho_tolerance", PROP_BOOLEAN, PROP_NONE);
 +  RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_USE_ORTHO_TOLERANCE);
    RNA_def_property_ui_text(
        prop,
 -      "Back Face Culling",
 -      "Remove all back faces to speed up calculation, this will create edges in "
 -      "different occlusion levels than when disabled");
 +      "Use Ortho Tolerance",
 +      "Internally rotate the camera slightly to comphensate for the precision of the algorithm");
    RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
  
    prop = RNA_def_property(srna, "use_invert_collection", PROP_BOOLEAN, PROP_NONE);



More information about the Bf-blender-cvs mailing list