Material colors taking light into account?

Hello there!
Is it possible to write a shader that takes both material’s main color and Unity lighting in account and combine them when rendering? So for example, if I have a mesh pitch black and create a light slightly above it, the mesh would get lit where the light is shining at. Would that be possible?

Thanks in advance.

Black getting “lit” doesn’t make any sense, because black absorbs all light. If you want your black object to have a reflective, transparent coat on it, however, that might make physical sense. What you’re talking about is definitely possible; you just need to have an idea of the actual look you want, before you try to code it.

So, what I’d want is this:

Imagine the mesh’s texture is a normal texture (for example) but the material’s color is set to almost black. There’s a light shining on top of it and lighting the mesh even though its main color is black.
I hope that clears things up, sorry, I’m not that good at explaining things :expressionless:
Would that be possible?

Perhaps you could mock up an example of what your material would look like without a light, with ambient light only, and then with ambient and a point light.

Alternately, you could try and explain it mathematically. Usually, the visible colour of a material is calculated like this:

final = albedo * irradiance

The multiplication means that either zero (black) albedo or zero irradiance will result in zero reflected light. Perhaps you want an addition instead?

final = albedo + irradiance

This would mean that the final result will always be at least as bright as the base colour.