• deu
  • esp
  • fra
  • ita
  • por
  • rss-icon
  • facebook-icon
  • googleplus-icon
  • youtube-icon
  • twitter-icon

Cryptomatte in Blender 2.8, a revolution [ENG]

In this tutorial in English we will talk about Cryptomatte, one of the most interesting news in Blender 2.8. This feature, which follows the specifications of an open standard that is now common in many programs, allows to greatly simplify the phase of Compositing, facilitating the creation of fast masks, selecting and quickly removing the objects that you want to change, unlike the previous versions in which an object could be assigned in the Compositing editor through the laborious specification of a specific number in the Object > Relations > Pass Index panel.

With Cryptomatte the elements of a scene can be selected mainly according to three modes: "Object", in which each object is selected individually, "Material" in which the objects are selected by material, "Asset" in which it considers objects related to each other (so just select the parent object to also highlight the child objects).

In this tutorial we will talk about how to select with Cryptomatte in various ways, how to crop objects, export masks and how to use multiple nodes simultaneously. A basic understanding of Blender's compositing editor is assumed.

We then create a scene with cubes, on a plane and gray ambient light, in which the light blue cubes have been related to the blue cube.

 

Select with Cryptomatte:

By object:

Now let's select an object with this node, displaying the relative panel located in View Layer > Passes > Cryptomatte where we will check "Object" ("Levels" and "Accurate Mode" we will leave them unchanged as for the case we are considering are not relevant)

In the Compositing workspace we check the "Use Nodes" option, the "Backdrop" option, and add the "Viewer" node to display the results of the operations. Then we start rendering:

We add the Matte > Cryptomatte node and connect the "CryptoObject" outputs, which had appeared in the "Render Layers" node following the activation of Object (their number will be determined by the value of "Levels"), and Image.

The Pick output of the Cryptomatte node (which we have now connected to the Viewer) will provide the objects already divided among them, distinguished by colors assigned by the software, then we use the dropper of the "Add" tool of the node to select one of the cubes and its code will automatically appear in the text box

This automatically creates a mask, which we can display by connecting the Matte output with the "Viewer" node, which will show the cube taken into consideration.

 

By material:

With Cryptomatte we can speed up the work also by selecting through the material; in fact if in his panel we set "Material"

In the Compositing editor we will notice that the "CryptoObject" outputs have been replaced by as many "CryptoMaterial"

We then connect them all to a Cryptomatte node and, by viewing the output of the Pick output, we select with the eyedropper one of the cubes having green material

and we can see, by connecting the Matte mask, that all the cubes with that material have been selected

 

By assets:

When we are working on a complex project, we may need to consider and process with the compositing complex groups of related objects, such as imported resources. Cryptomatte also helps us in this case, through the "asset" option that we can select in the relevant panel

In the compositing editor we can see that once again the outputs of the Render Layers node have changed, as the CryptoAsset outputs have appeared.

We connect all the nodes as in the previous examples and now select, in the pick view of the node, the cube at the top left corresponding to the blue one, which had the light blue cubes to its right as "sons"

In fact, in the Matte view we will see that having selected only the left cube will instead be considered all four objects on the same row

 

Change color to an object:

With the object selection mode seen above, we select the cube corresponding to the purple one

and we use the matte mask to mix the cropped image to the original image, so as to show only the selected cube, to which we will change the color: connect a Color > Hue Saturation Value node to the output of the Render Layers node to modify the hue and we combine it with the image itself, through a Mix node set in fac from the mask coming from the Matte output of the Cryptomatte node.

 

If we now insert 0.8 as the new value of Hue we notice that the purple cube has become green, adapting the colors of its lights and shadows

 

Cut out objects to be reused later:

Sometimes it may be necessary to crop objects to overlay them with other renderings using compositing, or to reuse them at another time using 2D graphics software.
However, after performing the operation, we note that there remains a white border around the cube.

so we make the background transparent, either by deleting the plane below the cubes, or by setting transparent the output of the rendering in the Properties Window in Scene > Film > by checking the transparency option

and we will obtain our well-cut object without imperfections

 

Export the masks:

The black and white masks can be exported and reused in 2D graphics programs, to perform other operations on the same image or on other files. To obtain them, just connect the Matte output of the node to the Composite node and then save the result of the rendering

 

Composition of multiple Cryptomatte nodes:

You can use multiple nodes simultaneously, to make multiple selections for different applications in the same Compositing environment; for example we can assign different levels of increasing desaturation to the second, third, fourth row of cubes (corresponding respectively to the "Cryptomatte 2", "Cryptomatte 3", "Cryptomatte 4" nodes here reduced).

 

As we saw in this little tutorial, the Cryptomatte standard introduced in Blender 2.8 makes it easier, faster (and even fun) to work in the compositing phase, directing even more the functions of this wonderful software to the nodes.

If you liked the article, share it with a friend:

Related Articles:

The new shortcuts in Blender 2.8 [ENG]

One of the novelties in Blender 2.8 was certainly the user interface, where attempts were made to sort and rationalize ...

Read more >

How to add stars background with Cycles in Blender [ENG]

In this tutorial, we'll talk about how to add stars to background with Cycles in Blender; in fact, especially for ...

Read more >