[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43236] trunk/blender/intern/cycles/kernel /svm/svm_checker.h: Cycles: small tweak to checker texture, scale rather than add with epsilon,

Brecht Van Lommel brechtvanlommel at pandora.be
Mon Jan 9 17:57:37 CET 2012


Revision: 43236
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43236
Author:   blendix
Date:     2012-01-09 16:57:26 +0000 (Mon, 09 Jan 2012)
Log Message:
-----------
Cycles: small tweak to checker texture, scale rather than add with epsilon,
looks a bit better on all sides of a mesh.

Modified Paths:
--------------
    trunk/blender/intern/cycles/kernel/svm/svm_checker.h

Modified: trunk/blender/intern/cycles/kernel/svm/svm_checker.h
===================================================================
--- trunk/blender/intern/cycles/kernel/svm/svm_checker.h	2012-01-09 15:17:09 UTC (rev 43235)
+++ trunk/blender/intern/cycles/kernel/svm/svm_checker.h	2012-01-09 16:57:26 UTC (rev 43236)
@@ -24,11 +24,15 @@
 {	
 	p *= scale;
 
-	/* 0.00001  because of unit sized stuff */
-	int xi = (int)fabsf(floor(0.00001f + p.x));
-	int yi = (int)fabsf(floor(0.00001f + p.y));
-	int zi = (int)fabsf(floor(0.00001f + p.z));
-	
+	/* avoid precision issues on unit coordinates */
+	p.x = (p.x + 0.00001f)*0.9999f;
+	p.y = (p.y + 0.00001f)*0.9999f;
+	p.z = (p.z + 0.00001f)*0.9999f;
+
+	int xi = (int)fabsf(floorf(p.x));
+	int yi = (int)fabsf(floorf(p.y));
+	int zi = (int)fabsf(floorf(p.z));
+
 	return ((xi % 2 == yi % 2) == (zi % 2))? 1.0f: 0.0f;
 }
 



More information about the Bf-blender-cvs mailing list