33
\$\begingroup\$

According to color theory, shadows work better if they don't use pure blacks or grays, but instead use a color that's complementary to the color of the object casting that shadow.

That is, if you have a red apple, you should use a dark green shadow; for a yellow banana, a dark violet shadow.

complementary shadow examples

But in many games, you cannot always predict what kind of background or environment the shadow will appear in, and you may not have the luxury of having dynamic shadow colors. In such cases, does it still make sense to use complementary shadows, or is a neutral black or gray acceptable?

\$\endgroup\$
  • \$\begingroup\$ Do you keep in mind 2D or 3D ? \$\endgroup\$ – Kromster says support Monica Sep 8 '14 at 4:16
  • \$\begingroup\$ @KromStern 2D, but since I can only think of technical implications - I'm asking a design question - I'm curious about what difference this makes, that you had in mind. \$\endgroup\$ – congusbongus Sep 8 '14 at 4:44
  • \$\begingroup\$ No, I don't have a plan in mind. If that's 2D, then it is easier to test in Photoshop by throwing a bunch of sprites with semi-transparent shadows. \$\endgroup\$ – Kromster says support Monica Sep 8 '14 at 7:12
  • \$\begingroup\$ Even if it was possible to do this, is it worth the complexity (code and runtime)? Is it good enough just to use a black shadow (which is fast/cheap relative to a complementary shadow)? \$\endgroup\$ – ashes999 Sep 8 '14 at 14:32
  • \$\begingroup\$ If you're doing a 2D game, you probably have the shadow as just another sprite (or even part of the original sprite), right? In that case, there probably isn't much of a difference between having an alpha-blended black shadow, or an alpha-blended slightly-coloured shadow. But you'll have to try that, of course. \$\endgroup\$ – Luaan Sep 8 '14 at 15:10
43
\$\begingroup\$

To me it makes no sense at all. This theory is probably just an artist sense of white balance compensation that the eye does, and wrongly gives us the feeling of shifted hues in the shadows. A shadow is just the absence of light from the considered light source. There are other light sources often in a realistic world, this is their color that comes in place. E.g. blue, often, under clear sky conditions. Which is what the theory you link to is wrongly stating as an absolute truth, without understanding why and in what conditions. Shadows in interior lighting are not blue obviously.

While the "local color" of the theory you link to, is no more no less than local GI, and color bleeding. The one covered typically by RSM and the likes. (LPV to a better extent).

My answer is definite, it makes no sense for games. If you have a realistic renderer it will be enough by itself. Especially if it features, either real time GI (SVO cone tracing, LPV, RSM..) or lightmapped colored GI (physically based is preferred, and of course the whole pipeline gamma correct), or/and IBL.

Now for artistic considerations, the latest point "complementary colors", could be of significance in games if you want what we call a "stylized renderer", or non-photorealistic-rendering. To increase the "drama" or tend to cartoon style, or aquarel style; this would allow you to give a special touch to your game. But I repeat, from a physical perspective it makes no sense appart from what I said in my first sentence: this must be some natural feeling of artists in their position of nature-observer, that results from white balance compensation.

\$\endgroup\$
  • 13
    \$\begingroup\$ Your main point seems to be that complementary shadows are not naturalistic. But there’s no reason that games (or other rendered graphics) have to be naturalistic: e.g. some engines give objects strong cartoon-like outlines. So it doesn’t seem crazy to try to get complementary shadows or other aesthetic effects along these lines — though what the details would look like, and whether it would be worth the time and effort is certainly unclear. \$\endgroup\$ – PLL Sep 8 '14 at 14:51
  • 15
    \$\begingroup\$ @PLL That's a good point. However, it would mean that you're trying to build a stylistic rendering that approximates some kind of painting style - in that case, there would be little point in asking the OP's question - either you're trying to approximate that, and in that case the only question is if you're capable of doing that, or you're striving for some kind of realism, in which case it's important to understand that this is not in fact realistic - just aesthetically pleasing (and obviously very subjective). \$\endgroup\$ – Luaan Sep 8 '14 at 15:08
  • \$\begingroup\$ @Luaan: Obviously, asking the question made sense to OP, otherwise he would not have asked it. Anyway, it was a very interesting question that has been upvoted 27 times and favorited 7 times. \$\endgroup\$ – HelloGoodbye Sep 10 '14 at 12:58
  • 1
    \$\begingroup\$ @HelloGoodbye You misunderstood my comment. I said that if the OP wants realistic rendering, then he doesn't need to care about this because it's not realistic. If he aims to be aesthetically pleasing, on the other hand, he only cares about if he can actually do that or not - in either case, non-complementary shadows are enough because realistic shadows don't use complementary colours. I wasn't attacking the question, I've actually upvoted it as well :) \$\endgroup\$ – Luaan Sep 10 '14 at 13:21
  • \$\begingroup\$ @Luuan: Okay, sorry for the misunderstanding in that case. But I don't see your point; if he wants to know whether he can draw complementary shadows or not, how does it help him to tell him that non-complementary shadows are enough? \$\endgroup\$ – HelloGoodbye Sep 10 '14 at 18:34
14
\$\begingroup\$

For drop-shadows it doesn't work very well for the reasons you already stated. You never know how many drop-shadows you will have in the scene and differently colored shadows from different objects can look strange. However, it can work nice for self-shadows, especially in a 2d game. This screenshot is from Seiken Densetsu 3 (Squaresoft 1995):

Tree with purple complementary shadow

Notice how the shaded parts of the tree use violet as a complementary color to the yellow highlights in the lighted parts and how well it works. But also notice that the artist decided to not color the drop-shadow of the tree.

\$\endgroup\$
9
\$\begingroup\$

If you use alpha blending you can lay down a complimentary shadow that will work against any background.

It may or may not be any better or faster though. This is something that is likely to change depending on your specific game.

I don't have enough rep to comment on @v.oddou's answer, but I want to say that while purposefully making shadows complimentary might not make sense in a reality simulation rendering, in games there's many cases where it might make sense. Such as his example of it being done for artistic effect.

\$\endgroup\$
5
\$\begingroup\$

Objects are rarely lit entirely by a single point light source. In most cases, objects will receive much of their illumination from a dominant point source, but receive additional illumination from other point or sources, including some diffuse light which has been scattered by either by other objects or (for outdoor scenes) by the atmosphere. If an object is lit by a bright white point source, but is lit by a bluish ambient light that is only 2% as bright, the color of the ambient light won't noticeably affect the portions of the object which are lit by the primary point source, but will be very visible in those portions which are primarily lit by the bluish ambient.

In some contexts, it may make sense to keep track of the color of ambient light, and have shadows be tinted slightly as a consequence of it, but I don't see a reason for having objects cast shadows whose colors are the complements of the object colors.

\$\endgroup\$
3
\$\begingroup\$

The complementary colour thing is actually illusory. Set up a lemon on some white paper and photograph it. The shadow will have yellow in it, not purple, due to the yellow light being scattered off the lemon.

Now, to the matter of whether to use it in your game. If you're going for a painterly art style, then you could certainly include it, though it will require some additional coding of shaders to implement it (which you could well end up doing, anyway, depending on how sophisticated you're making your non-photorealistic rendering system).

If, on the other hand, you're aiming for a realistic style, just don't worry about it.

\$\endgroup\$
1
\$\begingroup\$

Wouldn't it seem a bit strange to see things in a row of different colour, with different coloured shadows ?

To me, the picture of the various fruit doens't look like 3 pieces of fruit on a white background; it looks like 3 different pictures of fruit, probably because the different colour shadow hints at them being in a different context.

I daresay this is subjective, but I find it a bit questionable - I'd also agree with what v.oddou says, although this assumes you're trying to get things to look 'realistic'.

Ofcourse the other jiob of shadows is to give a hint at how high off a surface an object is. No shadow = you can't tell whether it's 1 for above or 40 ft (or whatever the units are). If there's a shadow of any sort, your brain does the calculation for you and yo have a stab at guessing when an object will bounce, or whether it's possible to run under it etc. For that function, I'd think just a greyscale shadow mixed in with background colour, if possible, would do the trick.

There's also the odd natural effect when there's more than one source of light, of different colours. If you had a few coloured lights giving basically a white light mix, un-shadowed background would give a mixture of all colours but if there's a shadow blocking say blue light, the shadow may look relatively reddish.

Even in reality this looks a bit strange! So my answer would be : while it's an interesting notion and possibly worth experimenting with in some still images (or finding examples), I'd expect to find it's not worth putting the effort in to calculate the shadow colour.

\$\endgroup\$
1
\$\begingroup\$

I have considered doing this before for an NPR renderer since I have a visual arts background and always loved the look of certain types of popular sci-fi and fantasy artwork that exaggerated this effect, but as others noted, it makes no sense from a physics standpoint. There's no way you're going to have blue light in a shadow unless something is actually reflecting blue light into it.

But if you are going for a non-photorealistic renderer, the effect might be very beautiful with the contrasting hues (though in a painterly way, not a realistic way). That said, I would suggest using the color of the light source(s) being excluded to tint the shadow, not the material of the object occluding the light. That should simplify the computation and still ties all the elements of the composition together. For example, a warm light from a fire place might cast a cool blue shadow when the light source is occluded, even if there's no blue objects to reflect light into that shadow let alone much blue light in the first place.

The second thing to note is that the artist's color wheel is based on the subtractive nature of mixing pigments. It's not based on complementary light colors. As a result, the artist's color wheel considers, say, green to be a complementary color to red:

enter image description here

... not cyan, and mixing those two pigments would result in an ugly brownish/grey color, not white as we'd get with additive mixing of light. Likewise the complement of blue would be orange instead of yellow, and so forth. To emulate the look effectively would probably require using this type of color wheel.

\$\endgroup\$
0
\$\begingroup\$

This question is very old, and has many answers, but I went to art college. Here is my answer:

The theory as you have stated it, according to my knowledge, is only partially correct. In reality, the color of shadows are the complement of the color of the light source. If you think about it, it makes sense: a cast shadow can be defined as blocked light, and if you have for instance a yellow light (the sun) you will be left with a bluish cast shadow. To illustrate this point, please consider "The Green Stripe" by Matisse (someone who may be referred to as 'one of the old masters' or whatever):

link to google image search results for "The Green Stripe".

Please note how the red light, which is being cast from the right side of the frame, leaves a dark greenish core shadow and a yellowish reflected highlight. Green is the complement of magenta, and yellow is the sum or green and red (additive color theory).

Recall that the theory as you state it is partially correct! In close-up cases of brightly colored and reflective objects on a white surface, such as the image you linked with the apple, the ambient light in the room is hitting the dark side of the apple and reflecting the apple's color onto the surface on which it rests. The core color of the shadow is still the complement of the color of the light source!! In a studio environment (the kind of place where you find lone apples on white void-like surfaces), your light source is likely artificial and as close to pure white as possible so that people working with color and pigments in that environment do not have their understandings of color skewed due to a colorful light (try painting the same thing twice under sunlight and then in a photographic dark room (red)! compare those results lol).

Now! to answer your question: dynamic shadows, or even just statically colored shadows are extremely doable. Do they fall within the scope of your project with consideration to time, money, and labor required? Well that's a completely different question that you need to answer for yourself!! Gray/black shadows are a SIN (imo) and you should avoid them if you want your game to generally be considered aesthetically pleasing. You do not need to predict the background, environment, or take into account the object color. The only piece of info you need for easy and natural shadows is the color of the light source. Consider this screenshot from attack on titan: LINK

Shadows in my game are always a dark and desaturated complement of the color of my game's light source(s): RELATIVELY EASY, several games already do this

Shadows in my game take into account ambient occlusion, bounce light, the color of multiple light sources and types, etc. etc.? That's already a lot of gosh darn work. If you're an indie developer whose primary focus is making games rather than graphics programming or tools dev, this is absolutely not worth your time (opinion).

Thanks for reading, hope this helps whoever visits this ancient problem in the future!!! :- )

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.