[Bf-blender-cvs] [8bc43ec] cycles_hair_bvh: Cycles: Use proper heuristic when deciding whether we can create unaligned leaf right away
Sergey Sharybin
noreply at git.blender.org
Thu May 12 16:19:32 CEST 2016
Commit: 8bc43eca8bed9af8b29747c4bca60b1f5787dfa8
Author: Sergey Sharybin
Date: Wed May 11 17:24:31 2016 +0200
Branches: cycles_hair_bvh
https://developer.blender.org/rB8bc43eca8bed9af8b29747c4bca60b1f5787dfa8
Cycles: Use proper heuristic when deciding whether we can create unaligned leaf right away
===================================================================
M intern/cycles/bvh/bvh_binning.h
M intern/cycles/bvh/bvh_build.cpp
===================================================================
diff --git a/intern/cycles/bvh/bvh_binning.h b/intern/cycles/bvh/bvh_binning.h
index 03961c7..ad55db1 100644
--- a/intern/cycles/bvh/bvh_binning.h
+++ b/intern/cycles/bvh/bvh_binning.h
@@ -56,6 +56,8 @@ public:
BVHObjectBinning& left_o,
BVHObjectBinning& right_o) const;
+ __forceinline const BoundBox& unaligned_bounds() { return bounds_; }
+
float splitSAH; /* SAH cost of the best split */
float leafSAH; /* SAH cost of creating a leaf */
diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp
index 192b833..e8a8156 100644
--- a/intern/cycles/bvh/bvh_build.cpp
+++ b/intern/cycles/bvh/bvh_build.cpp
@@ -475,13 +475,12 @@ BVHNode* BVHBuild::build_node(const BVHObjectBinning& range, int level)
aligned_space,
range,
&references[0]);
- unalignedSplitSAH = params.sah_node_cost * unaligned_range.bounds().half_area() +
+ unalignedSplitSAH = params.sah_node_cost * unaligned_range.unaligned_bounds().half_area() +
params.sah_primitive_cost * unaligned_range.splitSAH;
unalignedLeafSAH = params.sah_primitive_cost * unaligned_range.leafSAH;
if(!(range.size() > 0 && params.top_level && level == 0)) {
- if((params.small_enough_for_leaf(size, level)) ||
- (range_within_max_leaf_size(range, references) &&
- unalignedLeafSAH < unalignedSplitSAH))
+ if(unalignedLeafSAH < unalignedSplitSAH && unalignedSplitSAH < splitSAH &&
+ range_within_max_leaf_size(range, references))
{
return create_leaf_node(range, references);
}
More information about the Bf-blender-cvs
mailing list