ShadowCascade

Description

sealed class Tinman.Engine.Components.ShadowCascade

Represents a shadow mapping cascade.

See also

ShadowMapping

Public / Attributes

Casters


[Constant]
public attribute Casters → (get)

value : IBatchRenderer<SectorBatch>

[not-null]
The render batches for the shadowmap.

The Batching object that holds the batches for rendering the terrain shadow casters into the shadowmap.

Mesh sectors outside of the light frustum have been culled away. The remaining mesh sectors have been marked explicitly.

Filter


public attribute Filter → (get)

value : MeshTreeFilter

[not-null]
The shadow frustum filter.

The mesh tree filter that represents the terrain parts within the shadow frustum.

Index


[Constant]
public attribute Index → (get)

value : int32

[>=0]
The zero-based cascade index, see ShadowMapping.CascadeCount.

The shadow cascade index.

Is​Empty


public attribute IsEmpty → (get)

value : bool

true if this shadow cascade is empty, false if not.

Is this shadow cascade empty?

Receivers


[Constant]
public attribute Receivers → (get)

value : BoxSoup

The shadow receiver bounds.

The clipped box soup that represents the bounds of all shadow receivers.

Shadow​Frustum


[Constant]
public attribute ShadowFrustum → (get)

value : HullFrustum

[not-null]
The shadow frustum (will always be the same object).

The fitted frustum in terrain-space that contains all shadow receivers and casters.

The plane at index 0 (see IFrustum.PlaneAt) is perpendicular to the light direction and represent the far clipping plane. The other planes are parallel to the light direction vector and form a convex hull.

An object is a potential shadow caster if it intersects with the shadow frustum.

Shadow​Hull


public attribute ShadowHull → (get)

value : IShape

The hull shape or null if empty.

Returns a vector shape that represents the convex hull of all shadow receivers and casters in shadowmap-space (see ShadowMatrix).

The convex hull is not needed for shadow-mapping, but it is useful for visual debugging.

Shadow​Matrix


public attribute ShadowMatrix → (get)

value : Mat4D

The transformation matrix from terrain-space to shadowmap-space.

The shadow matrix that transforms terrain-space to shadowmap-space.

The shadowmap-space is defined as follows:

X := texture U-axis, [0..1] => left to right
Y := texture V-axis, [0..1] => top to bottom
Z := texture sample value, from 0 (near) to 1 (far)

Shadow​Matrix​Local


public attribute ShadowMatrixLocal → (get)

value : Mat4D

The transformation matrix from local terrain-space to shadowmap-space.

The shadow matrix that transforms local terrain-space (i.e. centered at view point, see ShadowMapping.ViewPoint) to shadowmap-space.

The shadowmap-space is defined as follows:

X := texture U-axis, [0..1] => left to right
Y := texture V-axis, [0..1] => top to bottom
Z := texture sample value, from 0 (near) to 1 (far)

Shadow​Matrix​Optimize


public attribute ShadowMatrixOptimize → (get,set)

value : bool

true if the shadow matrix (see ShadowMatrix) shall include a homogeneous 3D transformation that aligns the edges of the convex hull of the shadow frustum to the shadow map edges, false if not.

Enable hull optimization for shadow matrix?

Defaults to true.

Shadow​Matrix​Perspective


public attribute ShadowMatrixPerspective → (get,set)

value : bool

true if the shadow matrix (see ShadowMatrix) shall include a homogeneous 3D transformation that adds a perspective distortion which optimizes the distribution of shadow map samples, false if not.

Enable perspective transformation in shadow matrix?

Defaults to true.

Shadow​Projection


public attribute ShadowProjection → (get)

value : Mat4D

The transformation matrix from local terrain-space to normalized device coordinates.

The shadow matrix that transforms local terrain-space (i.e. centered at view point, see ShadowMapping.ViewPoint) to normalized device coordinates.

Normalized device coordinates are defined as follows:

[+1, 0, 0] := right viewport edge
[-1, 0, 0] := left viewport edge
[0, +1, 0] := top viewport edge
[0, -1, 0] := bottom viewport edge
[0, 0, +1] := far plane
[0, 0, N]  := near plane

where N is either 0 or -1, depending on the value of INearAtZero.NearAtZero.

Shadow​Projection​Max​Z


public attribute ShadowProjectionMaxZ → (get)

value : float64

[>0]
The maximum Z-value.

The maximum Z-value before division by W, produced by the shadow projection matrix (see ShadowProjection) when transforming the shadow receivers point soup (see Receivers).

This value is useful when using a non-linear depth buffer (e.g. a logarithmic one).

View​Range​Z


public attribute ViewRangeZ → (get)

value : RangeD

The Z-range, including the cascade overlap (see ShadowMapping.CascadeOverlap).

The Z-coordinate range of this shadow map cascade, in camera-space.