Render a matte for a selected part of an object?

Render a matte for a selected part of an object?

mdouglas66J8T
Participant Participant
813 Views
6 Replies
Message 1 of 7

Render a matte for a selected part of an object?

mdouglas66J8T
Participant
Participant

Is there a way to render a matte (object buffer) for a selected part of an object - eg: just the caps of an extruded object?

Ideally I'd love to be able to do that at the same time as I'm rendering my beauty pass. I know how to do this for an entire object using an Arnold Object Mask, but not for just a selected part of it.

Currently to do this, I switch back to the standard C4D renderer and either render out an object buffer, or I add white and black materials to the objects in my scene manually (adding "C1" to the material selection in the example above). Thanks!

0 Likes
Accepted solutions (2)
814 Views
6 Replies
Replies (6)
Message 2 of 7

peter_horvath
Autodesk
Autodesk

You can use an aov_write shader with a passthrough, assigned to the selection.

peter_horvath_0-1663004844250.png

Basically that's what the Arnold Object Mask tag does under the hood, but for the entire shape. 


// Peter Horvath
// C4DtoA developer
Message 3 of 7

mdouglas66J8T
Participant
Participant

Awesome! Thanks very much, Peter. I think I understand the concept behind that, but when I set it up, I'm not getting anything in my AOV render.

I assume that I need to duplicate my object's material and add the aov_write node & passthrough to it, then apply that 2nd material to the object, but with the caps (or whatever) assigned in the Selection field.

Not sure if there's a way to have it generate the AOV, but not affect the object's material (if that makes sense)? Not a big deal either way.

I've attached a zip of my test file. If you'd be able to let me know what I'm doing wrong, that'd be greatly appreciated! Thanks.

0 Likes
Message 4 of 7

peter_horvath
Autodesk
Autodesk
Accepted solution

Your setup is correct, you have to create a new material for the selection with the aov_write shader. Just set the AOV Input to the desired color you want to see in your aov.

You can make the workflow simpler, if you use a Material Reference instead of duplicating the base shader. In that way you just have to edit the object's shader and the selection will use the same.

I just also realized, that the aov_write shader actually has a passthrough input, so you don't need the passthrough shader.

peter_horvath_0-1663055080882.png

 


// Peter Horvath
// C4DtoA developer
0 Likes
Message 5 of 7

mdouglas66J8T
Participant
Participant

Amazing! Thanks very much, Peter. That's super helpful. And using the reference material is great too - that will ensure it will update if I change the material.

One small issue - when I set the AOV colour to white, it doesn't render as pure white. It's a bit grey. See attached. I could fix this in After Effects with a Levels effect, but is there a way to get it to render in pure black and white? Thanks again!

0 Likes
Message 6 of 7

peter_horvath
Autodesk
Autodesk
Accepted solution

It is probably because of the color management. By default the 'ACES 1.0 SDR-video' view transform is used, which has tone-mapping. You can switch to 'Un-tone-mapped (sRGB)' in the render settings.

Or if you want to keep the view transform and you don't actually need a color id, it's easier to change the AOV type to FLOAT (select the AOV object under the <display driver> and change the Data Type), so the view transform is not applied. You can also use an aov_write_float shader instead of aov_write_rgb.


// Peter Horvath
// C4DtoA developer
0 Likes
Message 7 of 7

mdouglas66J8T
Participant
Participant

Perfect! That solved it. Thanks again for all of your help.

0 Likes