I am having an issue with shader graphs. I have made a shader to put textures on white sprites. The texture itself shows properly and I can tweak the size without any problems. The issue is that it seems that if a sprite as a somewhat complex shape, the texture does not fit properly. In the image below there is the blank sprite shape on the right and on the left the same sprite with the material attached to it:
From what I've read it might have something to do with the alpha. Currently, I just set the output from the last graph node to the fragment node, like this:
I have tried also to change the position from world to object, but that in turn deforms the texture if I change the sprite scale, whereas I like to have a recurring pattern at a consistent scale.
Has anyone encountered a similar issue? All suggestions are much appreciated, I am new to shader graphs so it's a good chance to learn a bit more!
UPDATE: I changed the image according to the reply. The result in scene is the same though.
Here are the steps to reproduce the issue in a new project:
- Using version 2021.3.8f, Create a new 2D URP project
- Create the Sprite Unlit Shader graph as shown in the picture
- These are the graph settings:
- Import some sprite, here is the one I used for reference:
And these are the sprite settings:
- Create a material
- Assign the shader to the material
- Drag the sprite into the scene and assign the new material
The result is the same. One thing to note is that if I use a simpler sprite the shader fits the shape.





