From 3aab8f245a9d97db9e56375652ab75feede69170 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 23 May 2010 21:38:27 +0000 Subject: [PATCH] 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. --- source/blender/render/intern/source/texture.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 8b33753c2b1..9b087900734 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -2676,7 +2676,8 @@ void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, f 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;