[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24527] trunk/blender/source/blender/ blenkernel/intern/CCGSubSurf.c: sintel' s normals were rendering black around her eye.

Campbell Barton ideasman42 at gmail.com
Thu Nov 12 16:05:51 CET 2009


Revision: 24527
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24527
Author:   campbellbarton
Date:     2009-11-12 16:05:51 +0100 (Thu, 12 Nov 2009)

Log Message:
-----------
sintel's normals were rendering black around her eye.
Subsurf FLT_EPSILON from float.h was too high, using a smaller value fixes

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/CCGSubSurf.c

Modified: trunk/blender/source/blender/blenkernel/intern/CCGSubSurf.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/CCGSubSurf.c	2009-11-12 14:49:54 UTC (rev 24526)
+++ trunk/blender/source/blender/blenkernel/intern/CCGSubSurf.c	2009-11-12 15:05:51 UTC (rev 24527)
@@ -3,12 +3,15 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
-#include <float.h>
 
 #include "CCGSubSurf.h"
 
 #include "BLO_sys_types.h" // for intptr_t support
 
+/* used for normalize_v3 in BLI_math_vector
+ * float.h's FLT_EPSILON causes trouble with subsurf normals - campbell */
+#define EPSILON (1.0e-35f)
+
 /***/
 
 typedef unsigned char	byte;
@@ -593,7 +596,7 @@
 
 	length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]);
 
-	if (length>FLT_EPSILON) {
+	if (length>EPSILON) {
 		float invLength = 1.f/length;
 
 		no[0] *= invLength;
@@ -1934,7 +1937,7 @@
 
 			length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]);
 
-			if (length>FLT_EPSILON) {
+			if (length>EPSILON) {
 				float invLength = 1.0f/length;
 				no[0] *= invLength;
 				no[1] *= invLength;
@@ -1993,7 +1996,7 @@
 						float *no = FACE_getIFNo(f, lvl, S, x, y);
 						float length = sqrt(no[0]*no[0] + no[1]*no[1] + no[2]*no[2]);
 
-						if (length>FLT_EPSILON) {
+						if (length>EPSILON) {
 							float invLength = 1.0f/length;
 							no[0] *= invLength;
 							no[1] *= invLength;





More information about the Bf-blender-cvs mailing list