Jump to content
  • Advertisement
Sign in to follow this  
jhoward

Raytracing and texture mapping triangles

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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) :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!