Dynamic Lighting & Shadow shader settings

The Dynamic Lighting & Shadows shader provides controls for various properties of the lighting and shadowing process.

To use the Dynamic Lighting & Shadows shader in the scene objects:

  1. In the Asset Browser, navigate to the Templates > Shading Elements > Shaders folder.
  2. Drag the Dynamic Lighting & Shadow shader and drop it onto the object you want to receive shadows.
  3. From the contextual menu, select Replace All by Type.
  4. In the Navigator, select the newly created Dynamic Lighting & Shadow shader under your object.
    You can also copy the same shader to any other objects you want to receive shadows.
    In the following figure, you can visualize the first eight lights in the scene are automatically used by the shader to render shadow maps and project shadows onto the shaded objects.

Transparency Type menu

Transparency Factor

Controls the opacity of the shaded objects. A value of 1.0 is fully opaque, while a value of 0.0 is fully transparent.

Affecting Lights

Defines the set of lights used to light the objects in addition to those which will cast shadows. If no objects are set, then the shader automatically uses the first 8 lights in the scene.

Shadow Map Size

Defines the resolution of the depth map shadows used to store the depth information to compute the shadows. A higher resolution shadow map improves the sharpness of the shadows at the cost of performance.

A minimum shadow map size of 128 pixels is enforced. The maximum size is limited only by the graphics capabilities of the system.

Important: Do not use a shadow map size beyond 8192 pixels.

Shadow Blur

To reduce shadow aliasing, a Percentage Closer Filtering (PCF) algorithm is used to soften the shadow result. This is in effect a blurring algorithm. By default, the shader takes 9 samples per shadow map read. Reducing this value greatly improves performance.

The valid range of Shadow Blur is [1, 9].

Shadow Casters

To control the set of objects that cast shadows, an object list property is exposed on the shader. If you do not specify objects, then the shader assumes all objects in the scene are casters. To achieve the effect of no shadow casters, select only a model that does not have associated geometry data such as a light.

Offset Scale

To amplify the effect of Offset bias. This value is a multiplier for Offset Bias.

Offset Bias

To move the shadow toward or away from the shadow-casting object(s). If this value is too low, then shadows can "leak" through places where it should not occur, producing moire patterns or making out-of-place dark areas on meshes. If this value is too high, then shadows can "detach" from an object. If this value is too extreme in either direction, then shadows might not be rendered at all.

The Offset Bias value is in MotionBuilder units. You can adjust the Bias value depending on the size of the scene, and can range from values close to zero to values in the hundreds.