How to make something render as a mask only?

On this carousel thing I’ve been doing, for some reason when it renders out, all of the video stops, and I just get still frames. So, I’d like to render just the scene with the video screens and then composite it on top of the other render using After Effects. This would make future changes to the videos a lot faster, too.
What I need to do is make everything else --the cylinder, the rotating text, the sphere on the top, as masks so the videos are hidden as they go behind things.
How is this done in blender?

You can do composite them together in blender easily enough. Would save some time too. Anyways, if you have them in separate layers, go to the render layer for your video screens. Then you can use any of the other layers as masks, by ctrl-clicking on the layer. To have all layers as masks, just click AllZ.

To set up the composite, you need to have the render layer for the video screens. Also, you want an input image (which can be used as a video) node. Set the number of frames you want to use in the video. Then alphaover node the render layer on top of the video node. And that should do it.

Thanks! I didn’t get it at first, but it finally sinks in!

@B65ISP : meh, the alpha matte looks rather grainy, don’t you think?

you’ll get a better result if you output frames via .exr (or .png) and enable RGBA

@ the original poster: you should try learning the compositor - it’s useful :slight_smile:

This is part of one frame my rotating soccerball animation. Alpha mask is made with plugin. Without grainy.