Hello, can I ask you a simple question?

Is there any function in OPTIX 7.2 that returns the ray distance btw. the origin of the ray and the ray-triangle intersection point in closest-hit program?

I checked OPTIX 7.2 programming guide, but I could not find a function like that.

The reason why I am finding this function is that I have to calculate the world space ray-triangle intersection point.

If the function that returns ray-distance does not exist, the intersection point might have to be computed using the three triangle vertices coordinates and the two triangle barycentrics coordinates computed by optixGetTriangleBarycentrics() function. And this procedure can be represented as an equation below:

**P(v, w) = (1-v-w) * V0 + v * V1 + w * V2**,

(where P(v,w): ray-triangle intersection point, v&w: triangle barycentrics, V0&V1&V2: triangle vertices)

However, if the ray-distance can be used, the ray-triangle intersection point can be computed more easily and fastly using the equation below:

**P(O, t, D) = O + t * D**,

(where P(O, t, D): ray-triangle intersection point, O: origin of ray, t: distance btw. origin of ray & ray-triangle intersection point, D: direction of ray)

I think the function returning ray-distance **t** may exist because it might be calculated in optixTrace() function.

Please tell me if the function returning ray-distance exists, and if so, please tell me the name of the function.

Thank you.

Yongwan