Select the object you want to use thefor shadow data,go go to the object settingsObject Settings tab,scroll scroll down and enable the Shadow Catcher. Then,if if you want it to overlay it on another scene,make make a second Render Layer and select the scenes you want to use by pressing shift+LMB. Go to compositing and add an Alpha Over node and two RenderLayer nodes. Plug the first layer's Alpha channel into the Alpha channel of the Alpha Over node,plug plug its color into the bottom socket and the second layer's color into the top color socket.