I made a small shader some time ago. If you apply it to the object than it will cast shadow on top of other object based on Z position.
But, also you can apply it to the layer and get something like this
Never published it, cause I don't think it's finished (visible parameters do work as intended), If you want I can give it to you for a test ride
EDIT: woah! sorry I did not expect those images to be that big..