View Full Version : How to composite shadows onto live footage

09-06-2006, 12:13 AM

I'm trying to do a character animation and composite it, and it's shadows, onto some filmed footage. However, I'm stumped by a problem which has confused me in the past and I've never found out the answer.

I've created an example scene.

Attached are 4 images;

image 01 - original photograph
image 02 - how I've set up the models to match the scene in lightwave

I then adjusted settings on the signpost object:
unseen by Camera = CHECKED
self shadow = UNCHECKED
cast shadow = CHECKED
receive shadow = UNCHECKED
(this way, the sign is invisible, but still casts a shadow on the ball)

and the wall object:
the texture is a front projection of the background image (not how I would usually do it but easiest for this example)
self shadow = UNCHECKED
cast shadow = UNCHECKED
receive shadow = CHECKED

image 03 - this shows that the ball recieves the shadow from the invisible sign correctly, and it casts a shadow onto the wall correctly.

The problem is, the signpost also casts a shadow onto the wall (but I don't want that because it's already in the original image)

image 04 - shows that if I set the wall to not recieved shadows, then the ball also doesn't appear.

does anyone know how I would solve this problem?
It's a very common problem, eg. a real building casting a shadow onto a cg object and the cg object casting a shadow onto the ground. So surely there's a solution.

Would really appreciate the help as I'm completely stuck.


09-06-2006, 12:27 AM
The easiest way might be to remove the shadow from the original image, and let your signpost cast it at rendertime.

That is assuming your background is a static photo though.

09-06-2006, 12:32 AM
yeah... with a static photo, I agree..

but this is just an example... I need it for an animation....

thanks for the reply James

09-06-2006, 01:29 AM
With worley's G2 you can selectively adjust the influence of light on surfaces. If you clone your shadowcasting light and assign each to it's own lightgroup and exclude the sign from one light you can set the shadowdensity and lightinfluence on all objects. You can also match your shadowcolor easier.

09-06-2006, 02:07 AM
Render with two passes. One with your ball active only, including the shadows cast on it. The second with all objects except for the backdrop set as matte objects (setting their alpha to black), excluding the lamp post from casting a shadow.
Two scenes, two renders, merge in a compositing app of your choice.


09-06-2006, 06:16 PM
thanks guys...

lightwolf, I'll give that a try... but with the actual scene I'm thinking of that might get complicated... or there might be another issue I've forgotten to consider...

kruemel, seems pretty cool that you can adjust the effects of each light on each object... ..I don't have G2 unfortunately - how does it play with 9's new features?.
However, doubling up the light and excluding the lampost from one of them and the wall from the other would mean that the ball is twice as bright... which might be a problem to get around??


09-06-2006, 06:55 PM
I know Lightwolf's method might sound more complex, but I think it would give you the most options. I have rendered out several passes before and "glued" them back together in Shake.

For example, if you rendered out a separate shadow pass, you could mix and match in post. I know this goes a bit beyond what you wanted, but that's how I would do it.


09-11-2006, 05:20 AM
the beauty of rendering out a seperate shadow pass is that you can set the alpha of the objects that catch the shadow to "shadow density", which means that only the shadows will be opaque. You can then adjust softness and colour etc in post, and composite it over your live footage. Passes are the way to go (but it can hurt your brain when you have to work out what goes in what pass).

09-11-2006, 06:23 AM
The funny thing with G2 is, you can exclude the effect of a light (brightening the surface) from an object - also in fractions - but keep the effect of the object on the scene -> they still cast shadows

09-11-2006, 11:02 PM
hey.. thanks for the info guys.. but now I'm stuck further along the line....

I can't afford to have sharp shadows... so I'm using spotlights, shadow mapped with a fuzziness setting. However, setting "Self Shadow" to off when using shadow maps doesn't work so I'm getting unwanted shadows on the image from the shadow objects.
If I set the light to raytrace it works properly but the shadows are too sharp.
I can't use an area light as the render times are way too high.

why doesn't it work for shadow mapped lights and... is it possible to get it to work?

is there a workable solution?


09-11-2006, 11:59 PM
Again, try breaking it down into passes. Put your shadow objects as mate objects and the wall into one pass and just render out the shadows

Put your objects without the shadows into another pass and render them out without any shadows. Glue them together.

Like I said, rendering out just shadows gives you the option of further softening those shadows in post using a blur (ok it's a cheat, but it's a fast cheat). Sorry to sound like a broken record, but it sounds like you need to learn to love your passes.

09-12-2006, 12:18 AM
lol.. I did understand the need for seperate passes, sorry, I didn't make that clear.
But I'm hesitant to do a blur in post because it'll blur my shadow outside the edges of the object... The object also has overlapping sections and blurring the shadows across them in a 2d nature will look like a 2D blur, not a blur on the surface of the object.

But yes, it is definitely an option.. just not a very acurate one... I'll I'll give it a go when I get closer to rendering time...

However, is there an actual way that I've overlooked to enable shadow mapping to pay attention to self shadowing = off?

thanks for the reply,

09-12-2006, 12:52 AM
actually.. I just thought of a solution...

The reason that my render times jump "so" much when I use an area light is I'm using SSS on a characters skin.... however, when rendering the shadows, this character will be a matt object...

so if I use a shadow mapped light when rendering my character's passes, and then use an area light when rendering the background shadow pass I should get a more acurate result compared to what I had originally intended and I while my render times will jump.. they wont jump that much.

thanks for all the help guys..