Ray Mesh Intersections

Previous forum discussions about getting all hits along a ray listed below. Even if some talk about the older OptiX API before OptiX 7, the main algorithms are the same.

Note that if your models contain coplanar faces from different meshes, some additional care would need to be taken to not miss either of the coplanar faces with the iterative approach using closest hit programs, because the fast way of changing the ray offset after a surface hit to avoid self-intersection wouldn’t work for coplanar faces. You would miss one then.
The more robust but slower approach would be to use some per mesh ID like the user defined instanceId field to ignore identical hits then, but that would require an anyhit program again which makes things slower overall.

To put that into perspective, we’re talking about >10 GRays/sec on current RTX boards when only doing closest hit interactions on opaque materials. You need a lot of rays running in parallel to reach that.

https://forums.developer.nvidia.com/t/radiation-physics-problems/42281
https://forums.developer.nvidia.com/t/processing-intersections-in-order/74859
https://forums.developer.nvidia.com/t/distinguish-objects-when-closest-hit-program-occured/73988/5