For our purposes of using Embree as a ray-tracer in our geometry-accelerated Monte Carlo code, it is sometimes necessary to find the closest intersection to a given location. Would you have a recommendation on how best to do this using Embree?
Thank you for your time.
Embree does not include a kernel that could directly find the closest geometry location to a given point. You could approximate this by sampling some directions using ray tracing, but this would be slow and might be not accurate enough.
The best would probably be that you implement this procedure yourself. You could re-use the Embree hierarchies (see bvh_access tutorial in devel branch) or build a new hierarchy using the Embree builders (see bvh_build tutorial).
Reviving this rather old thread...I'm afraid I don't see a clean way to access Embree's BVH the same way that the tutorial does. It seems to access a lot of headers in the Embree source directly. Are there guidelines on how to follow the same build process in an external application?
No there is no other way and we also recommend best not to access the internal BVH. It is by definition an opaque data structure for the application. If you need a BVH for your app, best use the BVH build API of Embree to build a BVH in some application defined layout.