Gamestudio Links
Zorro Links
Newest Posts
Get a csv file into an array of structs, confused about lite-c
by easyX
6 minutes 32 seconds ago
Random walk vs Real price statistic
by kujo
Yesterday at 21:40
Inline functions in Lite-C
by MasterQ32
Yesterday at 21:04
Alpha Vantage API key - where to put?!
by veepsirtt
Yesterday at 10:26
Using standard C libraries with Zorro?
by Hredot
Yesterday at 02:51
AssetVars in Asset Lists
by Hredot
Yesterday at 02:50
How to count
by brax
02/17/18 20:15
AUM Magazine
Latest Screens
Forgotten Tales - Demo version
RPG PARTY
Triton Wing now available on Steam
AckCon'17: Lotter vs The World
Who's Online
21 registered (easyX, Hredot, kujo, alibaba, AndrewAMD, Kartoffel, DASFX, boatman, 4 invisible), 458 Guests and 4 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
veepsirtt, trulala, elninio, Thwessen23, rmassip
17890 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: 1146
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

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

Registered: 06/11/09
Posts: 2144
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

Top


Moderator:  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | resources | magazine | manual | support faq | bugs

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