Texturing non rectangular Quad

Started by
3 comments, last by fis 16 years, 9 months ago
Hello, is there any way how to render textured non-rectangular transformed and lit quad under Direct3D? Texture mapping to quad composed from two triangles is correct only in case, when quad is rectangular. I hope that you are understand what i meant. Excuse my english please. Thank you very much.
Advertisement
Not sure I follow what you want - you can map an arbitrary piece of a texture to an arbitrary shaped piece of geometry. One of the huge advantages over DirectDraw ("old school 2D") and 2D-in-3D via Direct3D is that you're no longer constrained to linear/square/rectangular regions...

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

i need this:

from original rectangle texture-------|\    || \   ||  \  ||   \ ||    \|-------not-rectangular mapped texture----------|\        || \       ||  \      ||   \     ||    \    ||-    \   |  --   \  |    --  \ |      -- \|        --|where U and V coordinates should be same for first and second case (0,0; 1,0; 1,1; 0,1).


Texture must be stretched through whoole quad. It does mean that fourth vertex which is not in triangle must be taken into account when mapping texture to triangle, but i dont know, how to do it.

[Edited by - fis on July 26, 2007 2:18:42 PM]
Quote:Original post by fis
i need this:

*** Source Snippet Removed ***

To me it just looks like you need to adjust your 3rd vertex's position, and that's it! Why not just move that point down a little bit? D3D will distort the texture as needed based on your texture coordinates...

Not 3rd vertex but whatever vertex in Quad should be moveable, while texture distortion must be same in all triangles - not same, but correct better said.

When i move with top right vertex in X or Y axis, distortion will be visible only in top triangle. Bottom triangle will not be affected. The same situation will occur when i move with bottom left vertex in X or Y axis. And when i move with vertices common to both triangles, distortion of texture is not correct.

This topic is closed to new replies.

Advertisement