# @ferret/vfx: API (continued)

### ignitionTime

*function* · `packages/vfx/src/spread.ts:284`

```ts
function ignitionTime(m: Combustible, flux: number, T0 = 293.15, h = 15): number
```

time for a thermally thick solid under a constant flux q to reach its ignition temperature, s (semi-infinite solid, Drysdale): t = (pi / 4) k rho c (T_ig - T0)^2 / q^2; Infinity at or below the critical flux

### impostorShape

*function* · `packages/vfx/src/parts.ts:168`

```ts
function impostorShape(inst: Instance, spec: ImpostorRender, wind: readonly [number, number, number], measured: { height: number; width: number }): StripShape
```

The size and colour of the strip or card an effect becomes at a distance. Height and width come from the definition when it gives them and otherwise from the
particles the effect actually has now (the top of the highest, the spread of the widest, smoothed by the caller), so a plume drawn far away is as tall as the plume
that was drawn near. `wind` leans it downwind. The colour is the effect's own: the definition's, else the first emitter's, so smoke stays grey and fire stays orange.

### installVfxNet

*function* · `packages/vfx/src/vfx-net.ts:182`

```ts
function installVfxNet(net: NetLike, replica: VfxReplica): () => void
```

Connects a replica to a net service: commands, hello and sync travel as the messages `vfx:op`, `vfx:hello` and `vfx:sync`; a peer that joins is greeted by
the others' answers (the first one wins, later ones are dropped), and says hello itself when it starts. Returns the function that disconnects it.

### jetHeight

*function* · `packages/vfx/src/world-fx.ts:14`

```ts
function jetHeight: (speed: number) => number
```

### ladderProblems

*function* · `packages/vfx/src/ladder.ts:35`

```ts
function ladderProblems(at: Record<DrawnRung, number>): string[]
```

the thresholds must fall as the rung gets cheaper: volume >= particles >= impostor >= dot >= 0; returns the problems found

### lightOf

*function* · `packages/vfx/src/parts.ts:52`

```ts
function lightOf(inst: Instance, out?: LightState): LightState | null
```

the light of an instance now, or null when it has none or is dark

### loudnessAt

*function* · `packages/vfx/src/sound-fx.ts:48`

```ts
function loudnessAt(distance: number, radius: number): number
```

The loudness (0..1 of the source's own gain) at `distance` for a sound audible out to `radius` (design: the inverse law from a reference distance of a
thirtieth of the radius, 1/(1 + d/r1), then faded to zero over the last tenth of the radius so nothing cuts off).

### N

*function* · `packages/vfx/src/catalog-kit.ts:6`

```ts
function N: (v: string | number) => string
```

### noise3

*function* · `packages/vfx/src/rng.ts:29`

```ts
function noise3(seed: number, x: number, y: number, z: number): number
```

### noticed

*function* · `packages/vfx/src/sight.ts:121`

```ts
function noticed(eye: Vec3, signs: Sign[], night: number, sight?: SmokeSight, gain = NIGHT_NOTICE_GAIN): Sign[]
```

the signs an observer at `eye` notices at this time of day: within the range, and (for fire, light and smoke, which are seen) through the smoke between

### noticeRange

*function* · `packages/vfx/src/sight.ts:101`

```ts
function noticeRange(kind: 'fire' | 'light' | 'noise' | 'smoke', radius: number, night: number, gain = NIGHT_NOTICE_GAIN): number
```

the distance a sign is noticed from, m: the effect's `stimulus.radius` by day; for fire and light it grows towards `radius * gain` as it gets dark (night 0..1)

### opticalDepth

*function* · `packages/vfx/src/droplets.ts:63`

```ts
function opticalDepth(volume: number, d: number, r: number): number
```

optical depth through a cloud of drops of diameter d holding liquid volume V spread over a disc of radius r: the drops' total cross-section over its area

### orderFarFirst

*function* · `packages/vfx/src/gather.ts:42`

```ts
function orderFarFirst(keys: Float32Array, n: number, out: Uint32Array, scratch: Uint32Array, buckets = 4096): void
```

Counting sort of `n` keys into `out` (indices): larger keys first. Keys are quantised into `buckets` steps between 0 and the largest, which is exact enough
for ordering transparent sprites, and the cost is linear in the number of particles.

### packEmitters

*function* · `packages/vfx/src/droplets.ts:102`

```ts
function packEmitters(list: readonly DropletEmitter[], dt: number, carry: number[], out: Float32Array): number
```

pack the emitters and this step's parcel counts (a fractional rate carries over) into the layout the step and the compute shader read

### packParams

*function* · `packages/vfx/src/droplets.ts:174`

```ts
function packParams(o: { dt: number; time: number; capacity: number; head: number; total: number; emitters: number; liquid: LiquidProps; seed: number; air: DropletAir; surface: SurfaceGrid | null; maxImpacts: number }, out: Float32Array): void
```

### particleLook

*function* · `packages/vfx/src/gather.ts:87`

```ts
function particleLook(c: CEmitter, p: Pool, i: number, out: number[] | Float32Array, glow: number): void
```

the colour, alpha and glow of particle `i` at the age it has; writes r, g, b, a, glow into `out`

### pcg

*function* · `packages/vfx/src/droplets.ts:67`

```ts
function pcg(v: number): number
```

### permute

*function* · `packages/vfx/src/gather.ts:55`

```ts
function permute(src: BatchData, dst: BatchData, order: Uint32Array, n: number): void
```

reorders the arrays of `src` into `dst` by `order`

### plumeMass

*function* · `packages/vfx/src/plume.ts:43`

```ts
function plumeMass(Q: number, D: number, z: number, chi = CONVECTIVE_FRACTION): number
```

air entrained by the plume by height, kg/s (Heskestad, z above the flame tip): m = 0.071 Qc^(1/3) (z - z0)^(5/3) (1 + 0.026 Qc^(2/3) (z - z0)^(-5/3)), Qc in kW

### plumeTempRise

*function* · `packages/vfx/src/plume.ts:31`

```ts
function plumeTempRise(Q: number, D: number, z: number, chi = CONVECTIVE_FRACTION): number
```

centreline temperature rise above ambient, kelvin: dT = 25 (Qc^(2/5) / (z - z0))^(5/3), Qc in kW

### plumeVelocity

*function* · `packages/vfx/src/plume.ts:25`

```ts
function plumeVelocity(Q: number, D: number, z: number, chi = CONVECTIVE_FRACTION): number
```

centreline velocity above the flame, m/s: u = 1.0 Qc^(1/3) (z - z0)^(-1/3), Qc in kW, z above the fuel in metres

### plumeWidth

*function* · `packages/vfx/src/plume.ts:49`

```ts
function plumeWidth: (D: number, z: number) => number
```

how wide the plume is at height z above the fuel, metres (a half-angle near 10 degrees, starting from the fire's own width)

### poolPower

*function* · `packages/vfx/src/catalog-fire.ts:44`

```ts
function poolPower(fuel: string, D: number): number
```

the heat release of a pool of diameter D of a fuel, W

### powerAfterWater

*function* · `packages/vfx/src/spread.ts:314`

```ts
function powerAfterWater(power: number, flow: number, efficiency = 1, T = 293.15): number
```

the fire power left after water of mass flow `flow` (kg/s) reaches it, of which `efficiency` (0..1) is used on the fire: P - efficiency flow (cp dT + L), never below 0

### projectedPixels

*function* · `packages/vfx/src/select.ts:10`

```ts
function projectedPixels(radius: number, distance: number, fov: number, heightPx: number): number
```

the diameter of a sphere of `radius` at `distance`, in pixels of a render target `heightPx` tall with the vertical field of view `fov` (radians)

### puff

*function* · `packages/vfx/src/catalog-kit.ts:31`

```ts
function puff(o: PuffOpts): EmitterDef
```

soft alpha-blended sprites: smoke, steam, dust, spray, mist

### radianceRatio

*function* · `packages/vfx/src/plume.ts:62`

```ts
function radianceRatio: (T: number) => number
```

how bright a hot gas glows against a flame at 1200 K, by the Stefan-Boltzmann law: (T / 1200)^4, capped at 1.5 (a hotter core does not blow out the picture)

### radiantFlux

*function* · `packages/vfx/src/spread.ts:275`

```ts
function radiantFlux: (Q: number, distance: number, chi?: number) => number
```

radiant heat flux at a distance from a fire, W/m^2, by the point-source model: q = chi_r Q / (4 pi r^2)

### rainDropRate

*function* · `packages/vfx/src/world-fx.ts:24`

```ts
function rainDropRate: (mmPerHour: number, diameter?: number) => number
```

the number of raindrops that fall on a square metre in a second at a rain rate (mm/h) and a drop diameter (m): the flux of volume over the volume of a drop

### rand

*function* · `packages/vfx/src/rng.ts:20`

```ts
function rand: (seed: number, a: number, b?: number, c?: number) => number
```

a number in [0, 1) from (seed, a, b, c)

### rateAtAngle

*function* · `packages/vfx/src/spread.ts:111`

```ts
function rateAtAngle: (head: number, e: number, theta: number) => number
```

the rate of spread (m/s) at angle `theta` from the direction of maximum spread, given the head rate and the eccentricity

### recipe

*function* · `packages/vfx/src/bake.ts:260`

```ts
function recipe: (id: string) => BakeRecipe | undefined
```

the recipe of an id, or undefined

### registerVfxCommands

*function* · `packages/vfx/src/vfx-commands.ts:229`

```ts
function registerVfxCommands(host: CommandHost, s: VfxSession): void
```

the `vfx.*` commands on a host; `vfx.bake` and `vfx.view` are the viewer's and the Node tool's, not here

### resolveLadder

*function* · `packages/vfx/src/ladder.ts:24`

```ts
function resolveLadder(o?: RungOverrides): ResolvedLadder
```

the defaults with an effect's overrides on top

### resolveParams

*function* · `packages/vfx/src/params.ts:15`

```ts
function resolveParams(def: Pick<VfxDef, 'params'>, given: Readonly<Record<string, number>> = {}): ResolvedParams
```

the values an instance starts with; a non-finite value counts as not given

### rothermel

*function* · `packages/vfx/src/spread.ts:71`

```ts
function rothermel(bed: FuelBed, moisture: number, wind: number, slope = 0): RothermelResult
```

The rate of spread. `moisture` is the dead fuel moisture (fraction, oven-dry basis), `wind` the wind at midflame height along the direction of spread in m/s,
`slope` tan(phi) of the slope along it (positive uphill). At or above the moisture of extinction the fire does not spread (rate 0).

### sampleCurve

*function* · `packages/vfx/src/compile.ts:130`

```ts
function sampleCurve(c: Curve | null | undefined, a: number, dflt = 1): number
```

### sampleGradient

*function* · `packages/vfx/src/compile.ts:140`

```ts
function sampleGradient(g: Gradient, a: number, out: number[] | Float32Array, o = 0): void
```

writes r, g, b, alpha into `out`

### shockRingRadius

*function* · `packages/vfx/src/blast-fx.ts:34`

```ts
function shockRingRadius: (tnt: number) => number
```

### shockSpeed

*function* · `packages/vfx/src/blast-fx.ts:30`

```ts
function shockSpeed: (overpressure: number, ambient?: number, a?: number, gamma?: number) => number
```

the speed of a shock front of overpressure ratio p/p0 in air at sound speed a, by the Rankine-Hugoniot relation U = a sqrt(1 + (gamma + 1) / (2 gamma) p/p0), m/s

### signsOf

*function* · `packages/vfx/src/sight.ts:110`

```ts
function signsOf(sim: VfxSystem): Sign[]
```

the stimuli of the effects of a simulation now (those whose definition has `game.stimulus`)

### smokeExtinction

*function* · `packages/vfx/src/sight.ts:19`

```ts
function smokeExtinction: (sootKgM3: number, K?: number) => number
```

extinction coefficient of smoke, 1/m, from the soot's mass per cubic metre (kg/m^3)

### smokePuffPixels

*function* · `packages/vfx/src/pixels.ts:58`

```ts
function smokePuffPixels(cols = 4, rows = 4, tile = 96, seed = 1): FlipbookPixels
```

Smoke: a puff that swells and thins over its frames. White-grey with a shaded side, so the particle colour tints it; the alpha is eroded by noise that moves
from frame to frame, and the motion atlas is the swelling (outward from the centre), which lets the shader blend frames without ghosting.

### softDiscPixels

*function* · `packages/vfx/src/pixels.ts:50`

```ts
function softDiscPixels(tile = 64): FlipbookPixels
```

a soft round blob, one frame

### sootShare

*function* · `packages/vfx/src/plume.ts:69`

```ts
function sootShare: (yieldGG: number) => number
```

the catalogue `soot` parameter (smoke opacity, 0..1) for a measured soot yield; the host reads the yield from the chemistry module and passes this

### soundDelay

*function* · `packages/vfx/src/sound-fx.ts:13`

```ts
function soundDelay: (distance: number, medium?: "water" | "air", tempC?: number) => number
```

the time a sound takes to cover `distance` metres, s

### soundFor

*function* · `packages/vfx/src/catalog-sound.ts:133`

```ts
function soundFor(def: VfxDef): SoundDef | undefined
```

the `sound` block of the catalogue item `name` (dust is by pattern `dust.<cause>-<surface>`), if it has one

### sparkPixels

*function* · `packages/vfx/src/pixels.ts:89`

```ts
function sparkPixels(tile = 32): FlipbookPixels
```

A spark: a bright point with a short falling tail, one frame

### speedOfSound

*function* · `packages/vfx/src/sound-fx.ts:10`

```ts
function speedOfSound: (tempC?: number) => number
```

the speed of sound in air, m/s, at `tempC` degrees Celsius

### splashRadius

*function* · `packages/vfx/src/world-fx.ts:18`

```ts
function splashRadius: (energy: number) => number
```

### stableDiameter

*function* · `packages/vfx/src/droplets.ts:51`

```ts
function stableDiameter(w: number, liquid: LiquidProps = WATER): number
```

the largest diameter that survives a relative air speed w: We = WE_CRIT

### steamPower

*function* · `packages/vfx/src/world-fx.ts:10`

```ts
function steamPower: (flowKgS: number) => number
```

heat power carried by a steam flow, W: the plume rises as a buoyant plume of this heat release, like a fire of the same power (Heskestad's plume velocity applies to it)

### stepOne

*function* · `packages/vfx/src/droplets.ts:266`

```ts
function stepOne(p: Float32Array, i: number, dt: number, air: DropletAir, surface: SurfaceGrid | null, liquid: LiquidProps): number
```

one parcel through one step; 0 dead, 1 alive, 2 landed on water now (an impact), 3 landed on ground now

### streaks

*function* · `packages/vfx/src/catalog-kit.ts:44`

```ts
function streaks(o: StreakOpts): EmitterDef
```

thin streaks along the motion: sparks, drops, spray, rain, tracers

### subSeed

*function* · `packages/vfx/src/rng.ts:23`

```ts
function subSeed: (seed: number, n: number) => number
```

the seed of a child (an emitter of an instance, a part of an effect): different inputs give unrelated seeds

### terminalVelocity

*function* · `packages/vfx/src/droplets.ts:38`

```ts
function terminalVelocity(d: number, liquid: LiquidProps = WATER): number
```

the speed a drop of diameter d falls at in still air (drag equals weight), by bisection of the drag law

### tierAllows

*function* · `packages/vfx/src/ladder.ts:29`

```ts
function tierAllows(rung: Rung, tier: VfxTier, ladder: ResolvedLadder = resolveLadder()): boolean
```

may this tier use the rung

### tierRank

*function* · `packages/vfx/src/ladder.ts:16`

```ts
function tierRank: (t: VfxTier) => number
```

### validateDef

*function* · `packages/vfx/src/validate.ts:34`

```ts
function validateDef(def: unknown, opts: ValidateOptions = {}): Issue[]
```

### validateVfxBlock

*function* · `packages/vfx/src/vfx-commands.ts:23`

```ts
function validateVfxBlock(block: unknown, known: (name: string) => VfxDef | undefined = () => undefined): BlockIssue[]
```

checks a `vfx` block: every definition is valid, every placement names a definition (of the block or of `known`), a place, and parameters the definition has within their limits

### virtualOrigin

*function* · `packages/vfx/src/plume.ts:17`

```ts
function virtualOrigin(Q: number, D: number): number
```

the virtual origin of the plume above the fuel surface, metres: z0 = 0.083 Q^(2/5) - 1.02 D (Q in kW); negative for a big, wide fire

### visualRange

*function* · `packages/vfx/src/sight.ts:24`

```ts
function visualRange: (extinction: number) => number
```

visual range in smoke of a given extinction coefficient: 3.912 / K (Koschmieder)

### warmCurl

*function* · `packages/vfx/src/rng.ts:71`

```ts
function warmCurl(): void
```

builds the field now (about 40 ms), so the first frame of a smoke does not pay for it; harmless to call twice

### waterHeatSink

*function* · `packages/vfx/src/spread.ts:311`

```ts
function waterHeatSink: (T?: number) => number
```

the heat water takes from a fire by heating to boiling and evaporating, J/kg: cp (373.15 - T) + L with cp 4186 J/kg K and L 2.257 MJ/kg

### weber

*function* · `packages/vfx/src/droplets.ts:45`

```ts
function weber(w: number, d: number, liquid: LiquidProps = WATER): number
```

the Weber number of a drop: the air's dynamic pressure against the surface tension

### withSound

*function* · `packages/vfx/src/catalog-sound.ts:143`

```ts
function withSound(defs: readonly VfxDef[]): VfxDef[]
```

copies of the definitions with a `sound` block added to each that has none and has a rule (a definition's own block is kept)

### worldDef

*function* · `packages/vfx/src/catalog-world.ts:166`

```ts
function worldDef: (name: string) => VfxDef | undefined
```

## Interfaces

### AirState

*interface* · `packages/vfx/src/sound-fx.ts:15`

```ts
interface AirState
```

- `tempC?: number`
- `humidity?: number`
- `pressureKPa?: number`

### AudioHandle

*interface* · `packages/vfx/src/sound-play.ts:11`

```ts
interface AudioHandle
```

- `stop(fade?: number): void`
- `setVolume(v: number, fade?: number): void`
- `set(param: string, value: number): void`

### AudioLike

*interface* · `packages/vfx/src/sound-play.ts:12`

```ts
interface AudioLike
```

- `play(name: string, o: { at?: unknown; volume?: number; loop?: boolean; fadeIn?: number; delay?: number; params?: Record<string, number>; lowpass?: number; spatial?: { min?: number; max?: number; model?: 'inverse' } }): AudioHandle`

### BakedFlipbook

*interface* · `packages/vfx/src/bake.ts:50`

```ts
interface BakedFlipbook
```

- `cols: number`
- `rows: number`
- `frames: number`
- `frameSize: number`
- `fps: number`
- `color: Uint8Array` — RGBA8 atlases of cols*frameSize x rows*frameSize pixels
- `light: Uint8Array`
- `light2: Uint8Array`
- `motion: Uint8Array`
- `depth: Uint8Array`
- `motionScale: number`
- `extent: number` — metres the picture spans (the width of the box that was looked at)
- `volume?: BakedVolume`

### BakedVolume

*interface* · `packages/vfx/src/bake.ts:60`

```ts
interface BakedVolume
```

- `resolution: [number, number, number]`
- `frames: number`
- `voxel: number`
- `channels: Array<'density' | 'temperature'>`
- `voxels: Uint8Array`
- `densityMax: number`
- `temperatureMax: number`
- `ambient: number`

### BakedVolumeData

*interface* · `packages/vfx/src/volume.ts:153`

```ts
interface BakedVolumeData
```

what the library gives for a volume (`AssetLibrary.volume(id)`)

- `item: { resolution: [number, number, number]; frames: number; fps: number; voxel: number; loop?: boolean; densityMax?: number; temperatureMax?: number; ambient?: number }`
- `bytes: Uint8Array`

### BakeRecipe

*interface* · `packages/vfx/src/bake.ts:28`

```ts
interface BakeRecipe
```

- `id: string`
- `name: string`
- `tags: string[]`
- `seed: number`
- `n: number` — cells along each axis of the cubic grid
- `grid: Partial<GridOptions>`
- `warmup: number` — seconds simulated before the first frame, and the frames of the flipbook (cols x rows cells of `size` pixels) played at `fps`
- `frames: number`
- `cols: number`
- `rows: number`
- `size: number`
- `fps: number`
- `substeps: number` — solver steps per frame
- `source: (g: FluidGrid, t: number) => void` — the sources of the effect: called before each step with the grid and the time since the start of the effect (negative while warming up)
- `shading: Shading`
- `view?: { cx?: number; cy?: number; half: number }` — the window of the grid the tile shows: the centre as fractions of the box (x, y) and the half size as a fraction of it; the default is the whole box
- `volume?: { n: number; densityMax: number; temperatureMax: number }` — the volume sequence to keep as well: voxels along each axis, the density that maps to 255 and the temperature that does

### BlockIssue

*interface* · `packages/vfx/src/vfx-commands.ts:18`

```ts
interface BlockIssue
```

- `path: string`
- `message: string`

### BridgeOptions

*interface* · `packages/vfx/src/spread-bridge.ts:11`

```ts
interface BridgeOptions
```

- `cellEffect?: string` — the effect of a burning cell (default `fire.grass`)
- `stride?: number` — one effect for every this many burning cells, chosen by cell index (default 1)
- `emit?: (name: 'vfx:ignite' | 'vfx:spread' | 'vfx:out', payload: VfxIgniteEvent | VfxSpreadEvent | VfxOutEvent) => void` — emit an event: the host forwards these to `world.events`
- `height?: (x: number, z: number) => number` — the height of the ground, m, for placing effects

### BurstDef

*interface* · `packages/vfx/src/def.ts:37`

```ts
interface BurstDef
```

- `at: Expr`
- `count: Expr`

### CCollide

*interface* · `packages/vfx/src/compile.ts:32`

```ts
interface CCollide
```

- `readonly with: 'ground' | 'bodies' | 'both'`
- `readonly onHit: 'bounce' | 'die' | 'stick'`
- `readonly bounce: CExpr`
- `readonly friction: CExpr`

### CEmitter

*interface* · `packages/vfx/src/compile.ts:35`

```ts
interface CEmitter
```

- `readonly def: EmitterDef`
- `readonly name: string`
- `readonly index: number`
- `readonly max: number`
- `readonly rate?: CExpr`
- `readonly perMetre?: CExpr`
- `readonly delay?: CExpr`
- `readonly runFor?: CExpr`
- `readonly bursts: ReadonlyArray<{ at: CExpr; count: CExpr }>`
- `readonly shape: CShape`
- `readonly lifetime: CRange`
- `readonly speed: CRange | null`
- `readonly direction: 'out' | 'up' | 'forward' | Vec3`
- `readonly spread: CExpr | null`
- `readonly inherit: CExpr | null`
- `readonly size: CRange`
- `readonly rotation: CRange | null`
- `readonly spin: CRange | null`
- `readonly temperature: CRange | null`
- `readonly sizeCurve: Curve | null`
- `readonly alphaCurve: Curve | null`
- `readonly gradient: Gradient | null`
- `readonly color: Vec3 | null`
- `readonly modules: readonly CModule[]`
- `readonly collide: CCollide | null`
- `readonly subs: readonly CSub[]`
- `readonly render: ParticleRender`
- `readonly rx: { readonly soft: CExpr | null; readonly emissive: CExpr | null; readonly stretch: CExpr | null; readonly width: CExpr | null }` — the expressions of the renderer, compiled once; evaluated per particle by the gatherer (they may read age, rnd and i)

### CExpr

*interface* · `packages/vfx/src/compile.ts:8`

```ts
interface CExpr
```

stamp and val memoise the value of an expression that does not depend on the particle, once per instance step (see sim.ts)

- `readonly e: Compiled`
- `readonly dyn: boolean`
- `stamp: number`
- `val: number`

### ChooseOptions

*interface* · `packages/vfx/src/select.ts:24`

```ts
interface ChooseOptions
```

- `current?: Rung` — the rung used now: moving to a richer rung needs `hysteresis` more than the threshold, staying needs `hysteresis` less
- `hysteresis?: number` — share of the threshold, default 0.15
- `cap?: Rung` — the richest rung allowed (the governor lowers it first); default `volume`

### Combustible

*interface* · `packages/vfx/src/spread.ts:278`

```ts
interface Combustible
```

a combustible surface: the properties of a `physics-heat` material (density, specific heat, conductivity, ignition temperature)

- `density: number`
- `c: number`
- `k: number`
- `ignition: number`

### CommandHost

*interface* · `packages/vfx/src/vfx-commands.ts:12`

```ts
interface CommandHost
```

- `register(name: string, description: string, fn: (args: any) => unknown | Promise<unknown>): void`

### Compiled

*interface* · `packages/vfx/src/expr.ts:121`

```ts
interface Compiled
```

- `readonly source: string` — the source text
- `readonly names: readonly string[]` — names the expression reads (constants excluded), sorted, without duplicates
- `evaluate(vars: Vars): number` — a missing variable reads as 0

### CompiledDef

*interface* · `packages/vfx/src/compile.ts:67`

```ts
interface CompiledDef
```

- `readonly def: VfxDef`
- `readonly name: string`
- `readonly seed: number`
- `readonly duration: CExpr | null`
- `readonly radius: CExpr | null`
- `readonly emitters: readonly CEmitter[]`

### CRange

*interface* · `packages/vfx/src/compile.ts:9`

```ts
interface CRange
```

- `readonly lo: CExpr`
- `readonly hi: CExpr | null`

### CSub

*interface* · `packages/vfx/src/compile.ts:33`

```ts
interface CSub
```

- `readonly on: 'death' | 'collision'`
- `readonly target: number`
- `readonly count: CExpr`
- `readonly chance: CExpr`

### DecalDef

*interface* · `packages/vfx/src/def.ts:190`

```ts
interface DecalDef
```

- `kind: 'scorch' | 'crater' | 'soot' | 'wet' | 'impact'`
- `texture?: string`
- `size: Expr`
- `at?: 'start' | 'end' | number` — when it appears: `start`, `end`, or seconds after the start
- `life: Expr` — seconds it lasts before it fades
- `fade?: Expr`

### DecalSpec

*interface* · `packages/vfx/src/parts.ts:102`

```ts
interface DecalSpec
```

- `owner?: number` — the effect (instance id) it belongs to: a decal goes with the effect when an editor removes it, and stays when the effect ends
- `kind: DecalDef['kind']`
- `texture?: string`
- `pos: [number, number, number]`
- `size: number` — metres across
- `life: number` — seconds from birth until it starts to fade, and how long the fade takes
- `fade: number`
- `seed: number` — a stable number for the look of it (rotation, which variant)

### DistortDef

*interface* · `packages/vfx/src/def.ts:201`

```ts
interface DistortDef
```

- `kind: 'heat-haze' | 'shock-ring'`
- `strength: Expr`
- `radius: Expr`
- `speed?: Expr` — shock ring: the ring grows at this speed, m/s

### DotLook

*interface* · `packages/vfx/src/parts.ts:190`

```ts
interface DotLook
```

- `size: number` — the world size that makes the dot `pixels` across at this distance
- `pixels: number`
- `rgb: Rgb`
- `alpha: number`
- `glow: boolean`

### DotRender

*interface* · `packages/vfx/src/def.ts:137`

```ts
interface DotRender
```

the `dot` rung: a point of light, or a dark smudge, so a fire at night or a smoke column stays visible from far away

- `kind: 'light' | 'smudge'`
- `rgb: Rgb | 'temperature'`
- `intensity: Expr`
- `size?: Expr`

### DriveOptions

*interface* · `packages/vfx/src/drive.ts:11`

```ts
interface DriveOptions
```

- `positionOf?: (entity: unknown) => Vec3 | undefined` — where an entity is, m
- `materialOf?: (entity: unknown, at: Vec3) => string | undefined` — what an entity (or the ground at a point) is made of: `concrete`, `metal`, `wood`, `soil`, `sand`, `water`; the default for a thing that says nothing is `concrete`
- `dustAt?: (at: Vec3) => [number, number, number] | undefined` — the colour of dust at a point, from the ground under it (the soil and the surface of the terrain)
- `placeOf?: (name: string) => Vec3 | undefined` — where a named chamber or gun is
- `minImpactEnergy?: number` — the energy of an impact below which nothing is drawn, J
- `onSpawn?: (name: string, handle: VfxHandle, cause: string) => void` — called for each effect started

### DropletAir

*interface* · `packages/vfx/src/droplets.ts:122`

```ts
interface DropletAir
```

The air the parcels move in: a horizontal velocity grid in two height layers (the FlowMap layout: n*n cells of low.x low.z high.x high.z) plus the wind.

- `data: Float32Array | null`
- `n: number`
- `cell: number`
- `originX: number`
- `originZ: number`
- `lowHeight: number`
- `highHeight: number`
- `wind: [number, number, number]`

### DropletEmitter

*interface* · `packages/vfx/src/droplets.ts:78`

```ts
interface DropletEmitter
```

A line along which a surface sheds liquid into the air (an edge, a ring of segments, a point when a = b).

- `a: [number, number, number]`
- `b: [number, number, number]`
- `out: [number, number]` — the horizontal direction the liquid leaves in (normalised here)
- `rate: number` — parcels per second
- `speed: number` — launch speed (m/s) and its relative spread 0..1
- `speedSpread?: number`
- `elevation: number` — elevation above the horizontal (rad) and its spread
- `elevationSpread?: number`
- `azimuthSpread?: number` — azimuth spread round `out` (rad), default 0.35
- `diameter: number` — median diameter of the drops (m) and the log-normal sigma
- `sigma?: number`
- `life: number` — the longest a parcel lives (s): its drops fall or evaporate before
- `flux: number` — liquid volume per second over the whole emitter (m^3/s), split among its parcels
- `carrier?: [number, number, number]` — the velocity of what sheds it (a moving hull), added to every parcel
- `tag?: number`

### DropletPoolOptions

*interface* · `packages/vfx/src/droplets.ts:159`

```ts
interface DropletPoolOptions
```

- `capacity: number` — parcels the pool holds (a ring: the oldest is overwritten when it is full)
- `liquid?: LiquidProps`
- `diffusivity?: number` — turbulent diffusivity of the air near the surface (m^2/s) that spreads a parcel's cloud, default 0.05
- `cloud0?: number` — the radius of a parcel's cloud when it is shed (m), default 0.04
- `maxImpacts?: number` — most impacts kept per step, default 256
- `seed?: number`

### DropletViewOptions

*interface* · `packages/vfx/src/droplets-view.ts:18`

```ts
interface DropletViewOptions
```

- `capacity?: number` — parcels on WebGPU (default 65536) and on the CPU path (default 4096)
- `cpuCapacity?: number`
- `liquid?: LiquidProps`
- `diffusivity?: number` — turbulent diffusivity that spreads a parcel's cloud (m^2/s), default 0.05; the cloud's first radius (m), default 0.04
- `cloud0?: number`
- `exposure?: number` — the exposure the drops streak over (s), default 1/60
- `sun?: () => { dir: [number, number, number]; color: [number, number, number] } | undefined` — the sun: direction toward it and its colour (linear), and the sky's colour; default from the scene's first directional and hemispheric light
- `sky?: () => [number, number, number]`
- `depth?: BABYLON.Texture` — the scene's camera-space depth (DepthRenderer with storeCameraSpaceZ) for soft edges where the cloud meets a surface
- `cpu?: boolean` — force the CPU path even on WebGPU (tests, comparisons)
- `maxImpacts?: number`
- `seed?: number`

### EmitterDef

*interface* · `packages/vfx/src/def.ts:145`

```ts
interface EmitterDef
```

- `name: string`
- `max: number` — capacity of the pool; the emitter never holds more
- `rate?: Expr` — spawn rate per second, particles per metre moved, and timed bursts: at least one
- `perMetre?: Expr`
- `bursts?: BurstDef[]`
- `delay?: Expr` — seconds the emitter waits after the effect starts, and the time it runs (default: the effect's duration)
- `runFor?: Expr`
- `shape: SpawnShape`
- `lifetime: Range`
- `velocity?: VelocityDef`
- `size: Range`
- `sizeOverLife?: Curve`
- `rotation?: Range` — degrees, and degrees per second
- `spin?: Range`
- `temperature?: Range` — initial temperature, K; drives emission colour and buoyancy
- `color?: Rgb`
- `colorOverLife?: Gradient`
- `alphaOverLife?: Curve`
- `modules?: ModuleDef[]`
- `subEmitters?: SubEmitterDef[]`
- `render: ParticleRender`

### EventSource

*interface* · `packages/vfx/src/drive.ts:9`

```ts
interface EventSource
```

the part of the world's event bus the drive needs: `on` returns the function that unsubscribes

- `on(name: string, fn: (payload: any) => void): () => void`

### Flipbook

*interface* · `packages/vfx/src/textures.ts:7`

```ts
interface Flipbook
```

- `texture: BABYLON.BaseTexture`
- `cols: number`
- `rows: number`
- `frames: number`
- `motion?: BABYLON.BaseTexture` — per-frame motion vectors in the red and green channels (0.5 = still), in tile units per frame, for blending between frames; absent: plain cross-fade
- `motionScale?: number` — how far the vectors reach, in tiles, at 0 / 1

### FlipbookPixels

*interface* · `packages/vfx/src/pixels.ts:26`

```ts
interface FlipbookPixels
```

the pixels of a flipbook, RGBA8, `cols` x `rows` tiles of `tile` pixels, and the motion atlas if there is one

- `width: number`
- `height: number`
- `cols: number`
- `rows: number`
- `frames: number`
- `rgba: Uint8ClampedArray`
- `motion?: Uint8ClampedArray`
- `motionScale?: number`

### Fuel

*interface* · `packages/vfx/src/catalog-fire.ts:13`

```ts
interface Fuel
```

- `massFlux?: number` — mass loss per area of a burning pool, kg/(m^2 s), and heat of combustion, MJ/kg: their product is the heat release per area of the pool
- `heatMJkg?: number`
- `soot: number` — the soot share (art, see above) and the colours
- `smoke: Rgb`
- `flame: Gradient`
- `glow: number` — how much the flame glows: 1 for a luminous sooty flame, low for a blue one

### FuelBed

*interface* · `packages/vfx/src/spread.ts:18`

```ts
interface FuelBed
```

a surface fuel bed of one size class of dead fuel, in SI units (the report's input table, metric)

- `name: string`
- `load: number` — oven-dry fuel load, kg/m^2
- `sav: number` — surface-area-to-volume ratio, 1/m (the report's 1/ft divided by 0.3048)
- `depth: number` — fuel bed depth, m
- `moistureExtinction: number` — dead fuel moisture of extinction, fraction
- `heat: number` — low heat content, kJ/kg
- `density: number` — oven-dry particle density, kg/m^3
- `mineralTotal: number` — total and effective mineral content, fraction
- `mineralEffective: number`

### GameDef

*interface* · `packages/vfx/src/def.ts:232`

```ts
interface GameDef
```

what the effect does to the game

- `occlusion?: { extinction: Expr; radius: Expr; height?: Expr; shape?: 'sphere' | 'column' | 'slab'; rise?: Expr }` — smoke against sight: an extinction coefficient per metre (Beer-Lambert), inside a volume that follows the plume
- `stimulus?: { kind: 'fire' | 'light' | 'noise' | 'smoke'; intensity: Expr; radius: Expr }` — a thing the AI can notice, from as far as `radius` (more at night for fire and light)
- `fire?: { power: Expr; radius: Expr; fuel?: string; spreads?: boolean; promote?: boolean }` — the effect is a fire: heat power in W over a radius; it spreads and can be put out; `promote` makes it a combustion source in the physics world
- `tags?: string[]` — names for finding and stopping groups of effects

### Gather

*interface* · `packages/vfx/src/gather.ts:70`

```ts
interface Gather
```

- `origin: readonly [number, number, number]` — the batch origin in world metres: positions are written relative to it, so the GPU's floats stay small
- `camera: readonly [number, number, number]`
- `alpha: number` — multiplies every particle's alpha (a cross-fade between rungs)
- `sort: 'distance' | 'age' | 'none'` — adds the sort key: distance to the camera, or age

### GlowOpts

*interface* · `packages/vfx/src/catalog-kit.ts:53`

```ts
interface GlowOpts
```

- `name: string`
- `max?: number`
- `rate?: Expr`
- `bursts?: Array<{ at: Expr; count: Expr }>`
- `runFor?: Expr`
- `delay?: Expr`
- `shape?: SpawnShape`
- `life: Range`
- `velocity?: VelocityDef`
- `size: Range`
- `sizeCurve?: Array<[number, number]>`
- `rgb?: Rgb`
- `gradient?: Gradient`
- `alpha?: Array<[number, number]>`
- `emissive?: number | string`
- `modules?: ModuleDef[]`
- `flip?: string`
- `spin?: Range`

### GovernorOptions

*interface* · `packages/vfx/src/governor.ts:28`

```ts
interface GovernorOptions
```

- `targetMs: number` — the frame time the effects must fit in, milliseconds (the share of the frame given to effects, measured by the caller)
- `maxParticles?: number` — a ceiling on live particles; above it counts as over budget
- `downAfter?: number` — frames over the target in a row before a step down (default 8)
- `upAfter?: number` — frames under `margin` of the target in a row before a step back up (default 120)
- `margin?: number` — a frame is comfortable under this share of the target (default 0.7)

### GovernorStep

*interface* · `packages/vfx/src/governor.ts:8`

```ts
interface GovernorStep
```

- `readonly name: string`
- `readonly cap: Rung` — the richest rung allowed
- `readonly spawn: number` — the share of spawns that go ahead (thinning by particle index)
- `readonly life: number` — the share of its life a new particle keeps

### GradientKey

*interface* · `packages/vfx/src/def.ts:15`

```ts
interface GradientKey
```

- `at: number`
- `rgb: Rgb`
- `alpha?: number`

### GridOptions

*interface* · `packages/vfx/src/grid.ts:7`

```ts
interface GridOptions
```

- `cell: number` — the cell size in metres (sets the scale of buoyancy and of the velocities)
- `ambient: number` — ambient temperature, in the same arbitrary unit as the heat sources (kelvin is natural)
- `buoyancy: number` — the acceleration (m/s^2) of gas much hotter than the air: g (T - ambient) / T, so the value is about 9.8 for gas that is free to rise
- `weight: number` — downward acceleration (m/s^2) per unit of density: heavy smoke sinks, cold smoke settles
- `vorticity: number` — vorticity confinement strength (0: smooth, 1: very curly)
- `fade: number` — per-second: the fraction of density lost (1/s)
- `cooling: number` — per-second: the temperature relaxes toward ambient at this rate (1/s)
- `turbulence: number` — strength of the noise force (m/s^2) and the size of its cells in grid cells
- `turbulenceScale: number`
- `iterations: number` — pressure iterations per step
- `drag: number` — velocity damping (1/s)
- `openTop: boolean` — is the top open (the flow leaves), or a lid
- `maccormack: boolean` — the scalars are advected with MacCormack (sharper, three samples a cell) or plain semi-Lagrangian (one; for the live solver)

### ImpostorRender

*interface* · `packages/vfx/src/def.ts:120`

```ts
interface ImpostorRender
```

the `impostor` rung: one cheap object for the whole effect

- `kind: 'strip' | 'card' | 'flash'`
- `asset?: string`
- `height?: Expr`
- `width?: Expr`
- `lean?: Expr` — how far the strip leans downwind per metre of height
- `color?: Rgb` — the colour and opacity of the strip; default: the first emitter's colour (grey for smoke), 0.6 (0.9 for glow)
- `alpha?: Expr`
- `glow?: boolean` — added to the picture instead of covering it (fire); a `flash` is always glow
- `core?: boolean` — a strip of an effect with flames also draws the glow of the flames (a hot additive strip the height of the flame, coloured by the fire's temperature); default true, false to leave it out

### Instance

*interface* · `packages/vfx/src/sim.ts:101`

```ts
interface Instance
```

- `readonly id: number`
- `readonly cdef: CompiledDef`
- `readonly seed: number`
- `readonly params: Record<string, number>`
- `readonly vars: Record<string, number>`
- `readonly emitters: EmitterState[]`
- `readonly attach?: { entity: number; node?: string }`
- `readonly parent: number`
- `readonly children: number[]`
- `readonly axis: Vec3`
- `readonly curlOff: [number, number, number]` — where this instance reads the curl field, from its seed
- `t: number` — seconds since the effect started (it waits `startIn` first)
- `startIn: number`
- `duration: number`
- `pos: Vec3`
- `prev: Vec3`
- `vel: Vec3`
- `stopped: boolean`
- `ended: boolean`
- `started: boolean`
- `queue: QueuedSpawn[]`

### Issue

*interface* · `packages/vfx/src/validate.ts:9`

```ts
interface Issue
```

- `path: string`
- `message: string`

### LibraryFlipbook

*interface* · `packages/vfx/src/textures.ts:68`

```ts
interface LibraryFlipbook
```

what the asset library gives for a flipbook (`AssetLibrary.flipbook(id)`): the item and the encoded images by name

- `item: { cols: number; rows: number; frames: number; motionScale?: number }`
- `files: Partial<Record<'color' | 'light' | 'light2' | 'motion' | 'depth', Uint8Array>>`

### LightDef

*interface* · `packages/vfx/src/def.ts:175`

```ts
interface LightDef
```

- `rgb: Rgb | 'temperature'`
- `intensity: Expr` — candela for point lights
- `range: Expr`
- `offset?: Vec3`
- `flicker?: { amount: Expr; rate: Expr }` — flicker as a fraction of the intensity and its rate per second
- `over?: Curve` — scales the intensity over the effect's life (position 0..1 of its duration)
- `shadow?: boolean`
- `farGlow?: Expr` — metres out to which the glow still lights the ground and clouds by a cheap term

### LightState

*interface* · `packages/vfx/src/parts.ts:39`

```ts
interface LightState
```

- `id: number`
- `pos: [number, number, number]`
- `rgb: Rgb`
- `intensity: number` — candela
- `range: number`
- `shadow: boolean`
- `farGlow: number` — metres out to which the cheap glow still counts

### LiquidProps

*interface* · `packages/vfx/src/droplets.ts:23`

```ts
interface LiquidProps
```

- `density: number`
- `surfaceTension: number`

### LiveOptions

*interface* · `packages/vfx/src/volume.ts:34`

```ts
interface LiveOptions
```

- `resolution?: number` — cells along a side (the walls take two of them), default 20
- `stepHz?: number` — the solver's steps per second, default 20
- `maxSteps?: number` — most steps one update may take (a stall must not become a spiral), default 1
- `seed?: number`

### LoopSound

*interface* · `packages/vfx/src/def.ts:228`

```ts
interface LoopSound extends SoundBase
```

- `fadeIn?: Expr`
- `fadeOut?: Expr`

### NetLike

*interface* · `packages/vfx/src/vfx-net.ts:29`

```ts
interface NetLike
```

the part of the net service the replica uses (`NetService` of `@ferret/net` is this)

- `readonly id: string`
- `send(name: string, data: unknown, to?: string): void`
- `on(name: string, fn: (data: any, from: string) => void): () => void`

### OneShotSound

*interface* · `packages/vfx/src/def.ts:222`

```ts
interface OneShotSound extends SoundBase
```

- `at: Expr` — seconds after the effect starts
- `delayBySpeed?: boolean` — arrives later by distance at the speed of sound in the medium; default true

### ParamDef

*interface* · `packages/vfx/src/def.ts:19`

```ts
interface ParamDef
```

- `unit?: string` — the unit, for the editor and the docs: 'W', 'kg', 'm', 'K', ''
- `default: number`
- `min?: number`
- `max?: number`
- `doc?: string`

### ParticleRender

*interface* · `packages/vfx/src/def.ts:71`

```ts
interface ParticleRender
```

the `particles` rung: GPU particles with flipbooks

- `kind: 'billboard' | 'streak' | 'ribbon' | 'mesh'`
- `flipbook?: string` — library asset ids; the flipbook is a sprite sheet, optionally with motion vectors and six-way light
- `texture?: string`
- `mesh?: string`
- `blend: BlendMode`
- `soft?: Expr` — depth fade distance, metres; 0 or absent: hard edge
- `lit?: boolean` — takes the scene's light (six-way lightmaps for smoke)
- `emissive?: Expr` — emission multiplier; with a temperature the colour follows the blackbody
- `motionBlend?: boolean` — blend between flipbook frames by motion vectors
- `stretch?: Expr` — streak: length in seconds of travel; ribbon: width in metres
- `width?: Expr`
- `sort?: 'distance' | 'age' | 'none'`

### PartRef

*interface* · `packages/vfx/src/def.ts:244`

```ts
interface PartRef
```

composition: an explosion is a fireball plus a flash, debris, dust, a smoke column, a scorch and a sound, each an effect of its own

- `def: string` — the name of another effect definition
- `offset?: Vec3`
- `delay?: Expr`
- `params?: Record<string, Expr>` — parameters of that effect, set from this effect's scope

### PartsViewOptions

*interface* · `packages/vfx/src/parts-view.ts:126`

```ts
interface PartsViewOptions
```

- `maxLights?: number` — the most point lights the effects may light at once; default 4 (the number a standard material takes)
- `groundHeight?: (x: number, z: number) => number` — the height of the ground at a point, for decals and the foot of far plumes
- `shadowCasters?: () => BABYLON.AbstractMesh[]` — meshes that cast the shadow of a light that asks for shadows (the strongest such light gets one)
- `maxDecals?: number` — most decals alive at once; the oldest go first; default 256
- `maxFar?: number` — most strips and dots drawn; default 2048
- `candelaScale?: number` — scale from candela to Babylon's light intensity; default 1/400
- `maxLightIntensity?: number` — the most Babylon intensity one effect light may take, so that a huge fire does not burn the picture out; default none
- `steadyLights?: boolean` — keep the pool's lights switched on, at intensity 0 while unused: the number of lights a material sees then never changes, so no material recompiles when an effect lights up or goes out (a switched light changes every lit material's shader; while the new shaders compile Babylon draws nothing of those meshes). Costs the shading of the idle lights; default false
- `maxTotalIntensity?: number` — the most the pool's lights may add up to: when several effects light the same place (a blast over a burning tanker and its pool fires) their intensities are scaled down together to this sum, so that the picture is lit and not burnt out; default none

