[resolved] Iterative Optix Prime Intersections

I am currently using Optix prime to iteratively trace rays through a structure. For example, I execute a closest hit query on a buffer of rays then take each hit in the buffer of hits and calculate the Cartesian coordinates from from the barycentric coordinates for the intersection point. I then launch a new batch of rays from those intersection points with the corresponding reflection directions. I run into a problem where some of the rays in the new batch of rays get “stuck” hitting the same triangle over and over. I believe this is a precision error with the conversion to the Cartesian coordinate system that I calculate and the ray ends up being slightly on the opposite side of the triangle face. I can remedy this by shifting the ray along the normal of the face so that the ray has no change of being on the wrong side.

I was wondering if there was an easier way to ignore the closest triangles so that the rays move through the triangles that are very close.

Thanks for you help!

Blake

Which value for “tmin” do you use when creating a ray?
For example in the “primeSimplePP” sample there a 0.0 is used for “tmin”. (see line 81 in primeKernels.cu).
Instead of 0.0 you could try to use a “scene_epsilon” (as used in the OptiX API samples; see"optixPathTracer").
As epsilon you can try 0.0001 or 0.001 or lower/higher values (dependent on your results).
Then any hits below that tmin value should be ignored.

Hi Blake,

When you construct your secondary rays, what epsilon value are you using? You may be able to fix your problem by providing a larger epsilon, without adjusting the initial hit positions.

This thread seems related and might have some additional hints. Let us know if your problem is different and/or unresolved by using a larger epsilon.

https://devtalk.nvidia.com/default/topic/1046617/optix/optix-prime-inconsistencies-on-ray-intersection-computation-with-secondary-rays-/post/5311223/#5311223


David.

Thank you, everyone, for the replies. I thought I had adjusted the tmin/epsilon values but that was not the case. I got it all figured out now.