Skip to main content
Rollback to Revision 2
Source Link
DMGregory
  • 141k
  • 23
  • 258
  • 401

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:

Textures sprite loses complex border shape

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:

![World space texture feeding color and alpha pinsWorld space texture feeding color and alpha pins

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:

enter image description here

  • Import some sprite, here is the one I used for reference:

enter image description here

And these are the sprite settings:

enter image description here

  • 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.

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:

Textures sprite loses complex border shape

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:

![World space texture feeding color and alpha pins

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:

enter image description here

  • Import some sprite, here is the one I used for reference:

enter image description here

And these are the sprite settings:

enter image description here

  • 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.

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:

Textures sprite loses complex border shape

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:

World space texture feeding color and alpha pins

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!

Further information
Source Link
FSic
  • 188
  • 13

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:

Textures sprite loses complex border shape

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:

![World space texture feeding color and alpha pins

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 shaderSprite Unlit Shader graph as shown in the picture
  • These are the graph settings:

enter image description here

  • Import some sprite, here is the one I used for reference:

enter image description here

And these are the sprite settings:

enter image description here

  • 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.

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:

Textures sprite loses complex border shape

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:

![World space texture feeding color and alpha pins

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:

  • Create a new 2D URP project
  • Create the shader as shown in the picture
  • Import some sprite
  • 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.

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:

Textures sprite loses complex border shape

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:

![World space texture feeding color and alpha pins

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:

enter image description here

  • Import some sprite, here is the one I used for reference:

enter image description here

And these are the sprite settings:

enter image description here

  • 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.

Addition of step by step actions to reproduce issue
Source Link
FSic
  • 188
  • 13

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:

Textures sprite loses complex border shape

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:

![World space texture feeding color and alpha pins

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:

  • Create a new 2D URP project
  • Create the shader as shown in the picture
  • Import some sprite
  • 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.

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:

Textures sprite loses complex border shape

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:

![World space texture feeding color and alpha pins

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.

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:

Textures sprite loses complex border shape

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:

![World space texture feeding color and alpha pins

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:

  • Create a new 2D URP project
  • Create the shader as shown in the picture
  • Import some sprite
  • 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.

Take into account suggestion
Source Link
FSic
  • 188
  • 13
Loading
Don't repeat tags in title. When asked to "Enter image description here", please do that.
Source Link
DMGregory
  • 141k
  • 23
  • 258
  • 401
Loading
Source Link
FSic
  • 188
  • 13
Loading