[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59472] trunk/blender/source/blender/ render/intern/source/rayshade.c: Fix #36541: blender internal raytrace render hangs with high ray depth.

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Aug 24 17:02:12 CEST 2013


Revision: 59472
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59472
Author:   blendix
Date:     2013-08-24 15:02:12 +0000 (Sat, 24 Aug 2013)
Log Message:
-----------
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.

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

Modified: trunk/blender/source/blender/render/intern/source/rayshade.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/rayshade.c	2013-08-24 15:02:08 UTC (rev 59471)
+++ trunk/blender/source/blender/render/intern/source/rayshade.c	2013-08-24 15:02:12 UTC (rev 59472)
@@ -734,6 +734,15 @@
 	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);




More information about the Bf-blender-cvs mailing list