for our physics-based simulation engine I am trying to find the best possible way to process intersections with non-opaque geometries.
So far I tried to work mainly with the CH routine as for the opaque geometries, though like this we have to deal with the same challenges.
We are trying to follow a ray from the inside of a (closed) geometry and we are using opaque materials to collect information on the ray’s path. Once the ray hits a solid material it gets reflected.
To prevent a large amount of self-intersections and misses from happening, I implemented the adaptive offset routine from the ray tracing gems collection, which reduced the amount significantly. Introducing non-opaque geometries, giving an offset to deal with self-intersection results in more misses (rays get translated out of the closed geometry at triangle connection points). Removing the offset after a non-opaque hit and only offsetting if a self-intersection is registered afterwards reduced the amount of misses, but it’s still somewhat larger than without non-opaque parts (1e-5 opposed to 1e-7).
The idea would be, to use the same ray with an AH routine, this way we could theoretically take note of opaque and non-opaque hits, which are too close together.
If I understand the AH routine correctly though, we could save transparent hits occuring for a specific t_max in an extra buffer (not PRD, as this is too small) and use optixIgnoreIntersection() to move on. Once we register a hit with an opaque geomtry, we would have to call optixTerminateRay() or do nothing. The first would not guarantee, that all non-opaque geometries upto the opaque hit point get evaluated. Doing nothing for an opaque geometry would mean that we have to memorise the potential closest intersection for ourselves (at least the t_max) to properly decide for the final CH call, which non-opaque facets are actually inbetween and which are not.
I have not yet measured the performance decline, that is correlated with enabling and using the AH routine. So I first want to make sure, that the proposed solution makes somewhat sense and whether there are other solutions, which I should consider first or not.