Feature Library

Fireworks with real colour chemistry

6.54 GPU · 0.13 CPU ms
A still of the Fireworks with real colour chemistry demo
Still
The live demo starts when it’s in view.Click or tap the sky to launch a shell there · Enter or Space launches one

Shells launched by kind and colour to burst where you point.

What it costs a frame

6.54 ms
0.13 ms
GPU
6.54 ms
CPU, median
0.13 ms
CPU, 95th pct
0.22 ms
Draw calls
0
Weight
Heavy

Measured 11 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured with the automatic show running at its defaults (about a shell a second, low quality): compute steps over the live shells’ slots, the backdrop, the sparks and their reflection, and the pass out, timed with timestamp queries. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool6.540.130.22
apple · Apple A19 Proin a browser tab · 16 November 20266.890.260.40
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20263.600.270.43

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
WebGPU or WebGLWebGPU where there is one, WebGL2 where there is not.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Celebrations and launch moments
  2. Game victory screens
  3. New-season and event splashes
  4. Night scenes over water
  5. A word written in light
  6. Teaching colour and heat

Pitfalls, in brief

  1. A shell aims its comet on the CPU by stepping its flight exactly as the GPU will (60 Hz steps, the same drag and wind): change the step or the GPU’s integration and the bursts drift from where you pointed.
  2. Gravity and wind are read at launch to aim: changing them while a comet is up makes it burst somewhere else (it bursts where it is when its fuse runs out).
  3. Every slot of a block is drawn and stepped while the block is live, alive or not: keep the pool (the budget) to what your scenes need, and the trails down on small GPUs: trails are most of the sparks.
  4. A full pool steals the block whose sparks go out soonest: a shell in the air can be cut short when far more are launched than the pool holds.
  5. The sparks are HDR and additive: draw them into a float target and tone-map, or bright colours clip to flat primaries.
4 more in brief
  1. Never queue more than one frame ahead: frame() skips while the last one is still on the GPU and the steps catch up next frame (up to eight).
  2. The finale’s word needs half the pool (one block a shell, up to twelve): on a pool under six it is refused.
  3. Without WebGPU use createFireworksGL (async; null without WebGL2 and float colour targets, then show a still): the same planner and shaders, the step a fragment pass over float textures.
  4. Under reduced motion pass calm: no strobes, glitter or crackle flashes, the burst’s flash swells in instead of popping, and time runs at 0.7.
9 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From SpaciousPro. Fully custom code.

Mark Jarzynski and Marc Olano, “Hash Functions for GPU Rendering” (JCGT 2020): The PCG hash every spark’s own numbers come from, on the GPU and (for the word’s points) on the CPU.

Planck’s law: Trails, charcoal stars and dying stars take a blackbody’s colour at their temperature, worked out from the law at three wavelengths.

Christophe Schlick, Fresnel approximation (1994): How much of the sky the water mirrors at each angle.

Miles Macklin, “Faster fog” (2010): The haze round each burst is the closed-form (atan) integral of a point light’s inverse-square in-scattering along the ray, the result he writes up.

The parametric heart curve (16 sin³t, 13 cos t − 5 cos 2t − 2 cos 3t − cos 4t): The heart shell’s outline: a well-known curve.

fireworkscomputeraw webgpuwgslwebgl2 fallbackblackbodyadditivereflectionparticlessequencer

Near it in the frame