From 1f3e277121795aaa37b7b719a0b5d0b8185b0d1c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 3 Feb 2010 13:54:09 +0000 Subject: bugfix [#20709] Strange rendering artifacts in raytraced refraction --- source/blender/render/intern/source/rayshade.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/blender/render') diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index d35521e92ac..f54ef09e79f 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -699,7 +699,8 @@ static void ray_fadeout(Isect *is, ShadeInput *shi, float *col, float *blendcol, col[2] = col[2]*blendfac + (1.0 - blendfac)*blendcol[2]; } -/* the main recursive tracer itself */ +/* the main recursive tracer itself + * note: 'col' must be initialized */ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, float *start, float *vec, float *col, ObjectInstanceRen *obi, VlakRen *vlr, int traflag) { ShadeInput shi; @@ -1316,7 +1317,9 @@ static void trace_refract(float *col, ShadeInput *shi, ShadeResult *shr) /* no blurriness, use the original normal */ VECCOPY(v_refract_new, v_refract); } - + + sampcol[0]= sampcol[1]= sampcol[2]= sampcol[3]= 0.0f; + traceray(shi, shr, shi->mat->ray_depth_tra, shi->co, v_refract_new, sampcol, shi->obi, shi->vlr, RAY_TRA|RAY_TRAFLIP); col[0] += sampcol[0]; @@ -1414,6 +1417,8 @@ static void trace_reflect(float *col, ShadeInput *shi, ShadeResult *shr, float f else reflection(v_reflect, v_nor_new, shi->view, NULL); + sampcol[0]= sampcol[1]= sampcol[2]= sampcol[3]= 0.0f; + traceray(shi, shr, shi->mat->ray_depth, shi->co, v_reflect, sampcol, shi->obi, shi->vlr, 0); -- cgit v1.2.3