diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-01-17 17:34:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-01-20 14:46:18 +0300 |
commit | 1ad04c7d65b0e9e3efa8563005e91d9aa419fec5 (patch) | |
tree | 99912cb1c7c6506388da1ca623f025ba985dd214 /intern/cycles/bvh/bvh_node.cpp | |
parent | c4890cd354bdba341be5b5fb9cf3724ee294634b (diff) |
Cycles: Store time in BVH nodes
This way we can stop traversing BVH node early on.
Gives about 2-2.5x times render time improvement with 3 BVH steps.
Hopefully this gives no measurable performance loss for scenes with
single BVH step.
Traversal is currently only implemented for QBVH, meaning old CPUs
and GPU do not benefit from this change.
Diffstat (limited to 'intern/cycles/bvh/bvh_node.cpp')
-rw-r--r-- | intern/cycles/bvh/bvh_node.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/intern/cycles/bvh/bvh_node.cpp b/intern/cycles/bvh/bvh_node.cpp index f5cd699bdf4..67580e1bc7b 100644 --- a/intern/cycles/bvh/bvh_node.cpp +++ b/intern/cycles/bvh/bvh_node.cpp @@ -176,6 +176,19 @@ uint BVHNode::update_visibility() return m_visibility; } +void BVHNode::update_time() +{ + if(!is_leaf()) { + InnerNode *inner = (InnerNode*)this; + BVHNode *child0 = inner->children[0]; + BVHNode *child1 = inner->children[1]; + child0->update_time(); + child1->update_time(); + m_time_from = min(child0->m_time_from, child1->m_time_from); + m_time_to = max(child0->m_time_to, child1->m_time_to); + } +} + /* Inner Node */ void InnerNode::print(int depth) const |