Rendering shadows on invisible planes

I’m trying to render a scene over an HDRI, and I can’t figure out how to get the objects’ shadows to show on the ground of the HDRI.

As a general rule, to get special shadows, a new render layer is needed, with only those shadows, and some composition nodes to mix the result.

How would one go about doing this?

Shadow Catcher in 2.78: https://www.youtube.com/watch?v=SiU46VHzEnY

General Shadow Catcher videos:


The latter is the one I learned from. The key point is to have the shadow catcher on it’s own layer.