More about Occlusion(part II)

3D collab class I helped with

The shot above was from the 3D collab class I helped with last quarter.

Since there were all Animation kids in their class, they needed some VSFX help.

I helped them set up almost everything such as lighting, shading, render passes, and compositing.

And a interesting stuff for me was to set up the Occlusion pass with correct refraction in it.

Usually when render the occlusion pass, we exclude all the “glass” and any other “transparency” objects from the render layer.

However, the master layer has been rendered with all the objects(including the refracted objects behind the machine’s glass containner in the shot above), so when it comes to the Occlusion pass, if the Occlusion haven’t been refracted, the final comp will not look correctly.

There are two ways to add the occlusion into the master layer.

1. One easy way to do it is using Mental Ray’s Mia-x material, and turn on the Ambient Occlusion on:

AO in Mia material

AO in Mia material

And all the occlusions will be rendered in the master layer.

2. If user were not using Mia material, it will be a huge pain to change all the shaders to Mia materials..

So the second way to achieve the “occlusion with refraction” is to :

a. Assign the “miLabel” to objects in the scene.

b. Don’t exclude the glass container of the machine. Instead, assign a miLable to the glass such as 2, then set the mib_AO shader’s attribute “ID Nonself” the same as the glass’s miLabel(in this case is 2). When set up like this,  the glass container will not cause any occlusion to other objects in the scene.

c. Instead of connect the mib_AO shader to the surface shader directly, connect it to a mib_refract shader(can be found in the sample composition tab) like this:

use mib_refract shader

use mib_refract shader

set the Refraction value to 1(or lower than one for not 100% transparanted glass), and set the “Index of Refraction” value exactly the same as your glass shader’s IOR value in the master layer(You could even write an expression to connect this two values if you are geeky enough).

After this, we will get the “refracted Occlusion”:

Result of Refracted Occlusion

Result of Refracted Occlusion

Hope this will help.

A little more..

Also, with similar set up, we can play with Occlusion even more. For example, I created the model of the feathers by overlaping poly planes with transparency maps. And with proper set up, I can render the occlusion like this:

AO in Mia material

Feather AO by using similar set up

Give it a try if you want, it’s really fun ^______^.

2 Responses to “More about Occlusion(part II)”

  1. marc says:


    thanks for refract tutorial for AO. i tried as you wrote but with mia material
    set to 1.6 IOR and mib_refract set to same (1.6) the refracts are different/dont match..any idea why? all else is ok….maya 2010.


  2. admin says:

    haven’t checked my blog for a long time… my apology…

    anyway… not sure why, you might want to keep the glass shader’s and same as your refract AO shader..I mean, if you use a mia shader for a glass object, use the same shader to create the refract AO shader as well..

    However, for easier usage of this refract AO stuff, you don’t have to use mib or any other fancy shaders at all, you can even connect the AO texture node into an ambient color of a maya default blinn shader, and map the transparency map into its transparency, it will still work ..

    sorry for the late reply..cheers :P

Leave a Reply