Hi, I’m trying to launch a ray whose origin is contained inside multiple triangles and get the primitive IDs of all the triangles within which it is contained. My scene only contains triangles. Since the ray origin is inside the triangles, I get tmax= 0 on ray-triangle intersection and I can’t just generate another ray with new origin as the hit point(hit_t = origin + tmax * direction) of the previous intersection as suggested by some other posts on this forum.

This is an example of my scene:

Triangle-1: (-1,2,0) (1,-2,0) (2,0,0)

Triangle-2: (-0.5,2,0) (0.5,-2,0) (2.5,0,0)

Ray Origin: (0,0,0)

Ray Direction: arbitrary

I am new to Optix and from what I’ve read so far, it seems like the any_hit program might be useful for this but result in slowdowns. Is there a way in which I can launch a single ray, with its origin inside multiple triangle primitives and arbitrary direction, and get back the ID of all such triangles? Thanks!