|
![](/i/fill.gif) |
Warp wrote:
>
> Jim Kress <nos### [at] kressworks com> wrote:
> > Got any suggestions how I would do this? I've looked through the Internet
> > and have not been able to find an algorithum (or code) that would show me
> > how this is done.
>
> I have never read or thought about the details of raytracing a triangle,
> but the basic algorithm is:
> 1. Calculate the intersection point of the ray and the plane (eg. the
> value t for P*t+D, where P is the starting point of the ray and D is
> the direction of the ray).
I suppose you meant P + t*D ?
> 2. See if the intersection point is inside the boundaries defined by the
> triangle (the first fast test is if t<0, then the ray did not hit the
> triangle).
There are some discussions about this topic in this thread:
http://groups.google.com/groups?th=53321682e5f42db6
This search may also be useful:
http://www.google.com/search?q=ray+triangle+intersection
> 3. You'll have to perform the test with *each* triangle in the mesh
> (except the current one), unless you implement some space subdivision
> algorithm, eg. an octree (but that would make the algorithm a lot more
> complicated, though faster).
>
> I can't say right now how step 2 is implemented.
>...
Tor Olav
Post a reply to this message
|
![](/i/fill.gif) |