Recommended Posts

Hi,
I'm implementing a triangle-based raytracer using the intersection code by Moeller and Trumbore from the paper "Fast Minimal Storage Ray/Triangle intersection. One thing I am not quite sure about is how to compute the actual intersection point from the returned values u,v,t. As t is the distance to the plane the triangle lies in, I can't just say
intersect = origin + t * direction
as t will only give me the distance to the point on the plane closest to my camera. Does anybody know how to compute the exact intersection point in 3D?
Thanks,
Icebraker

0

Share this post

Link to post

Share on other sites

How does it only give distance? origin is a point, direction is a vector, t is the distance from the ray.origin along ray.direction to intersection point on triangle.u and v help determine if there was an intersection on the triangle, t is a valid distance if there is an intersection. so if u and v say there was an intersection, the point is ray.origin + (ray.dir * t).Origin doesnt have to have anything to do with the camera, its the ray origin, it can be a point in space anywhere.

[Edited by - NumberXaero on July 25, 2008 7:17:25 PM]

0

Share this post

Link to post

Share on other sites

Well, he paper says that t is the distance to the closest point on the plane in which the triangle lies. This distance is (I think) not the distance the ray travels till it reaches the triangle. So if I take that formula, I will end up somewhere in front of the triangle...

0

Share this post

Link to post

Share on other sites

No, NumberXaero is right: if you reach the end of the function, this means that the intersection point is isnside the triangle, and t is actually the distance from the ray origin.origin + t * direction actually returns the world-space intersection point...

0

Share this post

Link to post

Share on other sites

Ok, I have computed the point of intersection as eye+t*rayDir, and then I'm clling this method which gets recursively called if the surface is reflective until maxNumRaflects has been reached, then it goes in the else-part and performs a simple phong illumination which works fine.. Does anybody spot a mistake?