Jump to content
  • Advertisement
Sign in to follow this  
Matt_Aufderheide

scaling a texture in HLSL about arbitrary center

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

Im trying to scale a texture around an arbitrary center point in a shader...

 

to try to be more clear, if you want to scale around a center point of a texture normally you can  do something like this:

 

float2 scaleCenter = float2(0.5f, 0.5f);

centercoord = (In.tex.xy - scaleCenter.xy) * scale + scaleCenter.xy;

 

however, I want to do this with a longer texture that's scaled already like this : tex.x/=8.0f... tex.x+=x/8.0f (where x is 0 to 8 .... the particular block I want to show)  ...this is so I can pack a bunch of textures into one.

 

ok, but I still want to then scale the result about its own center point...

 

I hope this makes sense...

 

I tried something like this: 

float2 scaleCenter = float2(0.5f, 0.5f)/float2(8.0f,1);

scaleCenter.x+=i/8.0f; 

 

but not working right...can someone help?

 

 

 

 

 

 

Share this post


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