- Home /
Sprite shader relative UV's
Hi folks, I'm trying to get the relative UV's for a sprite in the shader that is stored as part of a larger Texture e.g. x = 0.5 as half way across the sprite being rendered not the texture as a whole. I have got my shader doing exactly what i want when the sprite is a single sprite on a texture but this prevents me atlasing sprites which isn't ideal. I'm sure there must be a solution that i'm just missing.
I could only find one similar post and their solution wasn't ideal (http://answers.unity3d.com/questions/674098/shaders-and-relative-uvs.html).
Any ideas much appreciated.
Never tried, but if you know the size of the original texture, can't you calculate the uvs from the Sprite.rect?
Sorry i realised I left the question a little vague i mean specifically from within the shader. Sorry this is my first question posted so I have updated the question to hopefully make it a bit clearer.
Your answer
![](https://koobas.hobune.stream/wayback/20220613164415im_/https://answers.unity.com/themes/thub/images/avi.jpg)