Performs computations for shadow mapping.
A full computation cycle is made of these steps:
Configure the following values according to the current scene settings:
Configure FilterIn. The cull flags of this filter will be used to collect terrain mesh sectors that act as shadow receivers (see ShadowCascade.Receivers).
Configure FilterOut. Sector marks will be output to this filter for the render batches of the terrain mesh sectors that act as shadow casters (see ShadowCascade.Casters).
Optionally tweak the IMeshBoundMinSize.MinSize and IMeshBoundMinRadius.MinRadius settings, to adjust the behaviour of these internally used objects:
This object collects the terrain mesh sectors that will act as shadow receivers. Collecting too many mesh sectors will waste CPU cycles, but collecting too few mesh sectors will reduce shadow frustum fitting, which reduces shadow quality and performance, since more geometry will need to be rendered into the shadowmap.
This object will compute the set of mesh sectors that act as shadow casters and thus need to be rendered into the shadowmap. Tweaking can reduce the number of collected mesh sectors, while keeping the triangle count reasonably low, since mesh sectors usually have less triangles when farther away from the view point.
Call Compute, optionally specifying a collector delegate for additional shadow receivers.
Perform triangulation of the terrain mesh (see Triangulation), including the mesh sector marks of FilterOut.
Render the shadowmap batches (see ShadowCascade.Casters) into the shadowmap, using the shadow projection matrix (see ShadowCascade.ShadowProjection).
Render the terrain mesh and other 3D geometry, using the shadow map texture and the shadow matrix to compute dynamic shadows (see ShadowCascade.ShadowMatrix resp. ShadowCascade.ShadowMatrixLocal).
ShadowMapping objects act as resource handles and produce ShadowMappingResource resource objects. ShadowMapping objects with compatible settings will produce the same ShadowMappingResource resource objects.
Public / Constructors
Creates a new instance of ShadowMapping.
Public / Methods
Public / Attributes
The camera frustum to use for clipping the bounding boxes of the shadow receivers (see ShadowCascade.Receivers).
The relative overlap of the shadow cascades, along the view direction.
The cascade overlap is applied by shifting the far splitting plane away from the view point, by the amount
S = Zfar * O
Zfar is the view-space Z-coordinate of the far splitting plane of the cascade (see ShadowCascade.ViewRangeZ) and
O is the configured cascade overlap.
The cascade overlap is not applied to the last cascade.
The default value is
The fixed Z-range (in camera-space) of the whole shadow volume, before being split into cascades.
This range only influences the Z-slices of the shadow cascades. All collected shadow receivers will be covered by the shadow maps.
If the given range is empty (see RangeD.IsEmpty), the Z-range will be determined automatically from the collected shadow receivers.
The default value is RangeD.Pos.
The output mesh filter that will receive marks for each terrain part that acts as a shadow receiver.
Controls the amount of light-bleeding correction.
Light-bleeding may occur in shadowed areas that have multiple occluders. Defaults to
The camera view direction that has been used for shadow computations.
- See also
The camera position that has been used for shadow computations.
- See also