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

## 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 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 on other sites
OpenGL solution. Direct3D solution follows similarly.

##### Share on other sites
There *is* a fix for this. I saw a paper on it once, which I can't seem to find right now. It involved always using the W coordinate so that a texture coordinate divide was happening per pixel instead of being baked into the UVs of each vertex.

##### Share on other sites
Mastaba rocks. That's what I was talking about.

1. 1
2. 2
3. 3
Rutin
18
4. 4
5. 5

• 13
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632926
• Total Posts
3009239
• ### Who's Online (See full list)

There are no registered users currently online

×