You can find the code snippet in my gists , and there is a complete shader.

Unity has an option to set native size on the UI element so it will be positioned perfectly. But if you dive into making a more tricky shaders that work with masks and detail textures which don't match the size of the main texture, you'll find yourself wanting that crisp prescission for them too while avoiding to adjust tiling and offset.

To get there my shader comes with a script that feeds the center of the object in screen space to the mesh for shader to sample a texture with center...

Please reload

Facebook icon
Instagram icon
GitHub icon
Discord icon