Cryptomatte - Wrong Socket Names?

Unless I’m missing something, the socket names of the Render Layers node for the Cryptomatte passes are wrong. It should be numbered with increment by one, matching the layer name as described in the specification. Internally they are numbered correctly as can be seen in BlenderSync::sync_render_passes() ( blender_sync.cpp ), however register_passes() ( engine.py ) does an increment by two.

I first noticed the odd numbering when it was mentioned by Dylan Neill and I looked deeper into to in order to answer this question by vklidu on Blender’s StackExchange.

Looking at the code again, the increment by two is correct in regards to the number of passes, since there are two ranks per layer or in other word half as many layers as there are levels. However the displayed index should be divided by two.

Instead of

if crl.use_pass_crypto_object:
    for i in range(0, crl.pass_crypto_depth, 2):
        engine.register_pass(scene, srl, "CryptoObject" + '{:02d}'.format(i), 4, "RGBA", 'COLOR')

it should be

if crl.use_pass_crypto_object:
    for i in range(0, crl.pass_crypto_depth, 2):
        engine.register_pass(scene, srl, "CryptoObject" + '{:02d}'.format(i//2), 4, "RGBA", 'COLOR')

The diff can be seen here.

Please ignore the wrong explanation that can be found in the edit history. The number of levels are obviously identical to the number of ID-coverage pairs per pixel.

This is now fixed with commit https://developer.blender.org/rB3f3d1ad4800c6d5e9d1a45912841b118cbac9f39.

2 Likes