Cryptomatte


Cryptomatte is a reliable, render-time image matte generation system, for use with image compositing applications. Created by Psyop, Cryptomatte creates multi-colored ID mattes with support for motion blur, transparency, and depth of field, with no additional render time penalty and write these mattes into EXR files. These mattes, or ID channels as Cryptomatte refers to them, are typically derived from material names (other channels are available as noted below but provide inconsistent results and should not be used). Cryptomatte is a tremendous time saver, especially for complex scenes, as it allows work is focused on shot design and creation as opposed to technical matte generation for compositing.

The following discussion also applies to Cryptomatte AOVs.

Cryptomatte-加密遮罩 - 图1

GETTING STARTED WITH CRYPTOMATTE

Cryptomatte technology is embedded in Octane Render Engine, therefore it is unnecessary to install or download any additional Cryptomatte plugin for Cinema 4D+Octane. However, it may be necessary to download and install Cryptomatte for particular compositing applications, such as Adobe After Effects and Adobe Photoshop. More information on Cryptomatte can be found here.

CRYPTOMATTE REQUIREMENTS

Cryptomattes require that rendered images be saved in the Open EXR(Octane) file format. Cryptomatte information is stored as extra layers of pixels in the rendered EXR file. These channels will need to be extracted from the EXR file for use in the compositing application. The Cryptomatte Channels attribute determines how many ID channels per pixel are allocated. Octane defaults to 6, but should you see issues with the particular Cryptomattes, try increasing the value (must be divisible by two), as this equates to numbered EXR layers denoted with two values (00, 01 and 02, in the case of the default value of 6).

HOW CRYPTOMATTES WORK

Cryptomattes use an ID-coverage paring technique, where one channel represents an area of the image for a given channel, and the other channel represents the coverage of that channel in the image. The ID channel is one object per pixel. The coverage channel determines how much of the pixel is contributed to by the assigned object. These ID-coverage pairs are then ranked to add support for multiple objects per pixel (the ranking determines layer priority of object 1 to object _n, _front to back). That is why the Cryptomatte Channels are always in pairs of two. Keep in mind that Cryptomattes are typically 32 bits per pixel, which adds to resource consumption. That said, this is more of an issue for compositing software than it is for Octane.

When loading EXR files that contain cryptomattes into compositing software with a cryptomatte decoder, it is merely a matter of choosing the different matte ID channels needed to compose elements. As there can be many to choose from, compositors have many options available for shot assembly.

USING CRYPTOMATTE

As mentioned previously, Cryptomattes generate mattes from scene data, either material names or object names, specifically. Other data types are available, but these types do not generate consistent ID channels in Cinema 4D, due to architectural differences between Cinema 4D and Octane, and therefore, these other types should not be used.

Cryptomattes are created automatically once they are enabled, and the type required is specified. That said, if specific types of mattes are required, some additional adjustments can be done in Cinema 4D and the Octane Object tag, and are discussed below.

MATERIAL NODE NAME

The Material Node Name channel is used to create colors by assigned materials. Using the same material on different objects will result in those objects having the same color (ID channel) in the cryptomatte output.

OBJECT NODE NAME

The Object Node Name channel is used to create ID Channels based on object nodes for each object in the scene. For Object Node Name output, the separations are defined by the Layer ID set up in _Octane Object tag > Object Layer tab.** **_Object collections can be achieved merely by assuring that objects have the same layer ID. Unique objects will require unique IDs.

NOTE
This option is valid only with Octane Standalone. The c4doctane plugin does not support this function.

_**
Cloners are a special case: If using Cloners, each clone, or clone portion, will receive a unique color. If this is not desired, the objects to be cloned may need to be simplified or baked down into a single object. Further, if the entire cloner output is to be treated as a single object, then a “Connect + Delete” operation will be required. This will, of course, increase VRAM consumption.

ADDITIONAL PARAMETERS

CRYPTOMATTE CHANNELS

The amount of Cryptomatte channels to allocated. This value must be a multiple of two, as the ID channel and coverage channel must be kept together. When a render starts, Octane collects a number of seed samples, which calculate a Cryptomatte channel distribution. These sets of channels characterize the pixel samples’ properties.

SEED FACTOR

This is the number of samples to use for seeding Cryptomatte. This value gets multiplied by the number of channels specified. This is important, as this value determines the precision of the Crypomatte pixels. For example, if you have several objects potentially occupying the same pixel, and any (or all) of those objects are in motion, you may see artifacts if the channel value is either too low or too high. Low values will result in pitting artifacts at feathered edges, while large values result in artifacts in places with coverage for lots of different IDs.

AVOID THESE PARAMETERS (PRESENTED FOR COMPLETENESS)

  • CryptoInstance - The Cryptomatte channel is based on instance IDs, derived from namespaces of hierarchical groups of objects, such as an asset that has been created with a cloner (depending upon the cloner settings). This option cannot generate stable matte IDs.
  • CryptoObjectNode - The Cryptomatte channel is based on distinct Object nodes. This option cannot generate stable matte IDs.
  • CryptoMaterialNode - The Cryptomatte channel is based on distinct material nodes. This option cannot generate stable matte IDs.
  • CryptoMaterialPinName - The Cryptomatte channel is based on the names of the existing Material pins in the scene. This option cannot generate stable matte IDs.
  • CryptoObjectPinName - The Cryptomatte channel is based on the names of the existing Object pins in the scene. This option cannot generate stable matte IDs.
IMPORTANT
In render settings click “format” and make sure that you have chosen the “EXR(Octane)” Regular EXR or other formats will not work.

SETTING UP A RENDER

In Cinema 4d click **Render > Edit Render Settings > Octane Renderer > Render Passes Tab > Crypto Passes**. You must activate the Enable toggle in this tab in order to activate the Cryptomatte pass, as well as the individual output passes required. Use only the “CryptoMaterialNodeName” or “CryptoObjectNodeName” passes. Do not use any other pass, as the other crypto matte passes such as “CryptoMaterialNode” and “CryptoObjectNode” generate a unique ID/color, using the material/object layer node names and unique node ID. Every time a new node is created inside a node graph it will get a new unique ID (which happens at render time). When you restart rendering, the plugin deletes all existing nodes and recreates them, resulting in new unique IDs, which will cause the cryptomatte ID to change as well. The “CryptoMaterialNodeName” pass is the only pass which produces consistent cryptomatte IDs frame-to-frame and session-to-session, even after a render restart.

Cryptomatte-加密遮罩 - 图2

In Crypto passes click “CryptoMaterialNodeName” and “CryptoObjectNodeName.” After that you are ready to hit the render button.

After the rendering has completed, import the file into the desired compositing application and follow the documented steps for using Cryptomatte in that application.

TROUBLESHOOTING CRYPTOMATTES

CRYPTOMATTES ARE BLACK

Compositing applications must have Cryptomatte support, either built in or via plugin, otherwise Cryptomattes will appear to be black. Cryptomatte data uses a clever RGB encryption system which requires Cryptomatte data to be decrypted and converted into imagery that can then be used for compositing. The following links offer free Cryptomatte decoding plugins for After Effects and Photoshop.

CRYPTOMATTE COLORS KEEP RANDOMLY CHANGING

Only the CryptoMaterialNodeName output is “session-stable,” that is, consistent whenever renders are restarted, or files are reloaded, and rendering is continued. It is not uncommon to have to re-render elements from time to time, and only the Material Node Name will use the ID channel colors across sessions.