1

I want to put a sprite over other using shader graph, like in this tutorial. But after I do the spritesheet, the emission map, create the shader graph and the related material, add the Texture 2D in the blackboard and the _MainTex reference, finally put the texture that I want to use, and this happens: Shader graph editor.

I really do not know what am I doing wrong, and in the game my character looks like: Scene view.

Even though the background is transparent and is sliced in the sprite editor: Sprite editor.

I do not know if is beacuse I'm using the most recent version of shader graph (in the tutorial they use a different one), or probably I'm doing something wrong, or else. I trully don't know, I'm new with all of the shaders and stuff, please, anyone have some idea of what is going on?

JaredH
  • 2,338
  • 1
  • 30
  • 40
  • What exactly is the problem? "this happens" - I don't see anything that should not happen. – SpicyCatGames Jun 30 '21 at 16:35
  • When I use a normal sprite, it shows the background of the image transparent, but when I try to apply the shader, it shows the background black, all streched out to the limits, and not only in the graph editor, algo in the scene and the game view. So, I want to apply the shader and it to look back to normal, to then, apply the othe sprite on top, like in the tutorial mentioned above, – Angel Trujillo Jul 01 '21 at 01:05

3 Answers3

0

I would assume the problem is that you're using an opaque shader.

Go into: Graph Inspector > Graph Settings > Universal

And set the Surface to Transparent.

You may also want to feed the Alpha from the Sample Texture 2D into the Fragment's Alpha.

shader graph

Iggy
  • 4,767
  • 5
  • 23
  • 34
0

For those who have this issue in 2d sample texture 2d with sprites, increase the size of the sprite, like 3 times or 4 times and it will be fixed.

Lasitha Lakmal
  • 486
  • 4
  • 17
0

Link of Alpha

The problem is probably that your Alpha hasn't been connected between your Main texture and the Fragment !

You have to connect it from the main tex to the fragment to get it to work i think ! I tried to find a solution for hours, and it worked !