PDA

View Full Version : Texture Mapping from a skewed quadrilateral to a Rectangle



atg2012
09-14-2012, 09:04 AM
I have a rotated polygon (skewed quadrilateral) as my texture image. I am given the corresponding 3D vertices for this polygon in the World Coordinates. Now, I need to place the camera such that my camera is pointing along the normal of the polygon so that the polygon face is orthogonal to the viewing vector and looks like a perfect rectangle. Then I need to map the texture from the above skewed polygon on to this perfect rectangle.
But when I do that, there is some kind of folding effect along the diagonal line running from bottom left corner to the top right corner of this quadrilateral.
To map the texture, I am providing 3D world coordinates for the vertices of the rectangle and the 2D texture co-ordinates. What do I need to do to make the mapped texture look correct. Am I missing some step here.
Any advice is appreciated.

Thanks,