I'm starting to develop a ray tracing application using Embree.
What I managed to do :
- Create an accelerator structure.
- Create an intersector from this structure.
- Intersect some rays with triangles.
My problem is that no matter what direction of propagation the ray has, I always get the same id0 and id1 parameters (0 and 0) in the generated Hit object. I guess this is because all the triangles are considered to be in the same primitive.
However, I need to be able to identify which triangle my ray did intersect. So my question is : is there a way in Embree to identify it or should I do it by myself ?
Problem solved : I hadn't understood the meaning of id0 and id1.
One should actually set their value to what needed (an index corresponding to the triangle ID, for example) while building the BuildTriangle * object and this value would be available in the Hit object generated.