Using Cryptomatte

Maya Project

Download the Maya project for this tutorial that includes the scene file.


In this brief tutorial we'll see how to set up and use the new Cryptomatte AOVs in alSurface, alHair and alLayer. Cryptomatte, developed at Psyop, is a system that allows you to generate perfect mattes of an arbitrary number of named objects from a single OpenEXR AOV with just a few channels. The generated mattes exactly match the beauty image and can properly handle motion blur and depth of field. As we'll see, generating and using these mattes is incredibly simple.


Install the latest version of alShaders as usual. In the package you will find an additional nuke directory. Copy the contents of this directory to your ~/.nuke directory, or somewhere else in your $NUKE_PATH. For more information on installing Nuke Python plugins, see this video and this video from the Foundry.

Setting Up

First, open the file buddha_planet.mb from the scenes directory in the Maya project. If you render from the camera CAM_render you should get this image:

Our planet of buddhas is already set up with alSurface shaders. No additional changes have been made to the shaders other than setting their colours and specular values, and no extra attributes have been added to the objects. In order to use Cryptomatte, all we have to do is enable the Cryptomatte AOVs, crypto_object and crypto_material and render again.

It is important that you leave the new AOVs set to the same filter as your beauty image (gaussian in our case) if you want the mattes to match your beauty render. You may notice a new filter type, cryptomatte_filter in the filters list. Do not be tempted to use this: it is there to be used by Cryptomatte behind the scenes and selecting it will break your mattes.

Once the render is complete, read the crypto_object AOV into Nuke. By default it will be written to images/tmp/crypto_object/buddha_planet.exr if you've rendered into the Maya render view.

Then create a Cryptomatte node below the Read node from the Tab menu or from the Cryptomatte menu you should find newly added to your menu bar.

If you view the Cryptomatte node in Nuke you should see a human-readable display of the matte IDs in the rgb channels like so:

If you look at the Cryptomatte properties you'll see two color properties called Picker Add and Picker Remove. To generate a matte, click the color swatch for Picker Add so that the little eyedropper icon appears over it, then Ctrl-click (Cmd-click on macOS) on the viewer on the object you want the matte for. You'll see it becomes highlighted in the viewer, and the object's name appears in the Matte List field in the node properties.

Now if you view the alpha channel, you'll see the matte for your selected object

You can add more objects to the matte by picking more colors from the viewer in the same way, or if you know the names of the objects you want to add, you can enter them in the Matte List field directly. If you add an object by mistake, you can remove it by using the same color picking process on the Picker Remove property, or by removing its name from the Matte List.

The crypto_material AOV works in exactly the same way, but for shaders rather than objects. Here I've picked one of the red buddhas to generate a matte for all the objects with the shader SRF_plastic_redSG attached.

And that's really all there is to it! To learn more about Cryptomatte visit Psyop's documentation and their repository. Happy comping!