Advertisement Jump to content
Sign in to follow this  

3D, Projecting quad onto triangles or vice versa

This topic is 4548 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
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!