2D Greyscale shader with lighting and color.

I am very new to unity and shaders in general. I am currently trying to make a shader that when something is unlit it will be in greyscale but when it is lit it will be normal color. Any help on how to make this would be greatly appreciated!

Hi @tsirgamesalott ,

I think the easiest way to do this would be to check the attenuation level (i.e. shadow intensity) in your shader. You can find code examples here, you would have to write your own lighting calculation for a surface shader. Just check if the attenuation is below a threshold and grayscale the colour.

You can in theory use raycasts and an extra texture, which might be better for edge cases. See this question for more information, or this shader code for a lookup texture setup.

Generally said though, the less light (the more shadow) your object has, the grayer it is anyway :smiley: