More about occlusion (part I)

For example, I have a scene in the image below:

screen shoot of the examplescene

screen shoot of the examplescene

when using the MR shader mib_amb_occlusion node, if we want to render a pass that has the occlusion of the sphere rendered with out display it, normally we can just turn the sphere’s “primary visibility” off. It fits 90% percent of this kind of situations.

However, if user want not only the sphere’s occlusion be rendered, but also none of the boxes generate occlusion, it will be problem because if I turn “primary visibility” of all the boxes off, nohing will be rendered, and if not, the occlusion of sphere on boxes and the occlusion of boxes themselves will be rendered altogether, below is the undesirable result I got if just turnning the “primary visiblitiy” off:

rendered image with spheres pri visibility off

rendered image with sphere's "pri visibility" off

Obviously, the occlusion inbetween the gaps of the boxes are sometimes not we want…

This is when the “ID Inclexcl” “ID Noself” attribute come into handy.
Actually, the djx blog has a really good explain to this:

click here

One important thing to notice is that the “miLabel” attribute is case sensitive.

And for sake of  saving time, I wrote a script for assign the “miLabel” attr to all the selected objects.

Again, since it’s a reall small script, I wrote it with Python in Maya:

Click here

Copy the code into the Python tab of the script editor and use it….

After assign the miLabel to the boxes and sphere, I assign all the boxes’ miLabel =3, and assign the miLabel of the sphere to 1.

Moreover, correspondingly, assign the mib_amb_occlusion shader like this:

assign the ID correctly

assign the ID correctly

Then we will get the desired result:

result of correct ID set up in the shader

result of correct ID set up in the shader

With this set up, we can have only the sphere’s occlusion that affect the evironment…..

Leave a Reply