• Advertisement
Sign in to follow this  

scaling a texture in HLSL about arbitrary center

This topic is 448 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);



but not working right...can someone help?







Share this post

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

  • Advertisement