Skip to content

Shadow

Per-light shadow configuration.

Plain, user-tunable data owned by a shadow-casting light and exposed as a public member. Holds only the settings that cannot be derived from the light. The depth framebuffer, texture, and light-space projection are owned by the renderer, and the projection is derived from the light's own properties.

Properties

auto_update bool

Re-renders the shadow map every frame.

Disable for lights whose casters are static to skip their shadow passes. The light and its casters must not move while disabled.

cpp
bool auto_update {true};

bias float

Constant depth bias applied to the shadow compare.

Positive values push the compare toward the light, reducing self-shadowing artifacts. Overly large values cause shadows to visibly detach from their casters.

cpp
float bias {0.0f};

extent float

Half-width of the directional shadow camera's orthographic box.

cpp
float extent {15.0f};

far float

Far plane of the shadow camera.

Directional lights always use this value. Point lights and spot lights with a positive range use the range instead.

cpp
float far {500.0f};

map_size unsigned int

Resolution of the square shadow map.

cpp
unsigned int map_size {1024};

near float

Near plane of the shadow camera.

cpp
float near {0.5f};

needs_update bool

Requests a one-time shadow map refresh when auto_update is disabled.

Cleared by the renderer after the next render.

cpp
bool needs_update {false};

radius float

Penumbra width in shadow map texels.

Values in the range stay smooth. Larger values trade quality for width. Only used when PCF is selected.

cpp
float radius {1.0f};

Released under the MIT License.