[Bf-blender-cvs] [46c68c46a50] master: 3D Texturing: Adding more cases where seams can be fixed.

Jeroen Bakker noreply at git.blender.org
Fri Jan 27 15:51:21 CET 2023


Commit: 46c68c46a50eb17217787ebca0e140375006eb75
Author: Jeroen Bakker
Date:   Fri Jan 27 14:39:58 2023 +0100
Branches: master
https://developer.blender.org/rB46c68c46a50eb17217787ebca0e140375006eb75

3D Texturing: Adding more cases where seams can be fixed.

Case added where a corner in uv space share the same edge in 3d space.
This used to work, but was lost when implementing
the new approach.

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

M	source/blender/blenkernel/intern/pbvh_uv_islands.cc
M	source/blender/blenkernel/intern/pbvh_uv_islands.hh

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

diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.cc b/source/blender/blenkernel/intern/pbvh_uv_islands.cc
index 07eb3137249..522b11b58db 100644
--- a/source/blender/blenkernel/intern/pbvh_uv_islands.cc
+++ b/source/blender/blenkernel/intern/pbvh_uv_islands.cc
@@ -925,8 +925,7 @@ static void extend_at_vert(const MeshData &mesh_data,
    * triangle when the corner angle is near 180 degrees. In order to fix this we will
    * always add two segments both using the same fill primitive.
    */
-  if ((num_to_add == 0 && winding_solution.size() == 1) ||
-      (corner.angle > 1.0f && winding_solution.size() < 2)) {
+  if (winding_solution.size() < 2 && (num_to_add == 0 || corner.angle > 2.0f)) {
     int fill_primitive_1_i = corner.second->uv_primitive->primitive_i;
     int fill_primitive_2_i = corner.first->uv_primitive->primitive_i;
 
@@ -1460,9 +1459,10 @@ UVIslands::UVIslands(const MeshData &mesh_data)
 {
   islands.reserve(mesh_data.uv_island_len);
 
-  for (int64_t uv_island_id = 0; uv_island_id < mesh_data.uv_island_len; uv_island_id++) {
+  for (const int64_t uv_island_id : IndexRange(mesh_data.uv_island_len)) {
     islands.append_as(UVIsland());
     UVIsland *uv_island = &islands.last();
+    uv_island->id = uv_island_id;
     for (const int primitive_i : mesh_data.looptris.index_range()) {
       if (mesh_data.uv_island_ids[primitive_i] == uv_island_id) {
         add_primitive(mesh_data, *uv_island, primitive_i);
diff --git a/source/blender/blenkernel/intern/pbvh_uv_islands.hh b/source/blender/blenkernel/intern/pbvh_uv_islands.hh
index b292c85bb01..6324b742fc4 100644
--- a/source/blender/blenkernel/intern/pbvh_uv_islands.hh
+++ b/source/blender/blenkernel/intern/pbvh_uv_islands.hh
@@ -289,6 +289,12 @@ struct UVBorder {
 };
 
 struct UVIsland {
+  /**
+   * Id (Index) of the UVIsland. Contains the index of this island in UVIslands.
+   *
+   * Useful during debugging to set a breaking condition on a specific island/vert.
+   */
+  int id;
   VectorList<UVVertex> uv_vertices;
   VectorList<UVEdge> uv_edges;
   VectorList<UVPrimitive> uv_primitives;



More information about the Bf-blender-cvs mailing list