Cryptomatte Metadata Missing in 2.8

Would someone mind telling me how to incorporate the fix? I just see lots of a code and don’t know how to use it!

Athing regarding this, the layer names / pass names may not need to be changed, because I think other packages lets you pick what layers to apply to cryptomatte like in Blender, so maybe just the underscore option could be enough.

@RainerTrummer have you found the need to change the layer names / pass names or you just needed the underscore option?

If you know how to build blender you have the change what is marked in the upper post in the blender_session.cpp file, but if you don’t know how to build Blender and don’t know a bit of programming you may have trouble trying to do this.

For us the underscore changes we did in the post above were sufficient as far as I recall. But this is due to the fact that Nuke, as Brecht pointed out, changes the pass names on import automatically, and the metadata names then don’t match any longer. For a clean fix, I suspect both should be changed, otherwise this might become a Nuke only fix.

I’ve started working on a patch for this, but am facing some (what I thought trivial) issue: The View Layer could contain characters that are not allowed by external applications like Nuke. In fact, spaces are also converted on import to underscores for the metadata. An obvious fix for this would be to swap out spaces with underscores for the metadata, but that could yield unwanted results: What if a user had a view layer called “View Layer” and at the same time a view layer called “View_Layer” in the scene? Just blindly swapping characters could generate larger turmoil in the long run here.

Needless to say, this problem only affects Nuke (and maybe AfterEffects via ProEXR, I don’t have that so can not test). Fusion reads the EXRs Blender produces today just fine, how to get to the metadata there is beyond me, but I don’t see that this would be necessary either in Fusion.

Regardless of the issue above, does Blender already have a C++ function somewhere in the source code to replace characters in a string by passing a list of invalid characters to it? One that I could re-use in the code?

You’re doing gods work! Would you mind explaining how to change the metadata in Nuke? I used an editMetadata node or whatever it’s called but my technical knowledge isn’t great and blindly changing dots to underscores didn’t do the job for me! What did you do to get it working?

Nothing generic that I know of. Invalid characters very much depends on the specific file format or conventions.

Basically you change the name in the Cryptomatte Metadata that it matches the Layer Name in Nuke.

Lets say the layer name is “RenderLayer_CryptoMaterial00”.
The Metadata name is “RenderLayer.CryptoMaterial”

So you lookup the Metadata in the readnode of the file to see what value of the Metadata you have to change. (Eg.: “exr/cryptomatte/131765d/name”)

Then you create a “ModifyMetaData” Node, use as action “set” choose the right key (“exr/cryptomatte/131765d/name”) and set as value “RenderLayer_CryptoMaterial”.

I thought that was the case. That’s what I did originally. I’ve just tried it again following everything in your screenshot and it’s still not working. I can see the crypto channels with the yellow and green colours but the crpytomatte node doesn’t detect any layers. Any ideas?

If I force update it then it shows the layers how it should but the colour picker doesn’t give an alpha. Something really weird going on. Weirdly if I press unload manifest it spits out all the mattes with the same names as they had in Blender and they’re all correct with the alpha so the information is clearly there somewhere!

You could try to switch to CryptoMaterial and write the name of a shader in the Matte List of the Cryptomatte node. If that works then the cryptomatte is working but something with your picking is wrong? (Btw: Do you pick with ctrl+shift+pick?)

I have provided a first patch here in case anyone wants to test it. As described in the patch itself, I ended up not messing with layer names in the end, and just modify the metadata instead. Changing Layer names produced all kind of side effects, the most common one was making the Image Editor crash on displaying the EXR.

I ended up placing an enumeration in the User Preferences to change the metadata written:

I wanted to place it in the metadata section of the scene initially, but failed to retrieve a scene to do so. The scene variable passed on to void BlenderSession::stamp_view_layer_metadata(Scene *scene, const string &view_layer_name) is something different than the Blender Scene (maybe something already translated to Cycles?), so I could not reach the prop from there.

Anyway, did you guys try download the latest cryptomatte nuke plugin from psyop ? version 1.2.4 .

I have the same problem recently, but I realize that the cryptomatte plugin on my side is old. So I update it to the latest version, and now it work’s, the latest plugin I think already convert it to “_” for Blender exr’s
See the latest plugin here : GitHub - Psyop/Cryptomatte: Cryptomatte Nuke plugin, Fusion plugin, sample images, and specification
Hope this help ! :slight_smile:

2 Likes

I´m using fusion and crypto object from blender is not working. Maybe because I have too many objects(>6000) in may scene. Crypto material is not working if I use a file output node. Only if I render with the main output it works.
It would be nice if it would be possible to use file output nodes in blender with cryptomatte support!

Are you using OpenEXR with 32 bit depth (called float full in the UI) for outputting the images? And a lossless codec? For us file output nodes work fine in that case.

1 Like

Yes I´m using 32bit multilayer exr with the lossless zip codec. In Fusion only cryptomaterial is working from blender if I render to the main output node but not if i render to a fileoutput node. If I use a very simple scene with only a few objects, then cryptomaterial is also working within fusion, so my thought that the object count is the problem.
Are you using also Fusion or Nuke?
Photoshop (with exr_io 2.01 plugin) has also a problem when I use an file output nodes. The main output works fine! In Photoshop cryptomaterial and cryptoobject from blender works fine.
I tested also After Effects (proexr 2.0 Plugin) and it has no problem with cryptomattes and the blender file output nodes. Cryptoobject and cryptomaterial work fine.
So my conclusion is, that every plugin interpretes the rendered informations within the exr different. Hope this problems will be solved soon!

1 Like

We’re using Nuke here, but don’t use to have scenes with such a high object count, we typically don’t exceed 3.000. Do the Cryptomattes you have generated work within the Blender Compositor?

Yes in the Blender compositor cryptomattes work normal. If I wish I can output b/w mask but thats so slow. For us the blender compositor is no option and nuke too expensive :slight_smile: .
We import all the cad-parts of cars. Unless we are beneath 22million polygons everything works fine in blender.

Hi guys. There’s no metadata in exr file regarding cryptomatte or and official dneg cryptomatte gizmo for Nuke can’t extract any matte from it.
example 1 file in 2.79 and 2.8


how I can fix it?

1 Like

it looks like no one has an answer to that.