Jump to content
  • Advertisement
Sign in to follow this  
fis

Texturing non rectangular Quad

This topic is 4078 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

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!