View Full Version : Using objects as masks (passes setup)?

02 February 2009, 08:03 PM
I'm not sure exactly how to set up passes where certain objects act as masks so that it's possible just to render specific objects but when they pass behind the other object they'd get invisible (and that area would be transparent).

So far i've always done some stupid work-around, which is I colored the masking object either constant black or white and then did a key in post but that's just kind of not really professional.

What's the best way to do that?

02 February 2009, 09:42 PM
Object Masks are quite simple with passes:

With the Pass you want to effect as current, select the objects that you want to use as masks. Create a new partition. Select this partition and add an override on the "Surface" of a material on one of the mask objects. Select the Override and open the rendertree.

Plug either a Constant Shader set to RGBA:0,0,0,0 (or for a minute performance gain) use a Color Savestate node RGBA:0,0,0,0.

In that pass the objects in that partition will all be treated as a mask.

NOTE: If you have materials assigned directly to polygon clusters on objects, this will not work.

02 February 2009, 12:17 AM
hey i'm not sure what i'm doing wrong but i did add 'override' from property. i then selected the 'override' node in the passes list tree to access it in render tree but when i tried to plug in the constant shader it didn't let me!


02 February 2009, 02:08 PM
JDEx showed one way to it.

When I need a pass with single objects, I select the objects in the pass that I want to be cut out. Make a partition and shade it with constant black. Set the alpha of the black shader to 0 and you're all set.

When you render, you will see just the object you wanted, with the other intersecting objects knocking out coverage spots.

02 February 2009, 02:32 PM
oh thanks adrencg! totally forgot about that but seems a much easier/ straightforward solution.


03 March 2009, 12:00 PM
There's also the mip_Matte_Shadow shader, not sure how fast it is but it's really simple to use.
It's kinda hidden though, strangely.
In the render tree go to nodes - Illumination - more
then look in this dir
\Shaders\Material\mental images\
There are some other cool ones in there too!

03 March 2009, 08:45 PM
matte_shadow shader is sweet! but as the name implies- it still receives shadows. if you're not wanting shadows, you either want to use the constant material (as suggested already), or turn off secondary rays for the matte_shadow material.

03 March 2009, 10:34 PM
If you turn off catch in the Matte Shadow shader,

It won't receive any shadows :)

CGTalk Moderation
03 March 2009, 10:34 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.