ShadowConfig Module
Functions and values
| Function or value |
Description
|
|
Default shadow settings: 1024px, 3 Cascades, 4x4 Atlas (16 slots), 8k Max Texture.
|
|
Sets the grid size (N x N) of the shadow atlas texture. Determines the total capacity for shadow casting lights (Total Slots = N * N).
|
Full Usage:
withBias bias normalBias cfg
Parameters:
float32
normalBias : float32
cfg : ShadowConfig
Returns: ShadowConfig
|
Tunable bias values to prevent shadow mapping artifacts. 'bias': Constant depth offset to prevent acne (self-shadowing). 'normalBias': Offset along the geometric normal to cure acne on curved surfaces without inducing Peter-Panning (detached shadows).
|
|
Sets the number of cascades for directional light shadows (typically 3 or 4). More cascades improve shadow sharpness at various distances but increase the number of draw calls per directional light.
|
|
Sets a hard limit on the shadow atlas texture size in pixels (e.g., 8192). Prevents the system from allocating too much VRAM. If (Resolution * Tiles) exceeds this, individual shadow maps will be downscaled.
|
|
Sets the maximum number of point lights that can cast shadows. Note: This is largely superseded by 'withAtlasTiles', which determines the total slot capacity.
|
|
Sets the number of PCF samples for soft shadow filtering (e.g., 16). Higher sample counts create smoother soft shadows but are more expensive to compute in the pixel shader.
|
|
Sets the resolution of a single shadow map slice (e.g., 2048). Higher values reduce aliasing (jaggies) but increase VRAM usage and GPU memory bandwidth.
|
Full Usage:
withSoftShadows penumbra cfg
Parameters:
float32
cfg : ShadowConfig
Returns: ShadowConfig
|
Enables the soft shadow code path in the shader. 'penumbra' controls the physical size of the light source, determining how blurry the shadows get with distance.
|
Mibo