roepit
roepit

Reputation: 1153

Why does Unity Shadergraph Lit Graph show the sprite differently?

I created 3 shader graphs that all just replace 1 color. A Sprite Lit Graph, a Sprite Unlit Graph and a PBR Graph. My question is, why does the sprite that has the LitGraph material applied, look so differently?

(From left to right, 1 original sprite, 2 lit graph, 3 unlit graph, 4 pbr graph) enter image description here

Here are the settings for the LitGraph: enter image description here

An here are the settings for the working UnlitGraph: enter image description here

I think it might have something to do with the Alpha value not being connected in the LitGraph but I have googled if anyone else had this problem and for documentation and I really can't find the answer. Any help is appreciated!

Upvotes: 1

Views: 2365

Answers (1)

TrashCanHero
TrashCanHero

Reputation: 46

I know this question is old but other people might see this and since this is the only question I could find about this here's the answer.

To make a long story short, alpha is included with the sprite lit graph, it's just not separated like it is with the other graphs.

In all of the other 2D graphs, the main color is a vector 3 for the RGB, and then there's another tab for the alpha. But for some reason the lit graph combines the two and takes in a vector 4 to include the alpha, this a problem because 99% of the nodes are geared toward having the vector 3 and using the alpha at the end. So none of them use a vector 4, only 3. Leading to problems like this where no one has any idea what's wrong.

The fix is simple if a little bit gross looking, simply split the RGB values of your final product and recombine them using the alpha from your original sprite. Like this

That random line going to the alpha is the original sprite texture's alpha, after that just plug it into the color and you're good.

Also this might not be the best fix it's just the one I found to work.

Hope this helps anyone looking for the answer to the problem I just had.

Upvotes: 3

Related Questions