[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58028] branches/soc-2013-paint/source/ blender/editors/sculpt_paint/paint_image_proj.c: Improve seam detection criterion in projective texturing.

Antony Riakiotakis kalast at gmail.com
Sat Jul 6 02:52:51 CEST 2013


Revision: 58028
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58028
Author:   psy-fi
Date:     2013-07-06 00:52:50 +0000 (Sat, 06 Jul 2013)
Log Message:
-----------
Improve seam detection criterion in projective texturing. For well
behaved face windings, coming from unwrapping, we expect the winding of
the faces to be opposing at the edge boundary. If not, this means that
the faces sharing the edge will occupy the same uv space. So, add a seam
there to make the boundary invisible when painting in projection
painting.

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-05 23:02:57 UTC (rev 58027)
+++ branches/soc-2013-paint/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-07-06 00:52:50 UTC (rev 58028)
@@ -909,6 +909,8 @@
 
 			/* Only need to check if 'i2_fidx' is valid because we know i1_fidx is the same vert on both faces */
 			if (i2_fidx != -1) {
+				bool winding1 = orig_i1_fidx == (orig_i2_fidx + 1) % ((orig_mf->v4)? 4 : 3);
+				bool winding2 = i1_fidx == (i2_fidx + 1)  % ((mf->v4)? 4 : 3);
 				Image *tpage = project_paint_face_image(ps, ps->dm_mtface, face_index);
 				Image *orig_tpage = project_paint_face_image(ps, ps->dm_mtface, orig_face);
 
@@ -919,10 +921,14 @@
 				*other_face = face_index;
 				*orig_fidx = (i1_fidx < i2_fidx) ? i1_fidx : i2_fidx;
 
-				/* first test if they have the same image */
+				/* first test if they have the same image, then if uvs coincide.
+				 * last check detects if faces are pointing to opposite ways. For
+				 * well behaved UV maps, the winding of the faces at the connnection edge
+				 * should be opposing */
 				if ((orig_tpage == tpage) &&
 				    cmp_uv(orig_tf->uv[orig_i1_fidx], tf->uv[i1_fidx]) &&
-				    cmp_uv(orig_tf->uv[orig_i2_fidx], tf->uv[i2_fidx]) )
+				    cmp_uv(orig_tf->uv[orig_i2_fidx], tf->uv[i2_fidx]) &&
+				    (winding1 == winding2))
 				{
 					// printf("SEAM (NONE)\n");
 					return 0;




More information about the Bf-blender-cvs mailing list