3
$\begingroup$

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?

$\endgroup$
2
$\begingroup$

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.

enter image description here

$\endgroup$
  • 2
    $\begingroup$ Funnily enough, I happened to do just that before you answered. Thanks for the help! $\endgroup$ – Nat Karmios Oct 31 '15 at 12:36
4
$\begingroup$

There is a feature for this

The Combined Pass includes an alpha channel:

Combined Pass - this includes alpha transparency

The Render Layers Node has an Alpha output for it:

Render Layers node has Alpha output

If using Cycles make sure to enable Film > Transparent in the Render Context.

Film Transparent

If using Blender Render make sure to enable Transparency in the Materials Context.

Enabling Transparency in Blender Internal

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.

Comparing render passes on an object with transparent textures

If rendering glass with a transparent background in Cycles, see this.

$\endgroup$
  • 1
    $\begingroup$ Note that the OP wants to render just the alpha channel, this method requires rendering as normal as well which takes extra time. $\endgroup$ – PGmath Nov 22 '15 at 14:26
  • $\begingroup$ @PGmath As far as I know that is a limitation of Blender's design in that the Image output and Alpha output are both generated from the same Combined pass. So unless Blender is clever enough to evaluate when the Image output is disconnected in the Render Layers node and not calculate it (I don't believe this is how it works, but haven't tested), then yeah, I think we're stuck with this. Maybe disabling some of Cycles' Ray Visibility settings for objects, reducing the sample count, or rendering shadeless could be solutions if the rendering is going too slowly. $\endgroup$ – Mentalist Nov 23 '15 at 1:28
2
$\begingroup$

An elegant way to do it is to use masking and nodes.

First you need to select an appropriate 'pass index' in 'object'

add pass index

Then activate the 'Object index pass' in 'Render Layers'

enter image description here

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à !

enter image description here

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.

$\endgroup$
2
$\begingroup$

Change the pass index of all the objects in your scene to 1.

enter image description here

Go to the render layer tab, and uncheck all the passes except for object index.

enter image description here

Go to the node editor -> compositing tab, enable use nodes, and connect the indexOB output to the image input.

enter image description here

That's all. When you press F12, you will get this:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.