From 1ad04c7d65b0e9e3efa8563005e91d9aa419fec5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 17 Jan 2017 15:34:18 +0100 Subject: 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. --- intern/cycles/bvh/bvh_node.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'intern/cycles/bvh/bvh_node.h') diff --git a/intern/cycles/bvh/bvh_node.h b/intern/cycles/bvh/bvh_node.h index 2faa40ab657..090c426de56 100644 --- a/intern/cycles/bvh/bvh_node.h +++ b/intern/cycles/bvh/bvh_node.h @@ -47,7 +47,9 @@ class BVHNode { public: BVHNode() : m_is_unaligned(false), - m_aligned_space(NULL) + m_aligned_space(NULL), + m_time_from(0.0f), + m_time_to(1.0f) { } @@ -91,12 +93,15 @@ public: void deleteSubtree(); uint update_visibility(); + void update_time(); bool m_is_unaligned; // TODO(sergey): Can be stored as 3x3 matrix, but better to have some // utilities and type defines in util_transform first. Transform *m_aligned_space; + + float m_time_from, m_time_to; }; class InnerNode : public BVHNode -- cgit v1.2.3