Jump to content
  • Advertisement
Sign in to follow this  
Endurion

3D, Projecting quad onto triangles or vice versa

This topic is 4451 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

Hi, It's me and my clumsy attempts on a modeller. Last time i got awesome help on cylindrical texture mapping, now i'm in need for simple quad mapping. Basically, i define a texture section (texture and texture coordinates of the subsection) and want to uv map the selected faces to that quad. The quad is freely defined by its four corner points (clumsy, yes). I create a plane from three of the points assuming the quad is completely planar. A) For every vertex i calculate the intersection of the line from the vertex (P1) and vertex plus plane normal (P2) with the plane. This gets me the projected point on the plane. This seems to work fine so far. Now i'm having trouble to transform the intersection point onto the quad (i'd simply need the x and y value to calculate TU and TV). B) I tried an inverse LookAt matrix which was created by the top left corner point and two edges of the quad. C) In the end i should get a point from which i can directly use X and Y (discarding Z) to calculate the position factor from 0 to 1 (or outside) regarding the original quad. It's either B or C where i'm going wrong. The code works if the quad lies on the X-Z plane, but not if the quad is perpendicular to that plane. Could someone give me a hint into the right direction? Please go easy on the maths, i'm not too fluent with vector and matrix math. I'd also be interested in a more elegant method since i probably used a pretty naive approach. Many thanks in advance!

Share this post


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