Page MenuHome

Cryptomatte allows users to manually set odd values, while internally rounding down to the nearest even number.
Confirmed, NormalPublic

Description

Version: 2.82 Jan. 9th & current 2.83 build

How to reproduce:

  1. Select Cycles render engine
  2. Go to View Layer > Passes > Cryptomatte
  3. Increment the Levels value

It increments the value by two (4, 6, 8, ...). If the user enters an odd number, it will still increment the value by two (3, 5, 7...)


The round-down happens in blender\intern\cycles\blender\blender_sync.cpp Line 609

Setting the number of levels to 5 will produce 3 layers as an output on the Render Layers node.

But CryptoObject02 only shows up as an output on the Render Layers node, but not as a pass.

Event Timeline

That it increments by 2 is by design and expected. This is due to the cryptomatte specification itself; each layer that cryptomatte creates internally will keep track of up to 2 different objects/pixel. The increment by 2 is just conveying that concept albeit in a non obvious way.

The only odd thing here, which is a valid UI issue, is that if the user manually sets an odd value, the UI doesn't change it to even. Internally, however, the implementation will round _down_ to the nearest even number; i.e. 7 will become 6 effectively (but it remains 7 in the UI).

Evan Wilson (EAW) closed this task as Invalid.Sat, Jan 25, 12:01 AM
Evan Wilson (EAW) claimed this task.

This is because Cryptomatte uses ID pairs as part of it's specification, storing two IDs per .exr layer

- {typename}00.r​ ​-​ ​ID​ ​rank​ ​0
- {typename}00.g​ ​-​ ​Coverage​ ​for​ ​ID​ ​rank​ ​0
- {typename}00.b​ ​-​ ​ID​ ​rank​ ​1 
- {typename}00.a​ ​-​ ​Coverage​ ​for​ ​ID​ ​rank​ ​1 
 

- {typename}01.r​ ​-​ ​ID​ ​rank​ ​2 
- {typename}01.g​ ​-​ ​Coverage​ ​for​ ​ID​ ​rank​ ​2 
- {typename}01.b​ ​-​ ​ID​ ​rank​ ​3 
- {typename}01.a​ ​-​ ​Coverage​ ​for​ ​ID​ ​rank​ ​3 


- {typename}02.r​ ​-​ ​ID​ ​rank​ ​4 
- {typename}02.g​ ​-​ ​Coverage​ ​for​ ​ID​ ​rank​ ​4 
- {typename}02.b​ ​-​ ​ID​ ​rank​ ​5 
- {typename}02.a​ ​-​ ​Coverage​ ​for​ ​ID​ ​rank​ ​5

See https://github.com/Psyop/Cryptomatte/blob/master/specification/IDmattes_poster.pdf for more details.

Evan Wilson (EAW) added a comment.EditedSat, Jan 25, 12:12 AM

The only odd thing here, which is a valid UI issue, is that if the user manually sets an odd value, the UI doesn't change it to even. Internally, however, the implementation will round _down_ to the nearest even number; i.e. 7 will become 6 effectively (but it remains 7 in the UI).

@Jesse Y (deadpin) That doesn't appear to be the case if I am correctly understanding your comment.

I set it to 5 levels, and I gave me the 3 layers needed.

Ah, but CryptoObject02 only shows up as an output on the Render Layers node, but not as a pass. That is something to report indeed.

Evan Wilson (EAW) reopened this task as Confirmed.Sat, Jan 25, 4:33 AM
Evan Wilson (EAW) renamed this task from Cryptomatte Levels number field increments value by 2? to Cryptomatte allows users to manually set odd values, while internally rounding down to the nearest even number..Sat, Jan 25, 5:44 AM
Evan Wilson (EAW) updated the task description. (Show Details)