Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Measuring BVH Quality #2

Closed
ghost opened this issue Apr 10, 2020 · 4 comments
Closed

Measuring BVH Quality #2

ghost opened this issue Apr 10, 2020 · 4 comments
Labels
question Further information is requested

Comments

@ghost
Copy link

ghost commented Apr 10, 2020

Just out of curiosity, is there any metrics that this library can calculate that indicate the quality of the generated BVHs aside from the traversal performance? Perhaps like the accumulative amount of empty space between parent and sub nodes? I don't think I've seen this measured before in other projects, but it seems like it would be a useful metric for comparisons between algorithms.

@madmann91
Copy link
Owner

madmann91 commented Apr 10, 2020

There's the SAH, of course. Computing it is relatively easy (see https://github.com/madmann91/bvh/blob/master/include/bvh/parallel_reinsertion_optimization.hpp#L34). That's what the 'ParallelReinsertionOptimization' class is using to optimize the tree. Keep in mind that even though that's the 'best' measure that can be used during construction, and even though it correlates really well to performance, it's not an absolute measure of quality. There are trees with lower SAH than others that will perfom better in practice. There's this very informative paper if you are interested in quality metrics: https://research.nvidia.com/publication/quality-metrics-bounding-volume-hierarchies.
If you really need that, I can add a class that computes the SAH.

@ghost
Copy link
Author

ghost commented Apr 10, 2020

I'll have to give that article a read then. I don't really know what the effort is required to do this, so if it's a bit too much than I'd rather just stick with traversal time as the best metric.

@ghost ghost changed the title Measuing BVH Quality Measuring BVH Quality Apr 10, 2020
@madmann91 madmann91 added the question Further information is requested label Apr 10, 2020
@madmann91
Copy link
Owner

I have added a SahBasedAlgorithm class that allows computing the SAH of a given BVH. To use it, you first have to derive from it, and set the traversal_cost variable to the ratio Ct/Ci, where Ct is the cost of traversing a node (performing a ray-node intersection), and Ci is the cost of intersecting a primitive. I took the liberty to close this issue, but please re-open it if that does not satisfy your needs.

@ghost
Copy link
Author

ghost commented Apr 12, 2020

That definitely does! Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant