Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::ShadowMapManager::DistributeCascadeInfo Struct Reference

Shadow cascade distribution info. More...

#include <ShadowMapManager.hpp>

Public Attributes

const float4x4 * pCameraView = nullptr
 Pointer to camera view matrix, must not be null.
 
const float4x4 * pCameraWorld = nullptr
 Pointer to camera world matrix.
 
const float4x4 * pCameraProj = nullptr
 Pointer to camera projection matrix, must not be null.
 
const float3 * pLightDir = nullptr
 Pointer to light direction, must not be null.
 
bool SnapCascades = true
 Whether to snap cascades to texels in light view space.
 
bool StabilizeExtents = true
 
bool EqualizeExtents = true
 Whether to use same extents for X and Y axis. Enabled automatically if StabilizeExtents == true.
 
float fPartitioningFactor = 0.95f
 
bool UseRightHandedLightViewTransform = true
 Whether to use right-handed or left-handed light view transform matrix.
 
bool PackMatrixRowMajor = false
 Whether to pack matrices in row-major order.
 
std::function< void(int CascadeIdx, float &MinZ, float &MaxZ)> AdjustCascadeRange
 Callback that allows the application to adjust z range of every cascade.
 
std::function< void(int Cascade, const float4x4 &WorldToLightViewSpaceMatr, float TexelXSize, float TexelYSize, float &CascadeCenterX, float &CascadeCenterY)> AdjustCascadeCenter
 Callback that allows the application to adjust cascade center.
 

Detailed Description

Shadow cascade distribution info.

Member Data Documentation

◆ AdjustCascadeCenter

std::function<void(int Cascade, const float4x4& WorldToLightViewSpaceMatr, float TexelXSize, float TexelYSize, float& CascadeCenterX, float& CascadeCenterY)> Diligent::ShadowMapManager::DistributeCascadeInfo::AdjustCascadeCenter

Callback that allows the application to adjust cascade center.

Parameters
[in]Cascade- Cascade index.
[in]WorldToLightViewSpaceMatr- World to light view space transform matrix.
[in]TexelXSize- Shadow map texel size along X axis.
[in]TexelYSize- Shadow map texel size along Y axis.
[in,out]CascadeCenterX- Cascade center X coordinate.
[in,out]CascadeCenterY- Cascade center Y coordinate.

The main use case for this callback is to adjust the cascade center to to snap it to texels in light view space in scenarios where global origin is dynamic (such as terrain rendering).

◆ AdjustCascadeRange

std::function<void(int CascadeIdx, float& MinZ, float& MaxZ)> Diligent::ShadowMapManager::DistributeCascadeInfo::AdjustCascadeRange

Callback that allows the application to adjust z range of every cascade.

The callback is also called with cascade value -1 to adjust that entire camera range.

Parameters
[in]CascadeIdx- Cascade index, or -1 for the entire camera range.
[out]MinZ- Minimum z value of the cascade range.
[out]MaxZ- Maximum z value of the cascade range.

◆ fPartitioningFactor

float Diligent::ShadowMapManager::DistributeCascadeInfo::fPartitioningFactor = 0.95f

Cascade partitioning factor that defines the ratio between fully linear (0.0) and fully logarithmic (1.0) partitioning.

◆ StabilizeExtents

bool Diligent::ShadowMapManager::DistributeCascadeInfo::StabilizeExtents = true

Whether to stabilize cascade extents in light view space, so that they do not change when camera rotates.