@pixi/3d
    Preparing search index...

    Interface LightShadow

    A light's shadow settings, as Light.shadow holds them

    The same fields as LightShadowOptions, with the defaults filled in. Setting both bounds and cascades here isn't a type error; cascades win and a warning says so.

    sun.shadow.cascades = 3;
    sun.shadow.maxDistance = 60;
    interface LightShadow {
        bias: number | undefined;
        bounds: Box | undefined;
        cascades: 1 | 2 | 3 | 4 | undefined;
        lambda: number;
        maxDistance: number | undefined;
        normalBias: number | undefined;
        update: number | number[] | "manual";
    }
    Index
    bias: number | undefined

    Depth offset that keeps a surface from shadowing itself, or undefined for 0.001

    It is a fraction of the shadow map's depth range. Raise it if lit surfaces show stripes of shadow (shadow acne); too much makes shadows start away from their casters.

    sun.shadow.bias = 0.002;
    
    bounds: Box | undefined

    World-space box a directional light's shadow covers, or undefined to fit the box to the scene's shadow casters

    The fitted box follows the scene, so castShadow: true alone gives a well-sized shadow; past 256 shadow casters, see Light.fitShadowBounds. A box you set is read each time the shadow redraws, so moving it, say to follow the player, costs nothing extra. Only surfaces inside the box are sure to get shadows from this light. Ignored when LightShadow.cascades is set.

    sun.shadow.bounds = Box.fromCenterSize(player.position, 30);
    
    cascades: 1 | 2 | 3 | 4 | undefined

    How many slices the camera's view is cut into, each with its own shadow map, from 1 to 4; undefined for a fixed box

    Directional lights only. More cascades keep distant shadows sharper, at the cost of drawing the shadow casters once per cascade. 1 follows the camera with one map.

    sun.shadow.cascades = isMobile ? 2 : 4;
    
    lambda: number

    How the distance is shared out between cascades, from 0 to 1

    0 gives every cascade an equal slice. 1 gives the nearest cascades the thinnest slices, so the shadows closest to the camera get the most detail. Cascades only.

    sun.shadow.lambda = 0.8;
    
    maxDistance: number | undefined

    How far from the camera the cascades reach, in world units, or undefined for 50

    Cascades only. They never reach past the camera's far plane, so the far value caps this. A shorter reach gives sharper shadows.

    sun.shadow.maxDistance = 30;
    
    normalBias: number | undefined

    Offset along the surface normal that keeps a surface from shadowing itself, in world units, or undefined for the default

    A surface the light only grazes moves this far along its normal before its shadow is looked up, and a surface facing the light barely moves. The default is three shadow-map texels for a directional light, so it follows the shadow's resolution, and 0.15 for a spot light. Raise it if shadowed surfaces show striping; lower it if shadows pull away from their casters.

    sun.shadow.normalBias = 0.05;
    
    update: number | number[] | "manual"

    How often the shadow redraws

    1 redraws every frame and N every Nth frame. 'manual', or 0, draws once, then again each time Light.refreshShadows asks. With cascades, an array gives each cascade its own rate, and a cascade the array leaves out redraws every frame. Slower rates suit a scene that doesn't move.

    sun.shadow.update = [1, 2, 8];