- Home /
Question by
Mr_Admirals · Dec 22, 2018 at 06:31 PM ·
shadertextureuvuv coordinates
How to scale and offset UV coordinates from the center of the texture?
Hello,
I'm trying to scale and offset a texture. I have it basically working, but can't seem it get it to scale from the center of the offset. Anyone have any idea how to do that?
Thanks.
Comment
Answer by Namey5 · Jan 09, 2019 at 10:00 AM
Try the following;
//Where 'uv' is your UV coordinates, and '_Scale' is your scaling amount
uv = (uv - 0.5) * _Scale + 0.5;
This basically offsets the texture to the centre before scaling, then scales it around that point, and finally re-centres the texture back to its original position.