You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Physically Based Rendering had this great suggestion for improving raycasting performance. Ordinarily, if you want to find only the closest intersection for your ray, you need to test your ray against both bounding volumes at each level of the tree hierarchy, and take whichever has the intersection with the closest distance, because it could intersect both. But if you use an SAH strategy and you remember at each node which axis was used for splitting, you can look at where the ray is coming from with respect to the split plane and you know right away which child bounding volume must have the closest intersection, if it intersects that bounding volume at all. You may not have to even look at the other one.
Of course this will cost a little memory but it sounds like it might improve raycasting firstHitOnly performance very substantially.
The text was updated successfully, but these errors were encountered:
It's not exactly the same approach but I believe it has the same effect and doesn't take any extra memory. Basically we check which node is closest to the ray and traverse that first. If no triangle is hit then we check the other node.
We don't do this in the regular raycast function, though -- I don't think there's a reason to?
Good point, I can't see why that approach would be any less effective at determining which to examine. The axis-remembering one seems more efficient per raycast (you will just have to check a single coordinate of the ray instead of doing the bit of vector math we do there) but I don't know if the gain would be worth the cost of storing the extra field.
Physically Based Rendering had this great suggestion for improving raycasting performance. Ordinarily, if you want to find only the closest intersection for your ray, you need to test your ray against both bounding volumes at each level of the tree hierarchy, and take whichever has the intersection with the closest distance, because it could intersect both. But if you use an SAH strategy and you remember at each node which axis was used for splitting, you can look at where the ray is coming from with respect to the split plane and you know right away which child bounding volume must have the closest intersection, if it intersects that bounding volume at all. You may not have to even look at the other one.
Of course this will cost a little memory but it sounds like it might improve raycasting
firstHitOnly
performance very substantially.The text was updated successfully, but these errors were encountered: