[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20192] trunk/blender/source/blender/ render/intern/source/rendercore.c: [#18685] dark pixels created when during texture "full baking"

Campbell Barton ideasman42 at gmail.com
Thu May 14 04:21:51 CEST 2009


Revision: 20192
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20192
Author:   campbellbarton
Date:     2009-05-14 04:21:50 +0200 (Thu, 14 May 2009)

Log Message:
-----------
[#18685] dark pixels created when during texture "full baking"
fix/workaround - offset by a 500th of a pixel to avoid baking missing pixels that are between 2 faces, its still possible pixels could be between faces but much less likely then it is currently with pixel aligned UVs.

Modified Paths:
--------------
    trunk/blender/source/blender/render/intern/source/rendercore.c

Modified: trunk/blender/source/blender/render/intern/source/rendercore.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/rendercore.c	2009-05-14 00:10:25 UTC (rev 20191)
+++ trunk/blender/source/blender/render/intern/source/rendercore.c	2009-05-14 02:21:50 UTC (rev 20192)
@@ -2542,8 +2542,12 @@
 	
 	/* get pixel level vertex coordinates */
 	for(a=0; a<4; a++) {
-		vec[a][0]= tface->uv[a][0]*(float)bs->rectx - 0.5f;
-		vec[a][1]= tface->uv[a][1]*(float)bs->recty - 0.5f;
+		/* Note, workaround for pixel aligned UVs which are common and can screw up our intersection tests
+		 * where a pixel gets inbetween 2 faces or the middle of a quad,
+		 * camera aligned quads also have this problem but they are less common.
+		 * Add a small offset to the UVs, fixes bug #18685 - Campbell */
+		vec[a][0]= tface->uv[a][0]*(float)bs->rectx - (0.5f + 0.001);
+		vec[a][1]= tface->uv[a][1]*(float)bs->recty - (0.5f + 0.002);
 	}
 	
 	/* UV indices have to be corrected for possible quad->tria splits */





More information about the Bf-blender-cvs mailing list