Skip to content

Lights & shadows

Lights are declared on an entity via the light schema (packages/engine/src/scene/schema/light.ts).

directional, point, spot, and hemisphere lights
The four light types.
typeBehaviorKey fields
directionalParallel rays (a sun)color, intensity
pointOmnidirectional from a pointcolor, intensity, distance (0 = infinite)
spotA conecolor, intensity, distance, angle (radians), penumbra (0–1)
hemisphereSky/ground gradient ambientcolor (sky), groundColor, intensity

distance (point/spot) caps the light’s range — 0 means infinite. A spot’s angle is the cone half-angle in radians, and penumbra softens the cone edge (0–1). The schema rejects a spot angle that isn’t positive.

A light casts shadows via the shadow schema (packages/engine/src/scene/schema/shadow.ts):

  • enabled — does this light cast shadows.
  • mapSize — shadow map resolution in pixels (e.g. 1024, 2048).
  • camera{ left, right, top, bottom } frustum bounds (directional lights).
  • radius — blur radius for soft shadows.
  • bias — offset to reduce shadow acne.

The renderer uses PCF soft shadow maps globally (see Rendering). An entity’s own shadow cast / receive flags are set in its shadow config.