[Bf-blender-cvs] [788fb83] master: Cycles: Store proper empty boundbox for missing child nodes in QBVH

Sergey Sharybin noreply at git.blender.org
Wed Dec 24 22:56:26 CET 2014


Commit: 788fb8321a027eb4e635545dabc8c97ae164f984
Author: Sergey Sharybin
Date:   Thu Dec 25 00:14:12 2014 +0500
Branches: master
https://developer.blender.org/rB788fb8321a027eb4e635545dabc8c97ae164f984

Cycles: Store proper empty boundbox for missing child nodes in QBVH

The idea is to make sure those childs would never be intersected with a ray
in order to make it so kernel never worries about number of child nodes.

===================================================================

M	intern/cycles/bvh/bvh.cpp

===================================================================

diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 8b1759e..b591d59 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -721,13 +721,17 @@ void QBVH::pack_inner(const BVHStackEntry& e, const BVHStackEntry *en, int num)
 	}
 
 	for(int i = num; i < 4; i++) {
-		data[0][i] = 0.0f;
-		data[1][i] = 0.0f;
-		data[2][i] = 0.0f;
+		/* We store BB which would never be recorded as intersection
+		 * so kernel might safely assume there are always 4 child nodes.
+		 */
+		data[0][i] = FLT_MAX;
+		data[1][i] = -FLT_MAX;
+
+		data[2][i] = FLT_MAX;
+		data[3][i] = -FLT_MAX;
 
-		data[3][i] = 0.0f;
-		data[4][i] = 0.0f;
-		data[5][i] = 0.0f;
+		data[4][i] = FLT_MAX;
+		data[5][i] = -FLT_MAX;
 
 		data[6][i] = __int_as_float(0);
 	}




More information about the Bf-blender-cvs mailing list