It is working now, but there would be one more thing to make it perfect…
Right now the naming of the cryptomatte layers in the metadata is “xxxxx.CryptoObject”.
The cryptomatte image layer in the EXR is “xxxx_CryptoObject”. For the Cryptomatte Plugin in Nuke, the naming of both the metadata and the layer, has to be the same.
So to make the plugin work correctly, one has to change the metadata inside of Nuke.
Would it be possible to change the format of the naming in the metadata to “xxxx_CryptoObject”?
@brecht We internally tested this by simply replacing the '.' with an underscore '_' in the source code. For Nuke, this works just fine and is exactly what we need. We cannot tell however if by doing that we break other stuff (like Blenders own compositor). Do you see a risk in making that change?
Changed code (lines 416 - 428) in blender_session.cpp:
The EXR layers have a . in then, they are consistent and following the OpenEXR specification.
Unfortunately Nuke and a lot of other software does not follow the specification, and renames the layers when loading. Some day we might follow and use the more common convention over the original specification, but this is not something we can change easily.
This could be considered to be a bug on the Nuke side, if it’s going to rename the EXR layers it should take that into account for the metadata as well.
Hello, as discussed in https://blenderartists.org/t/cryptomatte-is-here-amazing/1132013/63
the cryptomattes rendered in Blender Cycles aren’t working in external compositing softwares like After Effects, Nuke and Fusion. Why can’t Blender follow the Cryptomatte specification from Psyop? The sample files from Psyops githup page work fine and have the correct medadata. Please make it work, maybe Lukas Stockner can help? I will also make a bugreport, but it is hard for you Blender developers to reproduce, if you have no copy of After Effects, Nuke and Fusion. But if you follow the Psyop specification it should work!
@brecht if all is needed to make it work inside an external compositing software is to change those (".") dots for ("_") underscores, we may have an option in the cryptomatte settings like “External Compositing” that changes this.
This will help users to be able to use Cryptomatte in external compositing software, something that is pretty common.
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?
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?