Geometry · interface

LightVolumeOptions

Explained in Hello world, Meshes and geometry.

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

Properties

NameTypeDescription
lengthMnumberHow far the light reaches along the volume's own +Z, in the units the panes are built in — which are the units of whatever model matrix places them.
More

Pass this same number to drawLightVolume as its length. The panes end exactly here, so the light reaches zero at the last row of vertices and no edge is ever in the picture.

spreadnumberHalf-width over distance: the tangent of the cone's half-angle.
More

Pass this same number to drawLightVolume as its spread. The panes are built a shade wider than it, so the fade lands inside the polygon rather than at its rim.

colorVec3
nearMoptionalnumberWhere the volume starts, along the same +Z. Zero for a beam that begins at its source.
More

A shaft of daylight through an opening is a slice taken far down a very wide cone — the apex sits above the roof, and only the part below the opening is drawn. That is what this is for, and it is why the near end is a parameter rather than the origin.

sidesoptionalnumberHow many sides the hull has. Rounded up to an even number, because the caps are quads.
More

It decides the silhouette and nothing else: the light inside is the ray march's, so a coarse hull is a polygonal outline around a volume that is still round. Twelve is indistinguishable from a circle at the size a beam usually occupies; drop it for a volume that is always distant, raise it for one that fills the frame.