Gamestudio Links
Zorro Links
Newest Posts
Help with Data import to T1
by AndrewAMD
45 minutes 48 seconds ago
Using ":L" & ":S" causes 2 possible bug(s) or is it bad coding?
by AndrewAMD
Today at 03:54
Correlation -1.#IND00
by AndrewAMD
01/21/19 17:37
Basic thread safety question
by Superku
01/20/19 18:15
Blog Post: Get Historical Data from Darwinex REST API w/ Zorro
by AndrewAMD
01/19/19 22:19
Reseting a static variable - the next day
by OptimusPrime
01/19/19 19:48
Train algorithms separatery
by 3dgamelight
01/18/19 10:37
AUM Magazine
Latest Screens
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Evonet Beta v1.0 : Online Project Development Template
Lake scene
Who's Online
12 registered (Iglarion, AndrewAMD, Michael_Schwarz, ags, chsmac85, kvm, ibne, alibaba, 3 invisible), 431 Guests and 6 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
laz, ramonne, SibJac, Evael, NRW
18156 Registered Users
Topic Options
Rate This Topic
#470842 - 02/08/18 17:49 Complementary Color Equation, Light Color, Shadow Color! RGB
jumpman Offline
Serious User

Registered: 04/17/02
Posts: 1220
Loc: ny
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?
A8 Pro 8.47

#470847 - 02/09/18 00:11 Re: Complementary Color Equation, Light Color, Shadow Color! RGB [Re: jumpman]
Kartoffel Offline

Registered: 06/11/09
Posts: 2210
Loc: Bavaria, Germany
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.
POTATO-MAN saves the day! - Random


Moderator:  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at)