Multimatte is a script for After Effects that makes a new layer with the combined alpha channels of several other layers. You can download Multimatte here.
Multimatte runs as a ScriptUI Panel with a button if you install it like this:
Quit After Effects if it is running. Move the file "Multimatte.jsxbin" to your “ScriptUI Panels” folder, which is located here:
Windows: Program Files\Adobe\Adobe After Effects <version>\Support Files\Scripts\ScriptUI Panels
Mac OS: Applications/Adobe After Effects <version>/Scripts/ScriptUI Panels
Launch After Effects and click Window > Multimatte.
You can also run Multimatte straight from the Scripts folder, or from a launcher utility like K Bar, and in both those cases it’ll just do it’s stuff with no panel.
Select one or more layers and run the script.
It uses the Set Matte effect which works best with vector layers - shape and text layers, and .ai layers with their 🔆 switch turned on. If any of your selected layers won't play nicely with Set Matte (maybe because they're a bitmap layer) Multimatte will give you the option of skipping them or fixing them in some way, before it does it's stuff.
If Multimatte needs to pre-compose a layer, it works just the same as if you selected that layer and clicked on Layer > Pre-compose… and then selected Leave all attributes… so the pre-comp will have the dimensions of the source item, and any transformations will be applied to the pre-composed layer in the current comp.
Be careful when pre-composing. It can sometimes break things like advanced expressions or script functionality.
Your new Multimatte layer will be at the top of your timeline and you can rename it and drag it anywhere you like. It'll only work in that comp.
Tips + FAQ
If you're using Multimatte with it's UI Panel (because you installed it in your ScriptUI Panels folder) then you can hold the Option key to tell the script to turn off the visibility of newly generated Multimatte layers. If you use K Bar, you can send the argument visibilityOff to do the same thing.
Why is there an extra Set Matte effect after the Invert effect that seems to do… nothing? If you use the multimatte layer as an adjustment layer, you'll find you need this. Thanks to Gabriel Gareso for showing us the way.