Jump to content
  • Advertisement
Sign in to follow this  

How can I Zoom without scaling texture?

This topic is 4875 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 region that is texture mapped, and when I zoom in, I want the texture to remain fixed, as if the region is a window onto the texture, while zooming in/out is simply making the region bigger or smaller, respsectively. I thought this was as easy as scaling the U,Vs as a function of the camera height (I'm using shader language). This keeps the texture a constant size, but it scrolls as I zoom. By default, when you increase the U,V factor (say from 1.0,1.0 toward 0.0,0.0), the texture zooms toward the point 0,0 (the upper left corner). This has a scrolling effect. The texture stays the same size, but it slides diagononally as I zoom. I can zoom to any point on the main diagonal using the equation: y=-.5x+1.5 where x is the U,V scale factor and y is the new U and V. I can zoom to any point on the main diagonal if I substitute the .5 and 1.5 with say, .2 and 1.2 (to zoom to .2,.2). That is, U,V=fx*x+(1.0+fy) where fx,fy = the point you want to zoom to. However I'm trying to zoom to any point on the texture, and when I try say,( .25,.75) the texture starts out off center. Thanks in advance for any ideas, Neil

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!