Mask an object based on the shadow it's receiving?

With Forward Rendering maybe you could use this approach: link