[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28941] trunk/blender/source/blender/ render/intern/source/texture.c: bugfix [#22398] Black spots on reflecting surfaces when using Environment Light with HDR

Campbell Barton ideasman42 at gmail.com
Sun May 23 23:38:27 CEST 2010


Revision: 28941
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28941
Author:   campbellbarton
Date:     2010-05-23 23:38:27 +0200 (Sun, 23 May 2010)

Log Message:
-----------
bugfix [#22398] Black spots on reflecting surfaces when using Environment Light with HDR
 acos() was being called with a value around  '-1.000001' because of float precission error.

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

Modified: trunk/blender/source/blender/render/intern/source/texture.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/texture.c	2010-05-23 21:20:13 UTC (rev 28940)
+++ trunk/blender/source/blender/render/intern/source/texture.c	2010-05-23 21:38:27 UTC (rev 28941)
@@ -2676,7 +2676,8 @@
 			switch(mtex->texco) {
 			case TEXCO_ANGMAP:
 				/* only works with texture being "real" */
-				fact= (1.0/M_PI)*acos(lo[2])/(sqrt(lo[0]*lo[0] + lo[1]*lo[1])); 
+				/* use saacos(), fixes bug [#22398], float precission caused lo[2] to be slightly less then -1.0 */
+				fact= (1.0/M_PI)*saacos(lo[2])/(sqrt(lo[0]*lo[0] + lo[1]*lo[1])); 
 				tempvec[0]= lo[0]*fact;
 				tempvec[1]= lo[1]*fact;
 				tempvec[2]= 0.0;





More information about the Bf-blender-cvs mailing list