Sign in to follow this  
UltimateWalrus

Quad texture distortion?

Recommended Posts

I'm drawing polygons in an orthogonal projection, but I'm experiencing some texture distortion when I try to draw a quadrilateral that isn't a parallelogram. For example: here's my test texture: Now here's what happens when I try to draw this texture as a trapezoid, using two triangles: I can see what's happening. When the first primitive is drawn, it doesn't know about the other one; so it just assumes that it's part of a parallelogram, and stretches the texture accordingly. I'm drawing the quad as a triangle strip, but it still distorts. My vector format is D3DFVF_XYZ | D3DFVF_TEX1. There must be some way of making the texture stretch according to each vertex of the quad. Do I need to add anything to my vertex format? Or is there some other special way of rendering the quad? Thanks!

Share this post


Link to post
Share on other sites
You need to use perspective correct texture mapping to solve this problem, which basically means setting the correct Z value for each vertex. Other than that, there is not much you can do, although you can try subdividing your quadrilateral: for instance, take the middle point and render the quadrilateral as four triangles instead of two, or divide each edge by two to get six triangles.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this