Because, saving an OpenExr just like that, won’t mean that you’re also including the metadata… And without it, the RGBA layers are meaningless to whatever program that tries to read the file.
does it mean that without the “regular” Multilayer EXR file, that includes all the stuff I also don’t need, there’s no way of exporting the cryptomatte data so that it works correctly in other programs?
You could try to use the OIIO package to manipulate the EXR file (it’s part of the Blender’s API)… I’ve never tried it, but it might work.
But if the only problem is that the original output files are too big, you should try with another ‘codec’… Some have good compression ratios, depending on the type of scene.
Problem 1: you’re renaming the layers. Cryptomatte is looking for very particular layers, with very particular names, and as you can see, AE is finding layers named CryptoMaterial01_#### instead of the ones it’s looking for, which would be the exact names on the RenderLayers node: CryptoMaterial00, 01, etc.
(If what you’re trying to do is add a frame number, that happens up top, in the file path, which is where you specify the file name - those input names in the list just become layers inside the resulting EXR.)
Problem 2: you’re writing to a lossy format. You always want to write to lossless formats when you’re saving data passes like position or vectors, and especially with something like Cryptomatte, which relies on very precise values to function.
Problem 3: you’re baking an AgX view transform into the EXR. EXRs should aways be linear - applying a view transform happens at the end of the entire process. By applying one in the middle, curving and tone-mapping all your values, you’re completely destroying the integrity of the data inside the EXR.
I can’t speak to the specifics of metadata, but I’ve used this exact FileOutput approach successfully for years, and the resulting EXRs work just fine with Cryptomatte in Nuke, Blender, and After Effects.
(Specifically, I usually do two FileOutputs - one for beauty renders, light groups, and other color data, since those can be saved at half-float and/or with lossy compression, and one for data, like position and Cryptomatte, that need to be saved in higher quality—so I’m only paying the cost of that larger file size on the passes that actually need it.)
I thought DWAB to be one of the best codes in terms of quality/compression ratio.
What other do you propose?
I am not familiar with OIIO package, I’ll check out what that is.
When saved “traditionally” I tested cryptomatte with the DWAB codec and it seemed to work fine, but I can’t say I tested it extensively.
I hear you about having lossless frames for data, but I am dealing with 20/30k 6k frames: space is really an issue here.
Maybe splitting the passes into 16/32bit might help there as well.
I’ll check the naming as you suggested. However I thought that if you render an animation, blender is going to add the frame number anyway, even if I don’t add the #####… or am I mistaken?
oh, forgot to mention. About baking AgX transforms, the reason is that I can’t find a way to make colors work correctly in after effects with the linear color space. Would you mind sharing your blender export settings and after effects color space setup to work with linear EXR workflow please?
Set the exr output to rec709 for CC in After Effects, or do something like this: Blender Color Space
or read:
etc.
The compression algorithms depend on the data that must be compressed… All have their own pros and cons (for example, some deal with few but big objects better than others)… You should try them with your scene to see which is the best.
The OIIO is part of Blender and it’s the main library for reading and saving image files. It’s also accessible from Python, where you can perform all kinds of operations with images (reading, writing, modifying, etc). In some ways, it lets you do things that aren’t still available throught the Blender UI (like reading layers from multilayer image files, for example).
You can read the documentation here.
If it works for you, then great! But conventional wisdom has always been that you have to save cryptomattes losslessly, and when I tested it quickly the other day, saving the pass as DWAA or DWAB gave me a broken render: the shapes were artifacted and distorted, and some materials couldn’t be picked at all. So, do that at your own risk, I guess!
And yes, Blender adds frame numbers, but to the file, that’s what I was saying. The inputs below that are just layers inside the file: you want an EXR called MyRender_0015
, with layers inside it called Beauty
, Position
, Mist
, etc. You wouldn’t want the layers themselves to have numbers - if MyRender_0015
had a layer inside it called Mist_0015
, that’s a new layer: it’s not the same as Mist
or Mist_0014
, since they have unique names. They’d be different layers completely, the same way Emission
and Normals
are different layers with unique names.
And Blender doesn’t convert those hash signs to frame numbers anyway (that only applies in file paths), so you’re naming your passes Mist_####
, with the actual symbols. So your passes do have the same name frame-to-frame, which is good, but they have a bunch of random symbols on the end. Which is fine for most of them, doesn’t make a difference, but, again, will break Cryptomatte, since the layer names no longer match the names it’s looking for.
After Effects supports OCIO now, so the simplest way is to simply load in an OCIO config and let it handle everything, the same way things work in Blender. If you’re committed to using AgX specifically, you could load in the Blender config, and things will match. But you could also use ACES, or any number of other configs, or do things manually the old-fashioned way, with Adjustment Layers and OCIO conversions, working at the comp level instead of the project level.
Here’s a linear Rec.709 EXR viewed through AgX in After Effects alongside the same EXR viewed through AgX in Blender—I set AE to use OCIO and loaded the default Blender config (found inside the Blender install). Then you can choose a view transform in the composition panel, while your data stays properly linear underneath, just like in Blender.
And just for context, here’s the same EXR loaded into AE with default settings:
Answering also to your previous answers (and thank you, you’re being a huge help!)
Yes I get what you mean about the hashtags, I wasn’t familiar with the multilayer EXR and I was using it as you would with the single image file per pass workflow. WIth the multilayer you set the name of the container in the file output path, not in the file output “layers”. Got it.
And yes, also with the compression, as I said I didn’t test it extensively, it just looked fine at a first glance.
So, I managed to make it work to be honest, however I think to remember that you get a list of materials or objects to pick from in the AE plugin? the list is blank for me, I need to manually write them down. Not sure why.
As for the AE workflow, yes, I always set the OCIO config file in the project settings, however I guess I do not use the right color transform options with the linear rec 709 images. With the default options my render definitely looks off.
As you can see below, the images are different:
and these are my AE project config settings
I see you have the view transforms set to Display P3/AgX, but it also doesn’t look right here.
This is frustrating topic for me, I’ve been struggling to make linear workflow EXRs look right in after effects for too long now… maybe this is the right time I understand how to do it…
I see you have the view transforms set to Display P3/AgX, but it also doesn’t look right here.
Well, because I have a P3 display. If you’re using something else, that wouldn’t be the correct transform. Nothing special about that particular transform - you should just set your transform to match your display, like always.
So Blender and AE are both set to AgX sRGB in that screenshot? Is your monitor something other than sRGB? Did you try any of the other ones to see if they produced a closer match?
I tried quite a lot of options, not sure if all, but a lot. I couldn’t make it look the same.
My monitor is a philips ultrawide monitor, to be honest I’d be surprised if it’s anything else than sRGB, but I’ll double check.
These are my settings for the beauty pass EXR
And these for the cryptomatte multilayer EXR
Color space settings in blender
this is AE (left) vs blender (right)
Weird! Unfortunately I’m not sure how much more help I can be here, I just tried the same setup again, on a different computer, and once again got a match — I even exported an image from both Blender and AE and sampled the values to confirm both programs were outputting the same colors. So whatever’s happening on your end, I can’t replicate it.
I guess, one other idea, though, just to eliminate the obvious—is your EXR’s input transform set correctly? I noticed when I was setting things up in AE that my EXR had auto-set itself to ACEScg and I had to manually switch it to linear rec.709.
If it’s not that, though, I’m running out of ideas here! As far as I can tell, that setup should be working.
The footage is interpreted as working color space - linear rec.709, which I believe is correct
This is so frustrating, I struggle so much to make things work with after effects, maybe there’s something wrong with my installation… I’ll try on another computer.
Thank you so much for your help!
I must have been doing something wrong. I tried the linear workflow again and it works fine. Thank you so much to everyone and especially to @carterbk , this topic was incredibly helpful.