Parameters for a Shadows.

interface ShadowsParams {
    autoFit?: boolean;
    bias?: number;
    cascadeCount?: number;
    cascadeSplitLambda?: number;
    direction?: FloatArrayParam;
    intensity?: number;
    lightDistance?: number;
    maxDistance?: number;
    normalOffsetBias?: number;
    padding?: number;
    pcfKernelSize?: number;
    projectionSize?: number;
    renderModes?: number[];
    resolution?: number;
    slopeBias?: number;
}

Properties

autoFit?: boolean

When true, the shadow frustum is auto-sized each frame to tightly bracket the camera's view frustum (clamped to ShadowsParams.maxDistance). This directs the shadow map's texel budget at what the user is actually looking at, dramatically improving effective resolution.

When false, ShadowsParams.projectionSize and ShadowsParams.lightDistance control the frustum manually.

Default value is true.

bias?: number

Depth-compare bias used to avoid self-shadowing ("shadow acne").

Applied in light-space normalized depth units. Default value is 0.003.

cascadeCount?: number

Number of shadow cascades (Cascaded Shadow Maps / PSSM). Higher counts give sharper near-distance shadows while still covering far distances, at the cost of one extra shadow-depth pass per cascade.

Range [1, 6]. 1 disables CSM (equivalent to the previous single-cascade behaviour). Default is 4.

cascadeSplitLambda?: number

Blend between logarithmic and uniform split schemes for the cascade boundaries. 0.0 uses uniform-distance splits (good for near-camera detail density), 1.0 uses logarithmic (good for long-distance coverage). 0.5 is the standard "practical split scheme" compromise.

Range [0, 1]. Default is 0.5.

direction?: FloatArrayParam

World-space direction the shadow-casting light points in.

Default value is [-0.5, -1.0, -0.3].

intensity?: number

The darkness of the shadow where a surface is fully occluded from the light.

Range is [0..1]. Default value is 0.45.

lightDistance?: number

Distance from the scene center to place the virtual light along ShadowsParams.direction.

Default value is 50.

maxDistance?: number

When ShadowsParams.autoFit is true, the far plane of the shadow frustum is clamped to this distance from the camera, in world units. Keeping this small focuses shadow-map resolution on nearby geometry.

Default value is 200.

normalOffsetBias?: number

View-space distance by which receivers are pushed toward the light before sampling the shadow map. Eliminates shadow acne at glancing angles without needing a large depth ShadowsParams.bias.

Default value is 0.02.

padding?: number

Multiplier applied to the auto-fitted shadow frustum's width/height, to pad against cracks at the edges (caused by edge samples outside the fitted frustum).

Range [1.0, ~2.0]. Default value is 1.1.

pcfKernelSize?: number

Side length of the PCF (Percentage Closer Filtering) kernel, in texels. Must be an odd integer in the range [1, 7]. 1 disables PCF (hard shadows). Larger kernels give softer edges at a quadratic sampling cost.

Default value is 3.

projectionSize?: number

Edge-of-frustum dimension (world units) of the shadow map's orthographic projection.

Larger values cover more of the scene but reduce resolution. Default value is 30.

renderModes?: number[]

Which rendering modes in which to apply Shadows.

Default value is [RealisticRender].

resolution?: number

Pixel resolution of the (square) shadow map.

Default value is 2048.

slopeBias?: number

Slope-scaled depth bias: bias has this much added to it as the surface tilts away from the light. Scales linearly with tan(angle(normal, light)), clamped to avoid blow-up at near-parallel angles. Complements ShadowsParams.normalOffsetBias.

Default value is 0.004.