ShadowConfig Type
Configuration for the Shadow Atlas system.
Record fields
| Record Field |
Description
|
Full Usage:
AtlasTiles
Field type: int
|
Number of tiles across the shadow atlas (Width/Height). Total shadow slots = AtlasTiles * AtlasTiles. Example: 12 tiles = 144 slots. Crucial for determining how many lights can cast shadows simultaneously.
|
Full Usage:
Bias
Field type: float32
|
Constant depth bias to prevent shadow acne (self-shadowing artifacts). Too high: shadows detach from objects (Peter Panning). Too low: moire patterns appear on surfaces.
|
Full Usage:
CascadeCount
Field type: int
|
Number of cascades to use for Directional Lights (typically 3 or 4). Cascades distribute resolution over distance. 4 cascades provide the best quality for open worlds but require 4 render passes per directional light.
|
Full Usage:
MaxAtlasSize
Field type: int
|
Hard limit for the Shadow Atlas texture size (e.g., 16384). If (Resolution * AtlasTiles) exceeds this, the effective resolution per tile will be downscaled. Watch VRAM usage: a 16k atlas consumes ~2GB of memory.
|
Full Usage:
MaxPointShadows
Field type: int
|
Maximum number of point lights that can cast shadows. (Note: This logic is largely superseded by the AtlasTiles limit).
|
Full Usage:
NormalBias
Field type: float32
|
Bias applied along the surface normal to prevent acne on curved surfaces.
|
Full Usage:
PCFSamples
Field type: int
|
Number of samples for Percentage Closer Filtering (PCF). Ignored if a custom shader uses a different technique (e.g., Poisson Disk).
|
Full Usage:
Resolution
Field type: int
|
The resolution for a single shadow map slice (e.g., 2048 or 4096). A higher resolution reduces aliasing but increases VRAM usage significantly as it scales with the number of AtlasTiles.
|
|
Enables soft shadows if set (ValueSome).
|
Mibo