[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58042] branches/soc-2013-paint/source/ blender/editors/sculpt_paint/paint_image_proj.c: Proper fix for seams not getting generated for faces "folded" on an edge

Antony Riakiotakis kalast at gmail.com
Sat Jul 6 14:03:29 CEST 2013


Revision: 58042
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58042
Author:   psy-fi
Date:     2013-07-06 12:03:28 +0000 (Sat, 06 Jul 2013)
Log Message:
-----------
Proper fix for seams not getting generated for faces "folded" on an edge
in UV space, such as the faces at the symmetry plane of mirrored meshes.

The check is somewhat costly, as a TODO it will have to be cached and
not happen during stroke (though once per face is not that terrible).

Modified Paths:
--------------
    branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_proj.c

Modified: branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
--- branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-07-06 10:49:14 UTC (rev 58041)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-07-06 12:03:28 UTC (rev 58042)
@@ -927,6 +927,29 @@
 				    cmp_uv(orig_tf->uv[orig_i1_fidx], tf->uv[i1_fidx]) &&
 				    cmp_uv(orig_tf->uv[orig_i2_fidx], tf->uv[i2_fidx]))
 				{
+					/* as extra check, we need to check if the polygons occupy the same uv space. To test
+					 * that, we generate a point slightly to the side of the uv edge and check for intersection */
+					float uv_edge[2] = {tf->uv[i1_fidx][0] - tf->uv[i2_fidx][0],
+					                    tf->uv[i1_fidx][1] - tf->uv[i2_fidx][1]};
+					float uv_normal[2];
+					float uv_point[2];
+					bool isect_orig, isect;
+					normalize_v2_v2(uv_normal, uv_edge);
+					SWAP(float, uv_normal[0], uv_normal[1]);
+					uv_normal[0] = -uv_normal[0];
+					mul_v2_fl(uv_normal, PROJ_GEOM_TOLERANCE * 1.5);
+
+					add_v2_v2v2(uv_point, tf->uv[i1_fidx], tf->uv[i2_fidx]);
+					mul_v2_fl(uv_point, 0.5);
+					add_v2_v2(uv_point, uv_normal);
+
+					/* we now have a point in the middle of the uv edge, slightly offset in uv space.
+					 * Test if it is within both faces */
+					isect_orig = isect_point_poly_v2(uv_point, orig_tf->uv, ((orig_mf->v4) ? 4 : 3));
+					isect = isect_point_poly_v2(uv_point, ((const MTFace *)tf)->uv, ((mf->v4) ? 4 : 3));
+
+					if (isect_orig == isect)
+						return 1;
 					// printf("SEAM (NONE)\n");
 					return 0;
 				}




More information about the Bf-blender-cvs mailing list