Using ID Masks for AO


I’m struggling to work out how to use Object ID’s when compositing AO for objects/materials that have different ‘Amb’ settings.

On the wiki page about ‘Render Passes’ under the section about ‘Compositing Ambient Occlusion’ it says:

"To configure your noodle,

1 . First, depending on the AO mode do one of the following: If AO mode is Add: directly use the AO pass. If AO mode is Sub: Calculate AO - 1, or if AO mode is Both: Calculate 2*AO - 1
2 . Multiply the output of Step 1 with the AO energy level
3 . Multiply the output of Step 2 with the material’s ambience value. If you have materials which receive different ambience light levels (0.5 is the default), one would have to create an ambience map based on Object ID)
4 . Multiply the output of Step 3 with the color pass
5 . Add the output of Step 4 to the diffuse pass"

I’m having trouble with step 3. I know how to assign different Object Indexes and connect them to ‘ID Masks’ but i don’t know how to use these to then create the ‘ambience map’ in the compositor using noodles. If someone could point me in the right direction it would be much appreciated.


Use a mix node to multiply 50% gray (this is equal to the 0.5 setting) by the ObjectID mask. This will leave you with an object mask that is still black or zero where there is no object and 50% gray in the area of the object that was formerly 100% or white. This results in the value you’re looking for as long as your grayscale color value matches the ambience intensity.

I’m failing miserably to get this to work. I tried your suggestion RamboBaby, but probably did it completely wrong.

I’m trying to use the information from the 'BlenderUnderground" website on compositing nodes and also that bit of info i quoted early from the blender wiki pages about compositing ambient occlusion.

I got it to work in a previous project where all the materials had the same ‘Amb’ setting, however i can’t reproduce it when i need to use ID masks due to materials having different ‘Amb’ settings.

I’ve attached a simple test blend file aswell as a jpeg of what i’m trying to do. The plane is set to ‘OnlyShadow’ and has full ‘Amb’. The cube has an ‘Amb’ of 0.75

Basically I’m trying to separate out the different passes in order to tweak them as desired.

Hope all this makes sense. Thanks very much for helping


idmaskao.blend (177 KB)

Step 3 assumes that the differing materials are on separate meshes. If they’re not, then only BeBraw’s Material-ID pass can help you (not included in current builds for reasons unknown…much more useful than object ID). Also in step 3 since I placed the objects on separate render layers there was no need to create the Amb map from the ObjectID…the result of the previous operation multiplied by the materials amb value is sufficient.

Here’s an example of what the wiki attempted to explain when AO is set to both Add & Subtract. Forget what I said in my last post about using the mix node to achieve a grayscale intensity…I just find compositing is easier if I approach it from a strictly “Matte Color” point of view…use the math node instead.

Note: The only shadow material/plane seems to be unchanged by this process because the only pass containing any information is the combined pass (R, G, & B all == 0.000, alpha being the only non-zero value).
Attached is the .blend file.


Thanks for the detailed reply RamboBaby. Couldn’t find a .blend file but that’s ok as i think i can work it out from the jpeg.

There was one attached when I posted cuz I even downloaded it to be sure it was there…don’t know what happened.

I tried some other things with the file (like adding color to multiple objects) and it seems that the math nodes won’t work properly for images that are other than grayscale…in other words you will need to use mix nodes with the same mathematical functions applied that are set in the math nodes in the image I posted. It all works as advertized from that point on.