Fix #36541: blender internal raytrace render hangs with high ray depth. The code

here is not efficient for such cases, a ray depth can give up to 2^depth rays due
to the ray splitting in two at each depth. A proper solution requires a better
algorithm, for now I've ensured that you can at least cancel such renders. The
overhead from the extra test_break is negligible.
This commit is contained in:
2013-08-24 15:02:12 +00:00
parent 722d0d92ad
commit a31a85ac9c

View File

@@ -734,6 +734,15 @@ static void traceray(ShadeInput *origshi, ShadeResult *origshr, short depth, con
ShadeInput shi = {NULL};
Isect isec;
float dist_mir = origshi->mat->dist_mir;
/* with high depth the number of rays can explode due to the path splitting
* in two each time, giving 2^depth rays. we need to be able to cancel such
* a render to avoid hanging, a better solution would be random picking
* between directions and russian roulette termination */
if(R.test_break(R.tbh)) {
zero_v4(col);
return;
}
copy_v3_v3(isec.start, start);
copy_v3_v3(isec.dir, dir);