View Full Version : ObjectID as mask/alpha

04 April 2010, 08:02 AM
Hey guys!

I am a new user to Nuke, my first time i've been working with it..

I have a rendered a still image with some a couple a passes: reflection, refraction, shadows and an objectID. At first I wanted to render this as a multi-layered EXR file.. but Cinema 4d can't render this as multilayer.. I tried alot of filetypes TIFFS, PSD, Targa.. TIFF has the option multi layer but It did not do what I expect it to do.. anyways..

Now I have the EXR's as separate passes so I have a couple a files 1 for reflection, 1 for rgb etc.. I have loaded them in in Nuke merged them with Merge-Plus and it works.. the only problem I am having is this: I have an ObjectID rendered as seperate pass but I cant seem to use this ObjectID as a mask or alpha.. Its just a black/white matte.. in After Effects I can use this to generate an Alpha but I have no clue about how to do this in Nuke.. I searched google for this but could not really find something..

I hope someone can help me with this!

04 April 2010, 04:45 PM
First of all, I would avoid using ObjectIDs, as they cannot be antialiased by the renderer. You'll be much better off in the long run rendering RGB mattes for your objects.

However, if you still need/want to use ObjectIDs, you have to render them to an unclamped format (EXR, for example). What ObjectID passes do is store each object as an integer value in R, G, and B (or just a single channel if you're using aux EXR layers), so ObjectID 1 comes out in your render as [1, 1, 1]; ObjectID 14 comes out as [14, 14, 14]; etc. If your output format is clamped, however, all those integers over 1 will just come down to 1, so in essence, you will have created one mask for all objects with ObjectIDs assigned. Not particularly useful...

Once you have your pass rendered to an unclamped format, you can use a Grade/Clamp combo to quickly pick which object to isolate (keep in mind, though, that AA can't be done in the renderer). You can also "fake" some simple edge filtering in Nuke using a matrix set to something like:

[0, 1, 0]
[1, 3, 1]
[0, 1, 0]

04 April 2010, 09:15 AM
I would like to thank you for your reply!

This has worked for me, and also I did not know about object buffers not being able to render with antialias.. but can you explain this rgb matte a little?

Dont really know what you mean by that and/or Cinema 4d is capable of doing this.. if its a better way then ObjectID I want to try this out!

Thanks again for the help!

04 April 2010, 04:04 PM
Well, it's not that object buffers in general can't be AA'ed... just the ObjectID pass due to the fact that if object 8 was overlapping object 1, the filtered pixels would come out with values somewhere around 4 or 5... which would technically be another object.

I don't use C4D, but I'm sure you can do RGB matting. All it means is adding arbitrary render buffers where each buffer contains 3 objects: one red, one green, and one blue. You need these buffers to render with no lighting or shading (full-bright surface color), and then you'll end up with fully AA'ed masks for as many objects as you need.

CGTalk Moderation
04 April 2010, 04:04 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.