Showing results for 
Search instead for 
Did you mean: 

2D Intersections Using Embree

I have used Embree for 3D intersections with great results and now I'm trying to use it for UV intersections/overlaps in 2D. I have been trying different methods but I am not getting much of a speed improvement as I did with the 3D intersections so I was wondering if you have any recommendations on what method might be best to use.

To check for intersections I am using the edges of the UV as the "rays" to use in rtcIntersect1

The approaches I have thought of so far:

  • Create the scene using a triangle for each edge of the UV that goes perpendicular to the 2D plane, so that if the ray intersects with it,  it's intersecting with the edge within the triangle.
  • Create the scene with the UV edges as user geometry so I can specify the bounding box in 3D and then check for ray-edge intersection.
  • Maybe rtcCollide could also be used with the UV faces as user geometry so I can specify the bounding box in 3D and check for collisions.

The slow down comes also from having to do some additional post-processing with these methods to avoid intersections of adjacent faces and make sure face that are overlapping right on top of each other are accounted for. In addition, there are more edges than faces, so checking for intersection per edge is slower than checking for intersection per triangle.

Any thoughts on which of these methods might be more efficient? Any other approaches to this problem that could help speed it up?

0 Kudos
1 Reply

I think it would make sense to use Embree's external BVH builder interface to build your own 2D BVH over the UV domain and implement custom traversal with 2D overlap detection. That's likely the path which gets you the highest performance.

0 Kudos