Render shadow without shadow object

After searching for a solution to rendering a shadow pass without the shadow “object” being rendered, I’ve setup a blend file but have not been able to get it to work.

Either the “ground” object (and shadow) render, or neither do.

In the attached blend file, Suzanne is on layer 1, the ground is on layer 2, the light is on layer 12.

I have two render layers, both render layers have the layers-visible matrix set to layers 1,2,12.

Render layer 1 has the include-layers set to 1,12, while render-layer 2 has layers-included to 2,12

Render layer 1 include = Solid, Halo, Ztransp, Sky,Edge, Strand
Render layer 1 passes = Combined

Render layer 2 include = none
Render layer 2 passes = shadow

I have setup a node network with two render layers and an image input, with those
three nodes connected to two alpha-overs to produce the final image.

What am I missing ?



comp1c unp.blend (696 KB)

bump , would REALLY like to get this working ! :slight_smile:

If I understand your problem correctly, you should exclude the scene layer that contains the shadow object from Renderlayer 1 (include-layers set only to 12).

Edit: Ok I actually opened your .blend. “Renderlayer 1” should include only scene layers 2 and 12.

Thanks for looking !

If I turn off scene layer 2 (the shadow object), in render layer 1, then I don’t get either the shadow or the object.

I think maybe the node setup I have is in-correct, and / or I’m assuming incorrectly ?? that the shadow (render layer 2) should appear on the final render (composite node) ?

But I’m just guessing at this stage.

I haven’t grabbed this blend-file, pardon moi, but if you look separately at the outputs of the two renderLayers, what’s actually there? Do you get, from RenderLayer #2, the shadow-channel that you need? (“Never mind what happens to it next… is it there?”)

I AM getting the shadow channel, but it looks like I’m not combining it properly in the output.

I was tryng to use an ALPHA OVER to combine it with the static image, but it seems the alpha over node either puts the entire shadow channel “behind” or the image “behind” (depending on which node inputs I use).

I just tried a MIX node, same thing happens.

If it’s not obvious, this is the first time I’ve tried to create this effect :slight_smile:

If I turn off scene layer 2 (the shadow object), in render layer 1, then I don’t get either the shadow or the object.

Odd, that’s all I did in the .blend you posted, and it rendered Suzanne’s shadow on the receiving geometry. Maybe it has to do with the image; I can check your node tree more closely after the kids are asleep :).

Ya, but I’m trying to render the shadow on the composited image.

I think ?? I might also need to add some extra matte node(s) to capture just the shadow of the monkey / object.
It seems that the shadow channel is now passing on the entire render buffer, and treats the whole buffer as a “shadow”.

Again, I’m just guessing, as I’m groping around “in the shadows” … heh heh.

I think I’ve found an alternative solution for now (though I DO want to learn how to do the node thing).

Using the backbuffer, and “onlyshad(ow)” for the “dummy ground”.

I have it working in 2.49 … not sure where / if the equivalents are still in 2.57

Here is a possible solution: composite_shadows.blend (823 KB)

Notice the material for the receiving plane is set “Shadows Only”, and the alpha channel from the renderlayer containing the plane is used as a mask by connecting it to the Fac input of a Mix-Multiply node. This way only the shadow itself is multiplied with the background image.

This is very bare-bones; the mask could do with some cleaning up and needs better shadow settings, but I hope it can get you started.