Exclude an object from an occlusion render

 
 
 

When using the mib_amb_occlusion shader to perform an occlusion pass, you can choose to exclude one or more objects from the occlusion calculations.

Do one of the following:

Method 1: Hide

  1. Use this method if the object in question does not need to be involved in other trace calls such as reflection and final gather.

    In the object's transform node, expand the mental ray section. In the Flags section, disable Derive From Maya and turn on Hide.

Method 2: Adding miLabel

  1. Use this method if the object in question must be involved in other trace calls such as reflection and final gather.
  2. Add a mental ray label to all transforms that need to be excluded from the ambient occlusion calculations.

    For example, assuming that $targetTransform is your transform, set the miLabel as follows:

    addAttr -at short -longName miLabel -defaultValue <your value> $targetTransform;

    Note

    Set the miLabel to a value that is unique to your scene. In other words, select a value that is not currently being used for other mental ray labels in your scene.

  3. Set the id_inclexcl attribute in the mib_amb_occlusion node to the same absolute value as your miLabel. For example, if you set your miLabel to 8, your id_inclexcl value must also be set to -8.
    NoteYou can set the id_inclexcl to either a positive or negative value. Set it to a positive value so that only object instances with a label that matches this number are included in the occlusion render. Set it to negative so that all object instances that match this number are excluded from the occlusion render.

    For example, if you set your id_inclexcl value to 8, then only transforms with a miLabel of 8 are included in the occlusion render.

    If you set your id_inclexcl value to -8, however, then all transforms with a miLabel of 8 are excluded from the occlusion render.

See the mental ray for Maya shaders guide for more information about the mib_amb_occlusion node.