Skip to main content
GameDev.net gamedev.net
🔒 Locked

I need Intersection Point of ray-triangle intersection

Started by littlejedi Apr 7, 2005 at 7:59 AM 1 replies 950+ views
Original Post
littlejedi
littlejedi
Please tell me that... I found something on the Internet u,t,v intersectionpoint.x=line.origin.x + t * line.direction.x line.direction.x = line.end.x - line.origin.x y,z is the same. Is that corret? Or I need to modify it?
KronosGL
KronosGL
hitPoint = (1.0f-u-v)*vert0 + u*vert1 + v*vert2;

With vert[0,1,2] being the vertices of the triangle
oliii
oliii
that's correct. x and z use the same equation. I would assume also that the algorithm requires the line direction to be normalised for the intersection test.

Kronos is correct too, but I'd use the 't' parameter as you are doing to find the point of collision.

u, v are useful to find the point on the texture that's getting hit. Useful for ray-tracing, or if you want to do accurate per-pixel collisions (for example, where bullets would pass through holes in the texture only).

then Kronos's equation can be used on texel coordinates on the vertrices of the triangle.
Everything is better with Metal.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.