brandonpelfrey/Fast-BVH

PR Roadmap

Closed this issue · 1 comments

Here's a roadmap of the PRs I plan on making for this project. I'm laying them out here in case you have any concerns that need to be addressed ahead of time. The end goal, from my perspective, is to have a BVH for Sponza built within 15-20 ms. This would leave 13-18 ms available for ray tracing a frame in a 30 fps application, which is plenty enough time IMO.

  • Loose coupling of BVH and BVH build strategy. A class is made for constructing BVHs that represents the algorithm used to construct the BVH. Some BVH builders are better for realtime ray tracing, while others are very good for static scenes. This PR would allow the project to have multiple BVH builders for the right application. There would also be a "fake" build strategy which places all primitives in the root node. This would be useful to calculate the effectiveness of the BVH build strategies using a relative comparison to the "fake" build strategy. Additional notes below.
  • Automated performance comparisons between build strategies. When this PR gets made, there will still be only one build strategy (other than the fake build strategy.) This is on purpose, since it will help determine whether or not a newly implemented build strategy will be worth adding to the project. This PR may also remove the performance measurements from the examples, since the examples should primarily be for helping users learn how to use the library.
  • Transition to SoA data format. This may or may not get added, depending on whether or not it actually improves the performance. I think it will, but I could be wrong. If it doesn't improve performance, then I won't make this PR. I'll add more notes on what this will look like below. Cancelled (see notes.)
  • New BVH construction strategy using parallel local density clustering, as described here. This is a relatively new approach and will be added as a PR if it proves to be as effective as the article states. The algorithm is extremely well documented and will hopefully be relatively easy to implement.
  • Packet traversal class. This would be similar to the iterative BVH traversal class that's currently in the project, except made to trace large packets of rays at a time. At every BVH node, the packet is sorted based on which rays intersect with the AABB (also called ray sorting) in order to improve ray coherency. I've implemented this already in another project, so it will just be a matter of moving it to this project. This is not to be confused with SIMD packet traversal, which is very difficult to sort.

Once these are done, I won't plan on making any other PRs to this project other than bug fixes.

Notes on SoA PR

Thinking about this a bit more, I've realized that SoA probably wont help in this case. The issue is that only one box is tested at a time (at most two.) before branching occurs. Therefore, there's likely no chance it would ever get vectorized to testing 4 or 8 boxes at a time.

Since I decided to put this code into a separate repo, this is kind of an obsolete issue. If I make any more PRs here, I'll try to keep them short and sweet so that they don't over complicate things. Thanks for you time!