Same Shader, Same Input, Diffrent Output

So I made a simple sprite lit snow shader for my 2d Pixel Art game.

The problem is I made it in my test project.
When I moved it over to my main project it gave me a diffrent output that in my test project.
The shader got the exact same input all the values and textures yet it somehow produced a diffrent output.

I took a closer look at it and even some simple operations like inverting colors give diffrent outputs between projects which shouldnt be the case.

Test Project

Main Project

Could any body please tell me what is going on here???

I should add that both projects are made on the same version of unity

My first suspicion is that maybe the settings on the texture are different between the two projects. Could you check to see if the texture in your first project matches the one in your second project? Specifically, if the first one has an alpha channel, does the other one also have it? And then check the settings in Unity for the texture between the two projects in the Inspector:

Not saying that yours have to match mine, but compare them between the two projects and make sure they’re the same.

Nope they are the same

Main Project:
9230658--1289367--upload_2023-8-17_22-47-4.png

Test Project:
9230658--1289370--upload_2023-8-17_22-48-22.png

Only diffrence I can find between the projects is that in my main project I have a texture asset importer preset but it’s only made to import my textures with the correct PPU and filter mode where as I set those by hand in the test project.
So I don’t think that is the issue, unless unity does something here tham I’m not aware of.

(Edit)
Well just checked and it’s not the importers fault.

Do the actual image files have the same number of channels? Is one of them missing an alpha channel or have one where it shouldn’t?

I am not excatly sure what you mean by that and how to check that.

I think this is what you mean9230814--1289385--upload_2023-8-17_23-53-5.png
and if I’m right about that than yes they are the same in both projects and they are both correct

Like if you were to open the texture file in Photoshop (or other image editing software) and look at the channels, does one of them have an alpha channel and the other not have it?

Another thing you could do is, in your graph, insert a swizzle node in between the RGBA output of the Sample Texture 2D node and the Invert Colors node, and set the Swizzle node’s mask to XYZ - so it’s just giving you 3 channels instead of four. After doing that, does the Invert Colors node output match, or is it still different?

So I tried the second method and the output of the invert colors node is still diffrent

Also I don’t really think that the textures are the problem here as I made sure they are the same texture by copying the file over from on project to another.

Is there any other reason this might be happening?

Do you have the same color space linear/gamma in both projects?

2 Likes

Yes! that’s it thank you.

But I did not change the color space in any of my projects so why in one gamma was set by default and linear in the other?

Also what is the diffrence between them?

In a nutshell, both Linear and Gamma-Corrected modes assume that 0 is black/empty and 1 is white/full, but they change the emphasis along the way for values in between. This is supposed to be useful for having a good tonal balance on varying hardware, and for how light falloff behaves, but in my experience it just makes for constant surprises like this when different assets or projects have a mismatch.

Alright, Thank you!