Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-03-30 22:21:04 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-03-30 22:24:43 +0300
commitdd0604c6066a46a72fccc185bbbc592ff76c7052 (patch)
tree9a0196bcda1978c5de382171e64d3af950b145f6 /intern/cycles/bvh/bvh_build.cpp
parent9b4172cc6c0ab8f3c5476a37273197474ff33de0 (diff)
Fix T44193: Hair intersection with duplis causes flickering
It was an issue with what bounds to use for BVH node during construction. Also corrected case when there are all 4 primitive types in the range and also there're objects in the same range.
Diffstat (limited to 'intern/cycles/bvh/bvh_build.cpp')
-rw-r--r--intern/cycles/bvh/bvh_build.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index cb389b78049..5baf94918b4 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -577,17 +577,22 @@ BVHNode* BVHBuild::create_leaf_node(const BVHRange& range)
return new InnerNode(range.bounds(), leaves[0], leaves[1]);
}
else if(num_leaves == 3) {
- BoundBox inner_bounds = merge(bounds[1], bounds[2]);
+ BoundBox inner_bounds = merge(leaves[1]->m_bounds, leaves[2]->m_bounds);
BVHNode *inner = new InnerNode(inner_bounds, leaves[1], leaves[2]);
return new InnerNode(range.bounds(), leaves[0], inner);
- } else /*if(num_leaves == 4)*/ {
+ } else {
/* Shpuld be doing more branches if more primitive types added. */
- assert(num_leaves == 4);
- BoundBox inner_bounds_a = merge(bounds[0], bounds[1]);
- BoundBox inner_bounds_b = merge(bounds[2], bounds[3]);
+ assert(num_leaves <= 5);
+ BoundBox inner_bounds_a = merge(leaves[0]->m_bounds, leaves[1]->m_bounds);
+ BoundBox inner_bounds_b = merge(leaves[2]->m_bounds, leaves[3]->m_bounds);
BVHNode *inner_a = new InnerNode(inner_bounds_a, leaves[0], leaves[1]);
BVHNode *inner_b = new InnerNode(inner_bounds_b, leaves[2], leaves[3]);
- return new InnerNode(range.bounds(), inner_a, inner_b);
+ BoundBox inner_bounds_c = merge(inner_a->m_bounds, inner_b->m_bounds);
+ BVHNode *inner_c = new InnerNode(inner_bounds_c, inner_a, inner_b);
+ if(num_leaves == 5) {
+ return new InnerNode(range.bounds(), inner_c, leaves[4]);
+ }
+ return inner_c;
}
}