After Effects: “shadows only” for a layer

After Effects doesn’t have any built-in method of creating a so-called shadow catcher, which means creating a surface that displays only the shadows cast on top of it. In this tutorial we show you a way of working around that limitation: