Complementary Color Equation, Light Color, Shadow Color! RGB

Posted By: jumpman

Complementary Color Equation, Light Color, Shadow Color! RGB - 02/08/18 16:49

Hello friends,

Im looking to homogenize the different shaders in my game, due to each of them currently having hard coded light and shadow values. But what if one level has a dull white moonlight, compared to another level's bright yellow sunlight?

So, I can pass the level's sun color vector to each FX file, and this light will bathe the surface in that light. But when it comes to shadow, in real life, if the light source has a color thats not white, the shadow color has a tint of the color thats complementary to the light color!






What kind of equation can I come up with, using RGB values to always make the shadow color the complementary color to the light color?
Posted By: Kartoffel

Re: Complementary Color Equation, Light Color, Shadow Color! RGB - 02/08/18 23:11

if all you're looking for are complemetary colors:
color_comp = 1.0 - color

That being said, you might want to make the effect a bit less intense. I'm pretty sure using complete opposite colors will give a way too strong effect.

Also, in real life, light vs shadow colors don't have to be complementary. Though, in your case (sunlight) you're right, since the sky adds some blue ambient light while the sun is mostly white-yellow-orange-ish which is complementary to the blue.
You also get a similar effect with neutral ambient light (like grey) and a colored light source (since visual perception is somewhat relative) but I don't want to bring up too much of the theory stuff here.
© 2024 lite-C Forums