Bounding Volume Hierarchy #18
-
Hey, This project is really amazing, I was interested in the BVH that you implemented. Is it something that you wrote or is it something that you were able to pull from another source? Thank you! Kurt |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi Kurt This BVH is something I wrote myself when I was learning the PBR-book. Actually PBR book provides an excellent implementation, but I thought if I just copied the code then there wouldn't be much I could learn. This code is based on the understanding of mine for the contents in the PBR-book, therefore the idea behind the BVH implementation should closely resemble to that of PBR-book's. And, maybe, if I understand correctly, you are asking about whether we are able to use BVH algorithms implemented by others or load precomputed BVH into this renderer. The answer is yes but it comes at a cost: we need to implement the correct interface, which converts the BVH outputs from whatever code it is, to Taichi lang However, note that this BVH implementation is suboptimal. Here is the situation: Taichi lang has limited ability to dynamically allocate memory inside of its kernel function, but BVH tree traversal (the optimal one) requires building a stack (otherwise, use recursive calls). I didn't find a easy way to build a stack in the kernel function (actually, |
Beta Was this translation helpful? Give feedback.
BVH implementation can be found here: https://github.com/Enigmatisms/AdaPT/tree/master/tracer/bvh. This is implemented in C++ and I use pybind11 to export an interface for python.
I picked a top-down approach with SAH function, which should be the one introduced in PBR book 4.3.2