A modern C++ BVH construction and traversal library
Note: This is the 2nd version of this library. Check the
v1branch for the older, first version of this library.
This library is a small, standalone library for BVH construction and traversal. It is licensed under the MIT license.
(Scene by Blend Swap user MaTTeSr, available here, distributed under CC-BY 3.0)
Here is a comparison of this library with other alternatives (Embree, Fast-BVH, and nanort):
Here is a list of features supported by this library (changes from v1 are indicated with [NEW]):
std::span instead of raw pointers,DefaultBuilder API which selects the best builder depending on the desired
BVH quality level.float or double),std::thread),This library is header-only, and can be added as a CMake subproject by cloning or adding as this
repository as submodule, for instance in /contrib/bvh, and then adding this to
/CMakeLists.txt:
add_subdirectory(contrib/bvh)
target_link_library(my_project PUBLIC bvh)If you want to build the examples, use:
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE= -DENABLE_TESTING=ON
cmake --build .The library can be used via a small set of high-level C bindings. These bindings are not enabled by
default, but can be built by configuring CMake with -DBVH_BUILD_C_API=ON. Additionally, if the
intent is to use the library in a pure C environment which does not have the C++ standard library as
a dependency, it might be a good idea to statically the C++ standard library. That can be done by
adding the flag -DBVH_STATIC_LINK_STDLIB_C_API=ON to the CMake command line.
The library contains several examples that are kept up-to-date with the API:
No open issues yet, or sync has not completed.