Hey guys,

I am working with OptiX 6.5.

The issue I am see is that t-values computed via length( hit-ray.origin ) are incorrect when there is a transformation applied.

Here I have isolated the relevant portion of code:

```
RT_PROGRAM void mesh_intersect( int triIdx )
{
if ( intersect_triangle( v0, v1, v2, n, t, beta, gamma ) ) {
hit = ray.origin + t * ray.direction; // Line 0. initial hit
// .... {more user code to modify hit} .... currently disabled
t = length ( hit - ray.origin ); // Line 1. get t from modified 3D hit
hit = ray.origin + t * ray.direction; // Line 2. recompute hit from t
bc = getBarycentricInTriangle ( hit, v0, v1, v2 ); // Line 3. Get BCs
uv = vuv0 * bc.x + vuv1 * bc.y + vuv2 * bc.z; // Line 4. Get UVs
// ... {potentialIntersect, modify attribs, reportIntersect}...
}
```

The problem occurs with Line 1.

When that line is commented out, then Line 2 is equivalent to the initial hit result, and looks correct.

However, when I uncomment Line 1, which is necessary when the user-code modifies the initial hit position, then the t value is incorrect.

I understand that Intersection programs are in OBJECT space, but shouldn’t the the ‘hit’ and ‘ray.origin’ which are used to get t in Line 1 already be in object space?