created: March 18, 2009
Occlusion is a fast and simple method to simulate the effects of global illumination. Ambient occlusion is most often calculated by casting rays in every direction from the surface. Rays which reach the background or “sky” increase the brightness of the surface, whereas a ray which hits any other object contributes no illumination. As a result, points surrounded by a large amount of geometry are rendered dark, where as points with little geometry on the visible hemisphere appear light. The soft appearance achieved by ambient occlusion alone is similar to the way an object appears on an overcast day. So what basically this shader does is try to re-create the effect of ambient occlussion. It is moderately low on render time, and has significant advantages in the final look of an image. The mib_amb_occlusion node come with a variety of attributes to customize the final rendered AO image.
First off the ambient occlussion node is a mental ray node so, so u would require the mayatomr plugin to be enabled. The ambient occlusion node can be found in the Hypershade under Create > MentalRay Textures > mib_amb_occlusion.
There are various ways to connect the mib_amb_occlusion node to the desired object.
1. The first is the preset that comes with maya`s render layer system, which makes a surface shader and connects the mib_amb_occlusion node to the surface shaders outColor.
2. In this case one can connect the mib_amb_occlusion node`s outValue to the ambient or Incandescence of any desired shader. The connections are the same as above expect for the fact that u would not connect to outColor but to ambient or Incandescence.
3. One can also connect the mib_amb_occlusion node to the shading group of a material, the the shading groups attributes there will be a mental ray tab with a field called Material Shader.
Controls the overall quality of the occlusion. Increasing the number of samples will reduce noise and give u a smoother render, the higher the number the more expensive the render cost. It quite easy to go overboard with this attribute, so know when to quit. Default - 16
These two sliders control the lightest/darkest color of the occlusion. It can work as a clamp to keep the black and white range under a limit or one can change the colors for other desired looks. Default - White/Black
Spread is the basic dropoff between the bright and the dark colors in the occlusion. A higher spread will require more samples. Default - 0.800
This attribute is only useable if the max distance is not equal to zero. It is basically how fast the occulussion effect with die out with have over the distance. Default - 1
When turned on, the occlussion will show up in the alpha channel, For this to work u will have to use the 3rd step in connecting the shader to the ShadingGroup Node. Turn on Pass Custom Alpha Channel in the Render Settings > MentalRay Tab > Under Custom Entities.
For the next two options to work i.e id_inclexcl and id_nonself, all your objects need to be assigned with id numbers, and these id numbers need to be added in a new attribute called miLabel. So for the below to options to work you will need to add an attribute to each and every geometry in the scene, and give it an id number.
I have made a script for this purpose called crAssignID that lets u add the attribute and assign id numbers to a group of selected objects. It has a couple of helpful options and can be found below, or looking into the scripts section of this blog. /scripts/maya/cr_assignid/
This is basically an include/exclude from occlusion. 0 means that this attribute will have no effect. Same value as the miLabel means that only those objects can cause occlusion. A Negative value of the miLabel means that those objects will not cause any occlusion.
This is basically an self or non self occlussion option again 0 means this attribute will have no effect. Same value as the miLabel means that those object will not self occlude.
This is difficult to explain how these two attributes really works, you will just need to try it out yourself. If u have any problems please leave a comment :)