How can I Zoom without scaling texture?
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement