Used as a base class to create a shadow map.

A Shadow creates a depth Texture (that can vary based on the light type) and a depth comparison Sampler.

Each Mesh added to the Shadow will be rendered beforehand to the depthTexture using a RenderTarget and a custom RenderMaterial.

Hierarchy (View Summary)

Constructors

Properties

renderer: CameraRenderer

The CameraRenderer used to create this Shadow.

index: number

Index of this Shadow used in the corresponding CameraRenderer shadow buffer binding.

The light that will be used to cast shadows.

options: Omit<ShadowBaseParams, "autoRender">

Options used to create this Shadow.

sampleCount: number

Sample count of the depthTexture. Only 1 is accepted for now.

depthTextureSize: Vec2

Size of the depth Texture to use. Default to Vec2(512).

depthTextureFormat: GPUTextureFormat

Format of the depth Texture to use. Default to depth24plus.

depthTexture: Texture

Depth Texture used to create the shadow map.

depthPassTarget: RenderTarget

Depth RenderTarget onto which the castingMeshes will be rendered.

depthComparisonSampler: Sampler

Depth comparison Sampler used to compare depth in the shaders.

castingMeshes: Map<string, Mesh>

Map of all the parent Mesh casting shadows used to create the depth meshes.

depthMeshes: Map<string, Mesh>

Map of all the depth Mesh rendered to the shadow map.

rendererBinding: BufferBinding

CameraRenderer corresponding BufferBinding that holds all the bindings for this type of shadow to send to the shaders.

Accessors

Methods

  • Render the shadow map only once. Useful with static scenes if autoRender has been set to false to only take one snapshot of the shadow map.

    Returns Promise<void>