On this page

Overview

Cryptomatte is a multichannel image, typically in EXR format, that stores ID and pixel coverage pairs, along with additional metadata that stores the original name of each ID (be it material name, or object name, or any arbitrary user property of your choosing).

It allows you to extract matte based on selected IDs which can be used to mask out specific elements when making minor adjustments in compositing.

The following example illustrates how Cryptomatte is used to isolate gold material and make hue adjustment in COP:

Please see Cryptomatte’s official site for specifications and plugins for popular compositing applications.

Using mantra to output Cryptomatte

  1. Select mantra ROP.

  2. Click on Images > Cryptomatte tab.

  3. Add a layer by clicking on + next to Cryptomatte Layers.

  4. Select the property to generate IDs from. You can use the dropdown menu to choose built-in properties, Material Name or Object Name.

    You can also type in any user string property that are added to objects or materials (using Properties node). See render properties for detailed information on how to add user properties to objects or materials.

  5. Optionally, set Different File to the name of the Cryptomatte image you want to save. EXR format is strongly recommended. If this path not specified, then this Cryptomatte layer will be stored along with primary output.

  6. Render.

See mantra properties for description of each parameter.

Instancing and unique IDs

In order to matte a particular instance among other instances, you need to generate Cryptomatte using a user string property whose value is unique to each instance.

Here’s an example method using Material Stylesheets:

  1. Set up instancing.

  2. Make sure you're using fast point instancing.

  3. Using Attribute Expression (or any method you prefer), give each point inside Instance node a unique integer.

  4. Add a user string property to the Instance node.

  5. Add a root level stylesheet, target Point Instances, override script Render Property using Inline Script, and set up appropriate bindings:

    Example inline script:

    cvex myFn(int id=0; export string myuserprop="") 
    { 
        myuserprop = sprintf("foo%d", id);
    }
    

In this example, the name of the user property is myuserprop. The name of the point integer attribute is mypointid. The unique property values that are generated are foo0, foo1, foo2 etc (the # comes from mypointid attribute).

Note that, in this example, Inline Script was only necessary to convert integer attribute to string property. If you're using a string attribute then you could simply use Attribute Binding and skip the script and data binding altogether.

See Material Stylesheets for more information on how to use stylesheets.

Using Cryptomatte COP

See Cryptomatte COP for more information.

Tips and notes

  • Keep in mind that opacity and transparency are two separate things: Partially opaque materials let camera rays through, while transparent materials obstruct camera rays and cast secondary (refraction) rays. The pixel coverage is computed based on opacity, so you won’t be able to generate matte for objects behind refractive materials.

  • Cryptomatte uses the primary plane’s pixel filter. Custom pixel filter plugins can be used as well, but a filter that reads data from additional image planes (for example, minmax filter reads data from Z plane) are not allowed.

Rendering

Mantra user guide

Basics

Lighting

Next steps

Guru-level

Other renderers