#Problem with shader graph in 2D sprite

1 messages · Page 1 of 1 (latest)

cyan forge
#

Hello, I'm working on a card game and I faced a problem when I tried to add an effect for the back of the cards

#

As you can see here. the card on the right has the shader graph material. while the one on the left doesn't have it.
The problem is the red edges on the card. I don't know why they are there and how to remove them

#

I tried splitting the color to remove the alpha. didn't work. Tried connecting the alpha value of the source texture to the alpha value of the output. didn't work either

#

Another problem I faced is with adding an offset to the cards. I get white edges on the alpha values

#

I added an offset so they move down. the new area above is replaced with white

cyan narwhal
#

can you show the Graph Settings menu in the shader graph editor?

#

it sounds like the alpha is not being used to discard pixels right now

lusty oak
#

What graph type is being used and how are you rendering the cards? i.e. If they are UI you should use the Canvas Graph type

cyan forge
#

It worked! my shader graph was Sprite Lit

#

I didn't know that there was a shader graph specific for UI elements 😅

#

Thank you

#

May I ask what is the difference?

cyan narwhal
#

Canvas rendering is fundamentally different from 3D/sprite rendering.

#

you'll notice the "Canvas Renderer" component on all of your UI objects

#

I'm not sure how exactly they differ

lusty oak
#

For some reason objects on an overlay type canvas seem to cause all shader passes to render. Most graph types have additional passes like DepthOnly (to render into depth texture) which incorrectly gets rendered to the screen

#

Canvas graph type fixes that, and should also support masking

cyan forge
#

Great. Thank you for the help UnityChanThumbsUp

cyan narwhal