Dear GOD is there a simple way to render ID passes in Blender yet?

Thanks.

I haven’t tried Cryptomatte Tools, I came across the plugin when I was troubleshooting this issue, but didn’t realize it had an clown pass generator, that’s great to know, would’ve saved me time.

My suspicion though is that it’s going to work exactly like my script and doesn’t scale with large scenes with thousands of objects / materials because it’ll need to create thousands of cryptomatte nodes. My script creates the nodes, but once the render finishes, and the compositing process starts blender crashes if the scene is huge. I’m going to dig deeper into that tomorrow if I can’t make it work I’ll try the plugin. Then if that fails, I’ll have to go with the material override script.

Not gonna lie though, it does feel like basic functionality that should be baked into blender, other programs make this really easy to do.

AOV in cycles might work…

first add an AOV :
image

then in each materials add something like that :

Then for each objects set a different Object index :
image

Finally you can access the AOV pass here :

White noise sometimes produces colors that are quite close , you’ll have to change ID number or use another technique to create random color…

Eventually mamy stuff can be automated with a script so you just have to press one button to setup / update the scene…

Have fun !

My workflow for solid colors is:
1- Change render engine to Workbenck
2- In each material select the color you want in Viewport Display
3- In render tab change Lighting to Flat
4- Press F12 to render

Done, you have solid flat colors selected by you.

Yes, this is a handy solution for the Object Index, but not the Material Index.

And yes the previous post is doable, but its just stupid, that Cycles cant provide us with 2 most basic clown passes ever. Yes I can add nodes to every material (have fun with a city scape etc), and even switch numbers. But how come every other renderer has this feature and Cycles resists adding it?

Otane is converting their engine to an addon (in beta now) when they are done, it’s going to be way faster to switch the renderer and let it render Info passes (which don’t need to calculate the light) than anything native in Cycles - which is just absurd!

That’s a very suitable name. The effectiveness of them is laughable. Why have some functionality that does not work?.. Cryptomatte is for masks. It’s not perfect, but clown passes are just an extremely bad idea in pretty much all circumstances. You should not use them ever. Why doesn’t Cryptomatte work in your workflow?

Long time ago I ran a little script that set each objects and materials ID and then it was just a matter of remapping the ID passes between 0 and 1 and run them through a colorful coloramp in the compositor, as a result it was super easy to produce clown passes for each shots.

Well probably several reasons, first it’s not that difficult to automate the step I talked about before, could be an addon ?
Secondly there is already the old school ID passes and ID select node, and the newer cryptomatte, so adding a third option which doesn’t bring much more benefit is probably seen as redundant or very low priority.
In the end, core devs are generally too busy with work only them can do, small feature additions are generally waiting for a community contribution since if it’s easy to do in blender it’s probably easy in the code as well.

@MartinZ a bit earlier in the discussion someone talked about using colored IDs to do very quick and dirty selection when doing concept art. Doesn’t have to be perfect but rather easy to use and produce.
Then it makes sense, since generally Cryptomate doesn’'t fit very well in paint app, it’s also obviously slow to jump back and forth between say photoshop and blender just to extract masks with cryptomatte.

Hey guys, I wrote a Python package that decode Cryptomattes in EXR files to PNG masks that looks like ID Pass.
Can someone help me test it?

So, why not use the “pick” output of the crypotmatte node? If needed, run it through a color ramp.

it looks that it could work, IDK how cryptomattes really works, but since each color is a hash, and that it requires 3 passes it might behave a bit differently than a proper ID pass.
But at first glance it seems to work indeed !

Hmm… I just tried it and unfortunately the colors seem to be too similar if you have enough objects and some just turn completely black. I wonder if it would be possible to map range the “pick” output to something between 0 and 1 somehow and then send it through a color ramp.

Arf ok ! Thanks for reporting !
A really dirty way would be to use the normalize node on the pick output, not the normalize operation on vector math, but the compositor’s normalize node.

But it’s really prone to error since depending on what’s on the screen the value will changes…
Therefore, it might be worth considering that solution : Dear GOD is there a simple way to render ID passes in Blender yet? - #42 by sozap

Or exporting a workbench render with random color objects…

That said, there is always a risk to get very similar colors, but if you export the IDs in 16bits and with a very low threshold to pick the color that should work anyway !

Hmm… If you separate the Color of the Pick outpout and normalize each channel individually this actually seems to work. At least with these 400 cubes I wasn’t able to find two with the exact same color when trying to select them in Affitnity Photo:

Well done !!

Keep in mind tho, the way the normalize node works makes it impractical for animation, if some objects enters or leaves the frame you might get some changes in colors which makes that technique super useful for still frame, but a bit risky for animation !

Ah, damn, you are right of course. Forgot about that.

Replacing the normalize nodes with map range nodes (they have to be clamped) removes that problem. But I am not sure how to determine which value to use as the “from max” value. 2 seems to work fine with 400 objects but I am not sure how it holds up with more objects.

yes ! well done ! yeah at this stage it looks like some knowledge on how cryptomattes works is needed to set a correct value…
Too bad the white noise texture isn’t available in the compositor as it would have probably solved the issue right away.

anyway, it’s a kind of a pick your poison situation, all in all cryptomates are the best option, and if you really need a clown pass that you can use without any plugin it’s going to be a bit clunky around the edge and limited …

Yeah, I would allways prefer cryptomatte. This was more of “can it be done” thing.
Anyway, I just tried a the setup with 25K objects and it still seems to hold up.

If you really need clown passes, you are really doing something wrong :smiley:

Lol this has already been said and answered earlier in the thread…
Sometime alternatives are useful and it’s a fun learning opportunity, even if I agree with you that cryptomate remains the best solution, sometime we have to
Let It Go Disney GIF

I’m a crypto matte guy, but when I want to quickly assign some Ids (for example to jump over into Substance Painter)…here is what I find quick and easy.

Blender Guppy’s “Creative Flow” addon has a collection of operators that makes it easier to assign, select or pick vertex colors. Those vertex colors, of course, work as Ids in Substance Painter.

Just thought I’d add this to the broader discussion.