Header menu logo Mibo

ShadowConfig Type

Configuration for the Shadow Atlas system.

Record fields

Record Field Description

AtlasTiles

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.

Field type: int

Bias

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.

Field type: float32

CascadeCount

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.

Field type: int

MaxAtlasSize

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.

Field type: int

MaxPointShadows

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).

Field type: int

NormalBias

Full Usage: NormalBias

Field type: float32

Bias applied along the surface normal to prevent acne on curved surfaces.

Field type: float32

PCFSamples

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).

Field type: int

Resolution

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.

Field type: int

SoftShadows

Full Usage: SoftShadows

Field type: SoftShadowConfig voption

Enables soft shadows if set (ValueSome).

Field type: SoftShadowConfig voption

Type something to start searching.