Cycles: BVH build time optimizations:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 24 Apr 2012 11:52:58 +0000 (11:52 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 24 Apr 2012 11:52:58 +0000 (11:52 +0000)
commit764432ac930e0e62ca2e7ddd5228a2be4867e797
treebf5c643c17043da04d86e0e10af8424f1d07ad23
parentea4ce9e4ea88c7374e6633c6407812af0e2e6170
Cycles: BVH build time optimizations:

* BVH building was multithreaded. Not all building is multithreaded, packing
  and the initial bounding/splitting is still single threaded, but recursive
  splitting is, which was the main bottleneck.

* Object splitting now uses binning rather than sorting of all elements, using
  code from the Embree raytracer from Intel.
  http://software.intel.com/en-us/articles/embree-photo-realistic-ray-tracing-kernels/

* Other small changes to avoid allocations, pack memory more tightly, avoid
  some unnecessary operations, ...

These optimizations do not work yet when Spatial Splits are enabled, for that
more work is needed. There's also other optimizations still needed, in
particular for the case of many low poly objects, the packing step and node
memory allocation.

BVH raytracing time should remain about the same, but BVH build time should be
significantly reduced, test here show speedup of about 5x to 10x on a dual core
and 5x to 25x on an 8-core machine, depending on the scene.
17 files changed:
intern/cycles/bvh/CMakeLists.txt
intern/cycles/bvh/bvh.cpp
intern/cycles/bvh/bvh_binning.cpp [new file with mode: 0644]
intern/cycles/bvh/bvh_binning.h [new file with mode: 0644]
intern/cycles/bvh/bvh_build.cpp
intern/cycles/bvh/bvh_build.h
intern/cycles/bvh/bvh_node.cpp
intern/cycles/bvh/bvh_node.h
intern/cycles/bvh/bvh_params.h
intern/cycles/bvh/bvh_sort.cpp
intern/cycles/bvh/bvh_sort.h
intern/cycles/bvh/bvh_split.cpp [new file with mode: 0644]
intern/cycles/bvh/bvh_split.h [new file with mode: 0644]
intern/cycles/render/mesh.cpp
intern/cycles/render/object.cpp
intern/cycles/subd/subd_patch.cpp
intern/cycles/util/util_boundbox.h