This article explores advanced techniques for Bounding Volume Hierarchy (BVH) construction to optimize ray tracing performance in games. It re-evaluates methods such as full-sweep SAH, binned construction, H-PLOC, spatial splits, and reinsertion-based BVH optimization. Key findings demonstrate that spatial splits significantly improve BVH quality for typical game scenes. Crucially, the optimal bin count used during BVH construction varies by scene and profoundly impacts performance, often challenging the assumption that more bins are always better or that full-sweep yields the highest quality. The study introduces and validates a Representative Ray Set (RRS) as a superior metric for assessing and optimizing BVHs, particularly for GPU ray tracing, where it correlates more closely with actual performance than the traditional Surface Area Heuristic (SAH). The research concludes that a strategic combination of these techniques can achieve substantial performance gains, suggesting a re-evaluation of offline BVH construction for static game geometry.
BVH Quality: Beyond SBVH - Key Takeaways
BVH Fundamentals and SAH: The article introduces Bounding Volume Hierarchies (BVHs) as a core data structure for efficient ray-primitive intersection and the Surface Area Heuristic (SAH) for selecting optimal split planes to minimize intersection cost during construction.
Efficient BVH Construction: Methods like binned building (evaluating SAH at discrete intervals, e.g., 8 or 16 bins) and linear-time full-sweep are discussed as more efficient alternatives to naive O(N^2) SAH evaluation.
Challenging Common Assumptions: The research disputes several conventional beliefs, such as full-sweep SAH always being superior to binned builds, that more bins universally yield better BVHs, or that lower SAH cost automatically translates to higher frames per second (FPS).
The Power of Spatial Splits (SBVH): Spatial splits are highlighted as a crucial technique for improving BVH quality, especially in scenes with high bounding box overlap or a mix of large and small triangles, often reducing overall SAH cost by 25% or more.
BVH Optimization by Reinsertion: The article examines post-process BVH optimization where subtrees are removed and reinserted to reduce SAH cost. While effective for low-quality BVHs (e.g., LBVH), its impact on already high-quality SBVHs can be counter-intuitive regarding actual ray tracing performance.
Introducing Representative Ray Set (RRS): To address SAH's limitations in assessing overall tree quality, the study proposes using a Representative Ray Set (RRS). This metric measures average traversal and triangle intersection counts from diverse ray types, providing a more accurate estimate of real-world ray tracing cost.
Optimal Bin Count is Scene-Dependent: Experiments across six varied scenes (Sponza Atrium, Lumberyard Bistro, Conference Room, Lego Car, Stanford Dragon, San Miguel) demonstrate that the optimal bin count for SBVH construction is scene-dependent and profoundly impacts BVH quality, leading to substantial performance improvements (e.g., up to 9.63% for Conference Room) when chosen optimally.
RRS-Steered Optimization for Superior BVHs: A procedure for further optimizing high-quality SBVHs using the RRS metric to guide reinsertion is presented. For scenes like Sponza Atrium, this method can lead to an estimated 63.82% performance improvement over a baseline full-sweep BVH.
SAH vs. RRS in Performance Prediction: Actual CPU and GPU ray tracing performance measurements show that SAH is a better predictor for CPU performance, while RRS more accurately correlates with GPU performance, even if RRS sometimes overestimates the absolute magnitude of improvement.
Concluding Recommendations for the "Ultimate BVH":
Combining spatial splits with a carefully selected, scene-dependent optimal bin count is crucial.
The Representative Ray Set (RRS) provides a more accurate quality metric, particularly for GPU-based ray tracing, than SAH.
Strategic application of these techniques can significantly improve ray tracing performance (doubling performance for some scenes compared to H-PLOC or full-sweep SAH).
The benefits suggest that offline BVH construction for static geometry in games should be reconsidered as a viable and highly effective option.