NatureGL Firev1.0.0

Reference

Quality levels

Four tiers, from integrated laptop GPUs to stills and trailers. A tier sets the grid resolution, the raymarch budget, the pressure iterations and the advection scheme.

js
const fire = await FireSystem.create({ renderer, scene, camera, quality: 'medium' });   // 'med' works too
fire.setQualityLevel('ultra');
fire.quality;          // 'ultra'
fire.grid;             // { nx: 80, ny: 120, nz: 80, cell: 0.05 } for a 4 × 6 × 4 m domain
high
low
lowhigh
campfire on low (40×60×40, semi-Lagrangian) and on high (64×96×64, MacCormack for the scalars), from the same camera.

#At a glance

TierGrid (4×6×4 m domain)VoxelsRaymarch stepsVolume resJacobiAdvection
low40×60×4096K840.5×12Semi-Lagrangian
medium52×78×52211K1120.6×18MacCormack (scalars)
high64×96×64393K1400.85×24MacCormack (scalars)
ultra80×120×80768K1901.0×32MacCormack (scalars + velocity)

The volume resolution is relative to the canvas. On high-DPI screens it's capped at about 1.5× DPR pixels, and the TAA covers the rest. high is the default.

#Every field

QUALITY_LEVELS holds one object per tier:

Fieldlowmediumhighultra
n40526480Grid cells across the domain's x size. y and z follow the domain's aspect
steps84112140190Raymarch steps across the domain diagonal
scale0.50.60.851.0Volume render resolution relative to the canvas
jacobi12182432Pressure iterations per step
lsteps8101214Light-volume steps toward the key light
fsteps68810Light-volume steps toward the fire centroid
maccormackStateoffonononSecond-order advection of temperature and smoke
maccormackVelocityoffoffoffonSecond-order advection of velocity
coolingScale11.91.91.9Compensates the lower numerical diffusion of MacCormack
smokeFade0.10.60.60.6Smoke dissipation per second, compensated the same way
labelLOWMEDHIGHULTRADisplay name

Fuel always uses first-order advection, even on MacCormack tiers. Its numerical diffusion is part of how the flame front is tuned, and sharpening it only makes the flames taller, not crisper.

#Custom tiers

The tiers are plain objects that are read when the grid is built. Edit one before create() or setQualityLevel():

js
import { QUALITY_LEVELS } from 'naturegl-fire';

QUALITY_LEVELS.high = { ...QUALITY_LEVELS.high, scale: 0.6, jacobi: 18 };   // cheaper high
fire.setQualityLevel('high');                                              // rebuild with it

#Pick a starting tier

This is a rough guide rather than a benchmark. Profile on the hardware you target.

TargetTier
Integrated GPUs, phoneslow
Mid-range laptopsmedium
Apple M-series, discrete desktop GPUs at 1080p–1440phigh
Stills, trailers, postersultra

The cost is mostly the grid (voxels × Jacobi iterations) plus the raymarch (screen pixels × scale² × steps). A smaller domain at the same n looks sharper for the same cost. The demo drops a tier by itself when it averages under 28 fps at start-up. Copy that logic from demo/main.js if you want the same thing.