UPDATE (1): Look at the section with the same title. 

In this small r&d project I was trying to figure out compositing of  shadows in a scene using render-layers and render-passes.  The attached screen-shots  depicts my current status. Its pretty self explanatory, but I have/will-be adding notes in brief beside the screen shots.

The compositing node-network

Diffuse pass (DP)                 

Shadow pass (SP)                 The shadow pass was rendered in its own layer.                                                                                                                                                                                                                                        

          

The following screen shots are result of compositing the diffuse and shadow passes by using different/node-settings (refer to the node-network above).

 

Apply "Darken" filter (with Fac: 0.5) to DP and SP


To the DP and SP, Apply "Darken" filter (with Fac: 1.0)  OR

  • apply "Darken" filter  and connect the SP Alpha to Fac.                                                                                                                            

 

Apply "Sharpen" filter to SP. Then apply Darken filter to the DP and sharpened SP. Do not forget to connect the shadow pass Alpha to Fac.                                                                                                                                                                                                                                                          

Apply Blur to SP. Then Multiply the DP with the blurred SP with a Fac value of 0.5. By varying the value of Fac, you can control the intensity of the shadow.                                                                                                                                                                                                                                                                                                                                     Update (1): Compositing the occlusion pass    

I have changed the color of the ground plane, did some more tests and finally composited the occlusion pass after compositing the diffuse pass and shadow pass.


This is the occlusion pass rendered in a separate layer. I have used 10 samples for AO.

Below is a split composite of the image.  To the right is the final composite after overlaying the occlusion pass on the sub-composite of DP and SP.  To the left is the final composite after applying a "RGB Curves" node on the occlusion pass.