# Raytracing and texture mapping triangles

This topic is 3694 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've got a triangle defined by points p1, p2 and p3 and from a traced ray I've found an intersection point pI. I know that the point pI lies on the triangle. Each point has a given texture coordinate [u1, v1], [u2, v2], [u3, v3] How can I calculate the texture coordinate at the intersection point pI? James

##### Share on other sites
I personally use the Möller/Trumbor-Intersector, which gives you the U/V-Coordinates by nature ("Barycentric Coordinates"). Then it's easy to interpolate between your vertices:

R = A + (B-A)*u + (C-A)*v

edit: btw, have a look at ompf, a forum dedicated to ray tracing of all flavors: http://ompf.org/forum/

edit2: just for kicks, you could of course solve "R = A + (B-A)*u + (C-A)*v" for a given R, looking for u,v (I did this once with inverse matrices and determinants, but it was slow) :)

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633744
• Total Posts
3013652
×