I would like to render just the alpha channel in an animation, in order to use it as a matte when editing video.
How would I go about doing this?
I would like to render just the alpha channel in an animation, in order to use it as a matte when editing video.
How would I go about doing this?
I personally would make the background 100% black and the objects in your scene completely white (with an emission shader with R,G, and B = 1
and strength 1
). With this method you have very short render times and you can use the resulting "binary" images as a factor input later on.
If you have other materials on you objects and don't want to change them you can use a separate render layer with an override material and disable the normal render layer.
The Combined Pass includes an alpha channel:
The Render Layers Node has an Alpha output for it:
If using Cycles make sure to enable Film > Transparent in the Render Context.
If using Blender Render make sure to enable Transparency in the Materials Context.
There is no need to change the material for all the objects in your scene!
There is no need to use ID Masks for this either.
There are cases where using an ID Mask will cause you problems, for example if your materials have transparency. Observe this tree. Its leaves are texture planes, so if you use an ID mask you will only see the outline of the planes.
If rendering glass with a transparent background in Cycles, see this.
An elegant way to do it is to use masking and nodes.
First you need to select an appropriate 'pass index' in 'object'
Then activate the 'Object index pass' in 'Render Layers'
An finally activate the 'use nodes' option in the node compositor, adding an 'ID Mask' node, fill the appropriate ID of the object you want to use as a mask, and voilà !
The advantage is that you can directly render your scene dynamically, with the mask activated on it, without making all the background black, and can directly use a mask inside a full scene.
Change the pass index of all the objects in your scene to 1.
Go to the render layer tab, and uncheck all the passes except for object index.
Go to the node editor -> compositing tab, enable use nodes, and connect the indexOB output to the image input.
That's all. When you press F12, you will get this: