Cryptomatte to Mat ID pass

HI,
I am trying to get a Mat ID pass working and I am trying to get the data out from a crypto pass. And I seem to be able to get the information out, but the limits is the number of colors from the cryptomat pass. Is it possible to get more out from it, or does anyone have a way forward?

Hmm… You are supposed to plug a viewer into the “pick” output. Now you pick a material by clicking on the “+” in the node and then on an object in the rendered image. Then you plug a viewer into the “matte” output and check if you got the right one and use the matte output for whatever you intended to do.
Or you can paste the name of the material. You can also pick multiple objects in one node or paste multiple material names. You have to separate the names by a comma.

If you have very many materials you might have to enlarge the “Levels” setting in the Cryptomatte Passes setting in the Properties panel. But default Levels are 6 which is more than enough for the amount of stuff you have going on in your scene.

Don’t let yourself get fooled by all the white objects in you picker image. They are all different whites. You can press the “+” symbol in the Cryptomatte Node and hover over an object. The name of the material will pop up and you can see that objects that seem to have the same white are acutally different.

Thanks Lumpengnom, I know how to use the Cryptomatte pass. But I want to create a Mat ID Pass for my artist next in line here at the office. And they want the Mat ID pass separated in a PSD delivered from me. As this is a non existing function in Cycles I am trying to make one.
Yeah, I have also made the discovery that there is more information/colors in the “pick” in Cryptomatte, but the problem is that it does not show. I was trying to make a random colors solution, but I could not find a way to to that.

Do you want a single image with a lot of different colors also know as “Clown Pass”? Or do you want separat layers for each ID?

If you just want to be able to differentiate between cryptomatte color visually just plug in a bunch of “normalize” nodes between your separte and combine nodes.
the normalize node simply remaps down the values of you colors to a range between 0 and 1.

Yes, I think V-Ray calls it Clown Pass, Octane calls it Mat ID. But yes, an image with many colors to be able to select by colors in PS.

It looks correct at your end, I tried to copy it and got this result.

The colors seem similar but different enough to pick them in PS?

Or you set up MatIDs per material, either by hand or script, and then use a normalize node and color ramp to distribute “random” colors. That way you have some control over it. Note that the color ramp in my example is set to “HSV” and “far”

I think this should also work by taking the Value from the Cryptomatte Pick Output:

Thanks, Do you have a Script to get that IndexMA in the render Layers node ?

For setting up the Indices of the Materials you can use something like this. Note that it will overwrite all material indices in the whole scene you have set up without warning.

import bpy

mat = bpy.data.materials

counter = 0

for i in mat:
    counter = counter + 1
    i.pass_index = counter
1 Like

I found that you can have a material in the Material Override slot, and I made that one with a random color solution. That seems to make the cut.

Also a possiblity. Note that you can put that on a separate view layer and render it at the same time as your normal render.

Anyway, I don’t think you will get per material colors this way, only per object. Or is there way?

Hello everyone, I dealt with the same problem. I was looking for the equivalent of a Material ID pass from Vray for post-production in Photoshop. The output from Cryptomatte has very poor quality edges if it is not used directly in the composer. That’s why I created my own addon:

You can easily and simply get the material or object Id. I use this addon every day for Archviz. Feel free to try.

Thanks, this was another great response. This community seems awsome (new here). I will buy your addon, that will solve everything regarding MatID for me I think.

1 Like

Just bought it :slight_smile: It works great. I just stumbled up on a material that does not work like the rest. And it works in my cryptomatte flow. Maby something you would like to look at?


1 Like

Thank you very much for the report. Does the material have any alpha channel or anything special? Thank you!