Renderer · interface

PointLightSource

Explained in Hello world.

interface PointLightSource
import type { PointLightSource } from '@driftengine/core';

Properties

NameTypeDescription
xnumber
ynumber
znumber
rnumber
gnumber
bnumber
radiusnumberDistance in metres at which illumination falls to zero.
flickernumberColour modulation amplitude; zero keeps a steady source.
shadowNearnumberShadow cubemap near plane in metres.
sourceRadiusnumberPhysical emitter radius in metres, used to derive penumbra width.
dirXoptionalnumberWhere a spot points, as a world-space direction. Absent makes this a point light.
More

Normalised here rather than trusted, because an un-normalised direction scales the cosine the cone is compared against and shows as a cone of the wrong width — which reads as the angle having been set wrong rather than as the vector.

dirYoptionalnumber
dirZoptionalnumber
coneInnerDegoptionalnumberThe cone's inner and outer half-angles in degrees. Full brightness inside the inner, nothing outside the outer, a smooth edge between.
More

A narrow cone is not free, and the cost is the shadow rather than the shading. A spot's shadow takes a layer of the same octahedral array a point light's does, and that layer covers the whole sphere — so a 45 degree cone uses about 15% of it, roughly 0.38 of the linear resolution, and a 10 degree cone about 0.13. Comfortable for a lamp; visibly coarse for a stage spotlight, which is the measurement that would justify giving spots a perspective map.

coneOuterDegoptionalnumber
iesProfileoptionalnumberWhich photometric profile shapes this light, as a row of the atlas setIesProfiles uploaded.
More

Applies to a point light as well as a spot. A bare bulb has a measured distribution too, and a fixture's own profile is usually a better description of it than any cone. Absent, or negative, is a light with no profile.

castsShadowoptionalbooleanWhether this light is worth a shadow cubemap. Defaults to true.
More

A light whose radius is animated invalidates its own map every frame — matchesSource compares the range, because the range is the cube's far plane — so it is perpetually stale and takes bake budget forever. With a fixed budget of a couple of faces a frame, a handful of those starve every real lamp in the world, and only the one nearest light ever finishes a bake.

That is not hypothetical: pulsing floor markers animate a squared fade into radius every frame, and a courtyard full of them left exactly one lamp casting. They are floor lighting 35 cm off the deck and were never meant to cast at all.

inLightFieldoptionalbooleanWhether a DriftLight field also sums this light (createLightField sets it).
More

Then the lit shader shades it exactly only where the choice is complete and lets the field's summed light take over past it, so the light is never counted twice. Carried to the shader as the sign of the light's weight, which both light paths already have: no new storage on a part whose uniform budget has none to spare.

falloffExponentoptionalnumberHow the light fades with distance when it names its own way: (1 - (d/R)^2)^n with no distance term, R its radius and n this. The usual falloff for a light without inverse-square falloff, so a rig authored that way — a fill of brightness 160 across 164 m, a key at exponent 8 — lights the space it was authored for rather than one that ends a few metres out. Absent or 0, the frame's own falloff (pointLightFalloff), which is every light before 4.8.7.