Parameters for a Shadows.

interface ShadowsParams {
    autoFit?: boolean;
    bias?: number;
    cascadeCount?: number;
    cascadeSplitLambda?: number;
    contactHardening?: boolean;
    debug?: ShadowDebugMode;
    direction?: FloatArrayParam;
    enabled?: boolean;
    intensity?: number;
    lightDistance?: number;
    lightRadius?: number;
    maxDistance?: number;
    normalOffsetBias?: number;
    padding?: number;
    pcfKernelSize?: number;
    projectionSize?: 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.001.

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.

contactHardening?: boolean

Enables contact-hardening shadow filtering. When enabled, the renderer searches nearby shadow-map texels for blockers and grows the PCF radius as receiver distance from those blockers increases.

Default value is false.

Debug output mode for inspecting shadow-map sampling.

  • false disables debug output.
  • true or "factor" shows the final shadow visibility factor.
  • "rawDepth" or "depth" shows raw shadow-map depth for the selected cascade.
  • "cascade" false-colors fragments by selected cascade.
  • "refDepth" shows the receiver reference depth after bias.
  • "bias" shows the total depth bias, scaled for visualization.
  • "blockerDepth" shows the average blocker depth used by contact hardening.
  • "filterRadius" shows the resolved PCF filter radius.
  • "visibility" shows raw PCF visibility before intensity is applied.

Default value is false.

direction?: FloatArrayParam

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

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

enabled?: boolean

Whether this component is enabled. Default is false.

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.

lightRadius?: number

World-space penumbra scale used by contact-hardening shadows. Higher values make separated caster/receiver pairs soften faster.

Default value is 0.08.

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.0035.

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.

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.00125.