Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

3DXD

Texture Manipulation Question(trying to avoid stretching)

This topic is 5280 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, I have a 512 by 512 wall texture image. When viewing it in paint etc the bricks are (lets pretend) 1 foot wide by 2inches tall When I apply this texture to a quad(its a square) the bricks look more like 2 foot wide and (close) to 2inchs tall. In truth I am sure its just my understanding(or mis) of how the pipeline translates everything, but I was wondering, is there a way or an option to get around this? I tried setting my Texture coordinates so that the image would be displayed N times based on my Max U/V. So if I put in 2, I can tell that the image "bricks" are less wide but also they are less tall, plus I really didn''t want to have to duplicate the image a bunch of times. I was just curious if its possible to "figure out" what the ration of an image needs to be for a quad so that it looks like the original image instead of a "stretched" version. I hope that explanation makes sense. Thanks!

Share this post


Link to post
Share on other sites
Advertisement
If I understood your problem correctly, just calculate the distance between the edges (or the two bottom vertices perhaps). If you want the texture to cover a 1.0 unit long quad, and the quad is 2.0 units long, just set the texture coord to 2.0.
Did that make any sense?

Hellsp4wn
-----------

I''m having deja-vu and amnesia at the same time. It''s like I think I''ve forgotten this before.

Share this post


Link to post
Share on other sites
and now I just read the "(it''s a square)" part of your post, and realized that I don''t understand your problem at all ^^

Hellsp4wn
-----------

I''m having deja-vu and amnesia at the same time. It''s like I think I''ve forgotten this before.

Share this post


Link to post
Share on other sites
Thanks HellSp4wn,

Lets say my quad verts are
(using a trianglestrip)
Bottom left = 0.0,0.0,0.0 - u = 0.0, v = 1.0
Top Left = 0.0,2.0,0.0 - u = 0.0, v = 0.0
Bottom Right = 2.0,0.0,0.0 - u = 1.0, v = 1.0
Top Right = 2.0,2.0,0.0 - u = 1.0, v = 1.0

With this I "expected" that my quad is actually smaller then say 512 by 512, so i figured that my image would map directly on it(its a factor of 2 square texture being mapped on a square quad).

But instead of it looking like my image, the "bricks" that make up the picture are elongated and stretched.

so instead of the 512 by 512 which looks like this(kinda lol)

Brick =
__________
| |
|__________|

What I get is =
______________________
|____________________|


I want my "bricks" that make up the picture to retain their proportionality when applied tot he quad and so far I can't see to totally get it right and was hoping there was a mathemetically or "way" of figuring it out.

Thanks!


[edited by - 3dxd on June 3, 2004 3:16:51 PM]

[edited by - 3dxd on June 3, 2004 3:17:22 PM]

Share this post


Link to post
Share on other sites

  • 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!