Intel® Embree Ray Tracing Kernels
Discussion forum on the open source ray tracing kernels for fast photo-realistic rendering on Intel® CPU(s)

2D Raycasting with Embree

AUREL__PURCAREA
Beginner
768 Views

I need fast 2D raycasting and I am not sure if I could or should use embree for this.

In my project, I already use embree for full 3D raycasting with a mesh. However, I also create slices, polylines in 2D of that mesh where I want to raycast in the plane. As far as I know, embree has no 2D kernels, BVHs etc. and it won't be straight forward to integrate such? In theory, I could create a 3D mesh from the polyline and use 3D rays and for the resulting intersections, ust truncate the z-component. Note that I can't raycast with the original 3D mesh, since the polylines will be processed further before used for raycasting in the 2D plane.

I wonder if this is a good idea at all, or if I should consider other libraries? Keeping dependecy count low is a plus. WIll the performance overhead for using 3D instead of 2D be huge? CGAL's AABB trees for instance are very, very slow compared to embree, but there I can use 2D kenels and true 2D intersection testing. I wouldn't be surprised tho, if embree would still be faster in the end. Any thoughts on this?

Aurel

0 Kudos
2 Replies
SvenW_Intel
Moderator
768 Views

Never tried CGAL's AABB trees, but if you say it is very very slow, than I believe using Embree for 2D will still be significantly faster. If you want to trace inside the plane some care has to be taken. Embree does not trace rays that are perfectly axis aligned, but misaligns them slightly to avoid division by zero issues. This means that you have to thinken the geometry perpendicular to the plane. Best way is likely to use quads to represent your lines, such that the quad normal is lying inside the plane.

0 Kudos
BenthinC_Intel
Employee
768 Views

Another option might be to use Embree's external BVH builder to build a 3D BVH over your 2D data set and then use your own 2D traversal algorithm to traverse a ray through the BVH (while ignored one dimension).

0 Kudos
Reply