How do you deal with your shadows?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  02 February 2010
How do you deal with your shadows?

No, nothig existential here.

I was wondering how do you do to make belivable shadows in a BG plate.

Do you render out a special pass of a colored shadow? do you put the BG plate in the 3d program and project it
and make the shadows there, so it has some tones?

Do you render a straight b&w shadow and composite it via multiply/color burn/linear burn, etc??

There are some things I'm concerned about:

For instance, the Blending Modes method works for me in some cases, such as planes and stuff... but you never
really have the actual shadow tones that you have in the BG plate.

Also, in a lot of movies and real life I see a very special line of color at the edge of the shadow,
some times very dramatic.Is sort of what the blending mode Color Burn does, but not the same.

some examples.

As you can see, it is not a opacity fade between the light and the shadow.

The other way I do it is making a B&W pass for the shadow, then use it as an Silhouette Luma for the original BG plate,
and try to convert all that BG plate in "shadow", as if there was very little light. Still, that works best many times
for me, better than the blending modes... but again, is not bullet proof.

This is what I've found on the net about the subject.

Do you see all the tones they have in the shadow??? check the pic with the books... damn.
Or the one with the tree. That's not a multiply. They have actually converted the tree colors in shadow, and that's not
taking the Levels or Curves down neither (that's what I think at least).

So I ask again, how do you do it? I'm thinking that making it straight in the 3d software might be a very good way,
but had no luck so far.

Last edited by jtvergarav : 02 February 2010 at 06:05 PM.
  02 February 2010
Your issue stems both from already graded images that you're looking at, and the fact that shadows are merely an absence of the effects of a specific light-source in scene, one which can be very bright indeed, unless you multiply out against the actual lights effects/color then the result is not going to be quite the same.

The equation is fairly straightforward, simply determined light color (i.e. this is calculated by simply picking an average point in shadow , and an average point in full light on the same surface from the image and subtracting the shadow form the light source to give you an approximation of the light component), then multiply the shadow into that, and subtract the resulting pixel color difference (i.e. invert the shadow matte from the background plate (subtract the result).

Now that doesn't take into account shadow crossing, for that as your paper demonstrates you either have to take a shot with the area in shadow too, they used a pole and took a whole load of images in order to use the results to generate a 2.5d topology to project the original shadow over, simply cutting it out of the pole shadow images slice by slice measured against the height of the pole to get the semi correct result, i.e. it's not a multiply but straight alpha blend with full shadow with a bit of cleverness. For you to do that you'd need to more or less do the opposite of the light shadow pass, which is calculate the diffuse component of the image, not easy to do outside of a local area on a single frame with no full illumination data (although with a 3d capture on top and illumination models feasible provided you had an accurate enough scan), subtract form the whole, and add back in after the shadow has been calculated in the specific light. Generally though it's easier and quicker to simply do the whole thing using matting. But it is possible algorithmically to achieve with a bit of work.

Anyhow, the former is at least achievable, although you will need a higher dynamic range source for the best results. In compositing terms rather than coder terms what you do is use the eyedropper on a piece of general shadow, create a layer of that color, do the same with an area of general light, set the shadow one on top of the light one and subtract or set the mode to "Difference". This is now the equivalent of the light layer, you can then simply apply your shadow to this (inverted) and then linear dodge the result, if you add a HSV on the shadow you can adjust the fringing color. I've included a little PSD showing the layering setup to achieve the attacked image for you that might help.

And the link to the PSD with the layering is :

Hope that helps
Attached Images
File Type: jpg HowToShadowComp01.jpg (12.3 KB, 570 views)
The Third Party | Homepage | My Reel
"You need to know what you're doing before you start, and to start because you need what you're doing."
  02 February 2010
Oh, and just to give you a quick overview of exactly why the diffraction fringing issue is particularly bad for algorithmic shadow blending, here's a basic example of how to do your shadow blend using purely layering without any intelligent matting for you to see the the problem and where it goes all wrong.

So you can see there's problems here, using basically a method similar to what I outlined above... but why? Simply because of the diffraction fringe.

Here's purely the plate sans "sunlight" and you can see what's going horribly wrong!

The file for you to play with is here:

Now to be honest some of that fringing could have been dealt with better with Linear Color Workflow as a lot of that light edge coloration happens because of incorrect profiling. Though there's always a little, perhaps if i'd have manipulated the image in LaB i could have gotten a better result, or maybe spectrum compositing. But I would recommend always using LCW for your compositing where possible as it will simplify many things, including this. All grading, etc must happen after the composite is complete.

Sometime I should write some tools to get around this stuff, or maybe some papers on it. It's certainly an area that appears to bug many people.
Attached Images
File Type: jpg WhyAlgorithmsSuck01.jpg (12.3 KB, 548 views)
File Type: jpg WhyAlgorithmsSuck02.jpg (11.9 KB, 545 views)
The Third Party | Homepage | My Reel
"You need to know what you're doing before you start, and to start because you need what you're doing."
  02 February 2010
Oh and one final thing, just remember that your main aim is always to make something that looks roughly right. There really aren't many quick fix buttons to do it all. Most of that great work you see is done by a lot of painful laborious slow hard graft, there's no awards for doing something right, only for doing something that looks right. There's no cheating in CG, any hack, bluff of deceit you can pull off is legitimate, there's no right or wrong way to do something, just a way that looks good.

Get to know your tools really well and achieving any task in a set time will become second nature.
The Third Party | Homepage | My Reel
"You need to know what you're doing before you start, and to start because you need what you're doing."
  02 February 2010
I would figure it out in 2D first, without any 3D whatsoever. Just figure out what techniques work for "painting" a shadow in realistically on a separate layer. Then migrate the same, working, layered, 2D example, into your composting package and recreate the same test image on a single frame.

Once you get this working you can easily try the same testing procedure using 3D pieces, rendered out to passes, and using matte shadow nodes.

This will ultimately help inform you, that when looking at just your shadow pass, if something is wrong and needs to be fixed. You won't waste a lot of time rendering, and getting frustrated this way.

I also would not render the actual composite all in one shot, in 3D, it removes your ability to modify the background plate later, in 2D, easily. It should only be in there to assist in the roto-scoping process, but not actually rendered.
Photoshop: Color Extractor Script | Custom Split Script
  02 February 2010
Actually just remembered there is a way to get around the shadow matching, but it really only works with HDR data, as you can see form the example attached, it's fairly easy, you simply separate the sunlight from non sunlight component, apply the shadow tot he sunlight component and then add it back in.

Don't forget that the difference color that gives you the sunlight addition value does need to be worked out relatively locally, which still involved some matteing. I jsut slapped togehter a very quick example based on the grass image you have.

As you can see as normal method you get a nice amount of detail in "new" shadow areas but the shadow overlaps with existing shadows result in problems.

Using the alternate method results with lower bit depth in severely noticeable artifacts in the shadow areas, but on the other hand the shadow effect blends in eith existing shadows rather better.

The psd is here :
Attached Images
File Type: jpg mixnmatchshadow.jpg (71.0 KB, 454 views)
File Type: jpg mixnmatchshadow_bad.jpg (74.0 KB, 451 views)
The Third Party | Homepage | My Reel
"You need to know what you're doing before you start, and to start because you need what you're doing."
  02 February 2010
^-I was playing around with your .psd's, the management works quite well, especially the first one. This technique works equally well in different scenarios so long as you pick your color properly, as you instructed.

However it struck me that there are some limitations by doing things this way, and I was wondering a simpler way around it. For example, overlapping shadows (as the inside of the existing shadow will have halo color that doesn't belong there(as you pointed out)), and as well if the shadow ends up falling over two surfaces, say the same shadow is partially on grass and partially on a cement sidewalk. If this happened, the above method would seem to require masking, and re-doing the effect with a different color for the sidewalk. This would become even more complicated if the plate was moving and required a complicated mask between the two surfaces.

Obviously, if you were working in a black and white shot it would be a simple matter comping in a perfectly realistic shadow. And for a still color image, it's also simple, as you can just fudge the result by hand, quickly without getting very technical. But for a moving shot where you want this effect, I'm wondering if there is a way to simply multiply the shadow in as you would in a B/W image, and then have a copy of the shadow interact with the various color surfaces automatically, without having to actually sample and pick your colors by hand. This should allow overlapping, as well as proper coloring that traveled across various surfaces, without a ton of editing and masking.

Any ideas?
Photoshop: Color Extractor Script | Custom Split Script
  02 February 2010
One thing we've done a couple of times is taking a shot of the thing we are shooting in full shadow with a big thing that blocks the light, so we just mask it later and we can blend the shadows. Of course I guess that works for static-camera shots, and kind of basic.
  02 February 2010
@Per-Anders, I'm speechless.

Even being kind of a non-automated way, you solved 90% of my problems with that workaround. And the best thing is that all makes sense.


so, since you told me that's the usual way some kind of things need to be made by that number of steps for a simple thing, I guess that might be one of the big reasons why a lot of compositors use node based software. I can't imagine making this in AE and then starting to edit it.
  02 February 2010
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:37 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.