Creates a grid; anything not given uses DEFAULT_GRID.
Optionaladvect?: [number, number, number, number]Per channel: 1 = the channel persists and is advected (semi-Lagrangian) by wind + rise each
resolve, decaying at decay, and splats are rates (added × dt); 0 = the channel is just this
frame's splats (e.g. density).
Optionaldecay?: [number, number, number, number]Per channel exponential decay of advected values, 1/s.
Optionalmin?: [number, number, number]Minimum corner, local space of the systems that use it, metres.
Optionalresolution?: [number, number, number]Cells along x, y, z. Changing it rebuilds the buffers.
Optionalrise?: numberAdvection velocity: extra updraft, m/s.
Optionalsize?: [number, number, number]Extent, metres.
Optionalwind?: [number, number, number]Advection velocity: air wind, m/s.
ReadonlyaccumulatorAtomic fixed-point accumulators, 4 ints per cell (written by splats, cleared by resolve).
ReadonlycellsNumber of cells.
ReadonlyfieldThe field, one vec4 per cell, read by ParticleGrid.sample.
Resolved settings.
ReadonlyresolutionCells along x, y, z.
ReadonlyuniformsUniforms: bounds, advection and per-channel settings.
Per-channel advect flags.
Per-channel decay.
Seconds since the last resolve.
Minimum corner.
Extent.
Advection velocity (wind + rise).
Cell size along x, y, z, metres.
Frees the GPU buffers' compute pipelines.
Turns this frame's splats into the field: advects persistent channels, adds splats, clears the accumulators.
The two resolve passes for dt, to batch with other compute work in one renderer.compute([...]).
Trilinear sample of the field at local position p (vec4; zero outside the grid). Any shader stage.
Merges input; bounds, advection and decay are live, a new resolution needs a new grid.
Optionaladvect?: [number, number, number, number]Per channel: 1 = the channel persists and is advected (semi-Lagrangian) by wind + rise each
resolve, decaying at decay, and splats are rates (added × dt); 0 = the channel is just this
frame's splats (e.g. density).
Optionaldecay?: [number, number, number, number]Per channel exponential decay of advected values, 1/s.
Optionalmin?: [number, number, number]Minimum corner, local space of the systems that use it, metres.
Optionalresolution?: [number, number, number]Cells along x, y, z. Changing it rebuilds the buffers.
Optionalrise?: numberAdvection velocity: extra updraft, m/s.
Optionalsize?: [number, number, number]Extent, metres.
Optionalwind?: [number, number, number]Advection velocity: air wind, m/s.
A compute pass adding value(particle) into channel of the cell each live particle is in (P2G,
nearest cell, atomic). Built once per system; run it with renderer.compute after the system's
update and before ParticleGrid.resolve.
A cached ParticleGrid.splat pass per (system, channel) key object.
An optional coarse 3D grid that particles write to and read from: four float channels per cell, built for particle-to-grid (P2G) and grid-to-particle (G2P) passes. Systems splat into it with ParticleGrid.splat (atomic adds, any value per particle), ParticleGrid.resolve turns the splats into the field (and advects persistent channels), and any shader samples it with ParticleGrid.sample (trilinear).
Today it carries a fire's heat (lifting the smoke into a column that leans downwind) and the smoke's own density (self-shadowing). It is also the skeleton an MPM solver needs: momentum + mass splats, a grid update and a gather; see the package README.