A system for managing shadow mapping operations in the rendering pipeline. Handles both directional/spot light shadows and point light shadows with Gaussian blur post-processing.

Constructors

  • Creates a new ShadowSystem instance with the specified shadow map resolution. Initializes shadow map and point shadow map systems, along with framebuffers for texture arrays.

    Parameters

    • shadowMapSize: number

      The resolution (width and height) of shadow maps in pixels

    Returns ShadowSystem

Methods

  • Generates rendering expressions for shadow mapping based on the provided entities and active lights. Creates shadow map render passes for each shadow-casting light and applies Gaussian blur post-processing.

    Parameters

    • entities: ISceneGraphEntity[]

      Array of scene graph entities to be rendered for shadow mapping

    Returns Expression[]

    Array of Expression objects containing the shadow mapping render passes

  • Checks if the light configuration has changed since the last update. Compares the current light types, enable states, and shadow casting states with cached values.

    Returns boolean

    True if any light has changed its type, enable state, or shadow casting state; false otherwise

  • Sets the depth bias projection-view matrices for shadow mapping on all PBR materials. Calculates and applies bias matrices for directional and spot lights to reduce shadow acne.

    Parameters

    • entities: ISceneGraphEntity[]

      Array of scene graph entities to apply the bias matrices to

    Returns void