Cycles: Support visibility check for inner nodes of QBVH
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 10 Jun 2016 08:14:05 +0000 (10:14 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 7 Jul 2016 15:25:48 +0000 (17:25 +0200)
commit1eacbf47e3cdf009b27972e1c617fb1ff56c0aad
tree07330ae832445574bd084e71afe4fdfcfc47fddf
parenta19da5c10d2edac01070760438ae9bb1d89f1439
Cycles: Support visibility check for inner nodes of QBVH

It was initially unsupported because initial idea of checking visibility
of all children was slowing scenes down a lot. Now the idea has changed
and we only perform visibility check of current node. This avoids huge
slowdown (from tests here it seems to be withing 1-2%, but more tests
would never hurt) and gives nice speedup of ray traversal for complex
scenes which utilized ray visibility.

Here's timing of koro.blend:

                  Without visibility check         With visibility check
Original file           4min 20sec                      4min 23sec
Camera rays only        1min 43 sec                       55sec

Unfortunately, this doesn't come for free and requires extra data in
BVH node, which increases memory usage of BVH nodes by 15%. This we
can solve with some future trickery of avoiding __tri_storage created
for curve segments.
intern/cycles/bvh/bvh.cpp
intern/cycles/bvh/bvh.h
intern/cycles/kernel/geom/geom.h
intern/cycles/kernel/geom/geom_qbvh.h
intern/cycles/kernel/geom/geom_qbvh_shadow.h
intern/cycles/kernel/geom/geom_qbvh_subsurface.h
intern/cycles/kernel/geom/geom_qbvh_traversal.h
intern/cycles/kernel/geom/geom_qbvh_volume.h
intern/cycles/kernel/geom/geom_qbvh_volume_all.h