warp
warp copied to clipboard
[REQ] More flexible BVH interfaces
Description
- Could
Bvhclass provides arebuild()method? - Could
wp.bvh_query_ray()accept arayTimeparameter?
Context
- In scenes with dynamic objects, the BVH often needs to be rebuilt frequently. Currently, rebuilding requires creating a new
Bvhobject, which results in a newbvh.id. This behavior is not friendly towp.ScopeCapture(), as it requires re-capturing the BVH traversal each time it is rebuilt—introducing additional overhead. Having arebuild()method would allow in-place updates and improve performance for dynamic scenes. - As for rayTime, from the current implementation of
wp.bvh_query_ray(), adding this parameter would require only a small modification (e.g., changing the conditiont > 0to0 < t < rayTime). This would make it possible to support efficient line-AABB intersection tests directly within the BVH traversal. Without it, users must perform additional hit-time checks manually inwp.kernel, including reloading leaf AABBs, which incurs extra cost. Adding rayTime would streamline this use case with minimal change to the core logic.
@AnkaChan added a rebuild() method as requested. See 3ece71f796f5ab72c4c8b4c6d40fc17b5b5b0c9c. It will be in Warp v1.10 (scheduled for beginning of November) but you can start using it sooner by building Warp from main or using a nightly build starting with the next set.
The rayTime request is not addressed by 3ece71f796f5ab72c4c8b4c6d40fc17b5b5b0c9c. Feel free to open a pull request if you need it sooner.
@WenchaoHuang: @StafaH's recent commit 0e08171333f80307c4ed1d2384a8b09c3d54dc42 adds a feature that should address your rayTime request.