Skip to content

Area Light ​

A rectangular area light (THREE.RectAreaLight). Great for soft "softbox" lighting. Only MeshStandardMaterial and MeshPhysicalMaterial are affected.

ts
import { Behaviour } from "@relu-interactives/spatial-ecs";

export default class SpawnSoftbox extends Behaviour {
  init() {
    const objects = this.world.getObjectManagementSystem();
    objects?.requestCreate("areaLight", {
      name: "Softbox",
      transform: { position: { x: 0, y: 4, z: 0 } },
    });
  }
}

Payload ​

FieldTypeDefaultDescription
namestring"Area Light"Display name.
transform.position{ x, y, z }(0, 4, 0)Light position. The light initially looks at the world origin.
transform.rotation / scale—identityStandard transform fields.
parentIdEntityId | nullnullOptional parent entity.

Default color #ffffff, intensity 5, dimensions 4 × 4.

Area lights shade through lookup tables. The engine loads them the first time an area light is spawned this way (WebGL fetches them on demand; webgpuBackend installs them at start-up). If a script builds a THREE.RectAreaLight by hand instead, call this.world.getRenderBackend().prepareAreaLights?.(this.world) first, or the light renders black on WebGL. A WebGPURenderer without webgpuBackend cannot render area lights.

Components attached ​

Transform, Object3DRef, Name, EntityType, ParentId, Selectable, Light.