Object ID pass (Eevee)

Greetings!

Note: As a new user, I can’t post more than 1 image in a thread, so, I have uploaded all of those in a Shared Folder in my OneDrive. It’s available here: https://1drv.ms/u/s!AnbnhZfRCIxjnVyBEhO7GfYdzwX_?e=QCu8ML

I’m just experimenting with trying to get an Object ID pass in Eevee. I tried to look over the internet, but, most speak about Cycles and nothing that I found for Eevee, really worked. So, I thought of trying something myself.

I created a scene with 3 objects. I want to get an Object ID pass for easy selection of these in Photoshop. I seperated all of those objects into their individual layers. Then, in compositor, I used the RGB node into a Set Alpha node to get those into individual colours. Something like this:

Please check: 1. Individual Nodes.png

It gives me a render as I wanted:

Please check: 2. Cap.jpeg
Please check: 3. Cup.jpeg
Please check: 4. T-Shirt.jpeg

All good till here.

The problem starts when I try to merge the renders of all the 3 objects into one. I used the Alpha Over node and without changing any of its settings, plugged the first two images in one and used another Alpha Over to merge the output of the last image and the first Alpha Over. I finally connected this to my Composite node. It looks like this:

Please check: 5. Final Nodes.png

The problem is that, firstly, the colours turn out different than what I had set, and secondly, the handle of the cup is cut.

Please check: 6. Render.jpeg

Can someone help me with this by pointing out where exactly I’m going wrong, or the possible reasons why this is happening and if and what I can get the output I want.

P.S.: I can still get the Object IDs by saving those individual renders and then use them to make selections in Photoshop, but, all-combined Object ID pass would be a little more convenient.

You’ve got the right idea but you’re using the wrong method. This might be an easier solution:

Get rid of everything except your render layers. Take the alpha channel from each of the three render layers, and plug them each into a single “Combine RGB” node. That will create the RGB image buffer I think you need.

EDIT: I meant a “Combine RGBA” node, specifically. But you can ignore the alpha and leave it at 1.0.

That didn’t quite work. It just gave me a grey coloured image.


you can use workbench engine just set viewport color for every object individual

1 Like

Let me see the node setup that gives you this result!

That’s probably the easiest way without having to use any compositing. Thank you.

This is it:

I said get rid of everything except your render layers! You don’t need any of that other junk:

Really sorry for misinterpreting.

However, even with the new setup, the output isn’t perfect. I am getting this:

As you can see, the textured image is creating a problem (I have added the images as textures in Substance Painter along with some basic materials from it and used them in Blender as PBR). The colours aren’t flat and for some reason, the handle of the cup is translucent.

Lastly, is it possible to use this setup for more than 3 objects? This was an example scene and so, I just had 3 objects to attach in R, G, and B channel. It might not always be the case.

I think you might have plugged in the “image” channels of the render layers, instead of the “alpha” channels. But I’m going to need to see screenshots to be sure.

Lastly, is it possible to use this setup for more than 3 objects?

Depends on what you mean here-- you can certainly add more than one OBJECT to any collection enabled for any of those three render layers, but they’ll belong to the same render layer and thus will belong to the same channel (or the same “ID”, in your use case).

The image buffers In Blender’s compositing system are vectors consisting four scalar components (Red Green, Blue, and Alpha, implicitly). In other words, when you connect the little yellow dots, there’s four numbers per pixel going through the wires. So you can’t pass more than four independent “IDs” this way, and most image formats only encode three or four channels anyway (RGB or RGBA). And that fourth one will give you headaches.

If you’re looking to export an image format that can contain AS MANY LAYERS AS YOUR HEART DESIRES, see if your external application supports multilayer OpenEXRs. I think photoshop does. If so, just select that format in your output options and you won’t even have to mess with any nodes at all. It’ll save all your render layers separately in a single image file!

1 Like

Also you can use Cycles render engine and get mask from Cryptomatte and use it from Eevee.

1 Like

That’s another way to go about this, thanks.

Yeah, you’re right. Fixed that though.

I had thought so.

I had tried this, but, all I got was a black image (the size of which seemed like it contained all my layers, but, Photoshop opened it as pure black). Is there some setting or some way to get it correctly in OpenEXR or maybe, Photoshop isn’t reading in properly. Which app would you suggest reads it properly?

Update: I used this plugin: https://www.exr-io.com/ and it works now! Thanks all for help.