diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-08-24 19:02:12 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-08-24 19:02:12 +0400 |
commit | a31a85ac9cdfb28b0b56a2e445a0f61048730eef (patch) | |
tree | 29ed8a2f7700432d5d1c5aacc161c1040925be36 /source/blender | |
parent | 722d0d92adefbeca2fb8326ce7bf217530d7b59c (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/render/intern/source/rayshade.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index 7ae64d499fa..838f73b5e83 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -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); |