mib_amb_occlusion

 
 
 

Category: mental ray > Texture

Shader Family: Light

Output: Color

Occlusion is a fast and simple method to simulate the effects of global illumination. Occlusion is the extent to which the area above a point is covered by other geometry. This is achieved by tracing a number of probe rays inside the hemispherical area above the point and testing to what extent this region is blocked.

Typical use of this shader is ambient occlusion, where the shader is used to scale the contribution of ambient lighting (which, in turn, may come from a diffuse environment map shader). For this use, the shader should be assigned to the ambient parameters of materials like mib_illum_phong.

Another use of occlusion is reflective occlusion, where the shader is used to scale the contribution from a reflection map. For this use, the shader is generally plugged into an environment or reflection shader port of a material, and the actual environment map image is plugged into the bright parameter. An alternative is to allow the return value of the occlusion shader to modulate the strength attribute of a reflection map shader.

A third use is to create files for external compositing, where the occlusion shader is assigned as the primary material shader on every object in the scene. The output can be used to modulate other render passes to achieve proper compositing in post-production.

This shader may also be used as a light shader. The light source must be an area light of the user type. This generates an "ambient" light source with built-in occlusion.

This shader only depends on base raytracing features provided by mental ray, and does neither use nor benefit from advanced computations like final gathering or global illumination.

Name

The name of the shader node displayed in the render tree. Enter any name you like, or leave the default.

samples

The number of probe rays that will be sent. More rays yield a smoother image. Occlusion mapping is never as smooth as well-tuned final gathering or photons, but is computationally inexpensive.

bright

The color used when no occluding objects are found.

dark

The color used when total occlusion occurs. In most practical cases, it is set to black. For partial occlusion, a gradual mix between the bright and dark colors is returned.

spread

Defines how large an area of the hemisphere above the point is sampled. The value defines a cone around the sampling direction which is narrower for small values and wider for large values. It ranges from 0.0 for a cone that is a single direction, to 1.0 for a cone that covers the entire hemisphere.

max_distance

The range within which geometry is probed. If it is zero, the entire scene is sampled. If it is a non-zero value, only objects within this distance are considered (which makes sampling much faster). Objects outside this range do not occlude at all and objects that are closer occlude more strongly as the distance approaches zero.

reflective

If this option is off, sampling is performed in a cone area based around the surface normal.

If this option is on, the samples are instead distributed around the reflection direction. This generates reflective occlusion which can greatly enhance the realism of reflection mapping.

output_mode

Defines what the returned color is:

  • Mode 0 enables standard occlusion behaviour.

  • Mode 1 enables environment sampling. This changes the behavior of the shader slightly. As directions are probed for occlusion, the current environment is also sampled and weighted based on how occluded that particular direction is. With Mode 1, the output of the function is the gathered weighted environment colors multiplied by the bright color, with the dark color added for convenience.

  • Mode 2 enables bent normals (see mib_bent_normal_env). The average unoccluded world space normal direction is calculated and returned, encoded as a color where red is X, green is Y, and blue is Z.

  • Mode 3 is the same as 2, except that the normals are encoded in the camera coordinate space.

  • Mode 4 is the same as 2 except that the normals are in object space.

occlusion_in_alpha

Puts the scalar occlusion value in the returned color's alpha component, regardless of the output_mode value. The other color components remain as before.

falloff

Only matters when max_distance is a non-zero value. This defines the speed at which the occlusion is attenuated by distance.

Technically, it is a power function applied to the normalized distance from 0 to the max_distance value. The default value of 1.0 is a linear falloff. Values below 1.0 makes the falloff happen more rapidly. Practically, this means that for lower values, occlusion is stronger for short distances (in small corners and crevices) and softer over larger distances.

id_inclexcl

Defines an instance label number for objects as to whether they are considered (included) or not (excluded) as an occluding object by the shader.

A value of 0 means that this parameter has no effect. A positive integer means that only object instances with a label that matches this number will cause occlusion. A negative integer reverses the condition and includes all object instances except those with a matching label.

id_nonself

Works similar to id_inclexcl in that it is an object instance label, but this parameter determines which objects do not self-occlude.

A value of 0 means that this parameter has no effect. A positive integer prevents any object with that label from occluding other objects with the same label.

This is useful for "matte" or "stand-in" objects that represent existing geometry in a photographic background because any inter-occlusion between such objects is already present in the background photo. Simple exclusion by id_inclexcl cannot be used in this case because you want the occlusion cast by "stand-in" background geometry onto foreground geometry, as well as vice versa: only background-to-background occlusion needs to be prohibited.

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License