Field notes / Simulation

Fog, flame and water you can stir: the Solver Atelier

A prismatic mist, a living torch and cerulean water: three real-time simulations you can stir in your browser, how they work, and the rules that keep them calm.

The Solver Atelier's three media side by side: a prismatic mist with colour on its thin rims, a torch flame throwing sparks, and a still cerulean pond with lily pads

The Solver Atelier is open. It is one page with one stage and three media you can put your hand into: fog, flame and water. Each one is a real-time simulation running on your graphics card, not a video and not a loop. Move the pointer through the mist and it parts and curls back. Breathe across the torch and it leans away. Touch the pond and a ring spreads from your finger.

This note is the tour: what each medium is, how it works underneath, and the rules that keep all three calm on a page meant for reading.

Three panels below show each medium as a lane page could use it: mist and flame along a card's lower edge, and a small waterfall beside a card. Point at a panel, or tap it, and its medium wakes up. Leave it and it settles, then stops drawing.

Fog · a sill of mist

Mist that keeps out of the words

This mist pools under the card's lower border and stays clear of the text. Stir it with the pointer or a finger: it parts, then drifts for two seconds after you leave and stops on a still.

Stir the full fog

Fog: a prismatic mist

The fog is a small fluid simulation. The air is a grid of velocities, and every frame the mist is carried along it, pushed a little toward incompressible, and given back the small swirls that a coarse grid would otherwise smooth away. A gentle breeze built from curl noise keeps it moving when you are not, so the banks clump and thin out like real mist instead of dissolving into a flat haze.

It is drawn as layered sheets, each lit by a soft light that marches through the fog above it, so a thick bank shades the mist behind it. Where the mist is thin, at its rims and wherever you have just stirred it, a prism film catches the light and shows the PGSX spectrum: blue, gold, green and violet. Thick fog stays grey.

Four presets give it four moods:

  • Prismatic Mist, the default, with colour on its rims.
  • Morning Haze, a warm gold, quiet and light.
  • Storm Fog, dense and cold blue.
  • Aurora Veil, three curtains of green, cyan and violet folding slowly through the night air. Bend them with the pointer.

Stir the fog

Flame · a hearth sill

A hearth along the ledge

A low row of small flames burns on this card's lower border and lights its edge. Pass the pointer along the card, or touch it, and they lean and flare. Leave it and they bank down to a smoulder, then the picture holds still.

Light the full torch

Flame: a torch that breathes

The flame is a small combustion simulation. Fuel enters at the burner in a few wandering lobes, burns into heat once it is hot enough, and the heat rises, curls and cools. The natural flames (Torch, Candle, Brazier) colour each cell by Planck's law for a blackbody, so they run from deep red through orange to a near-white core, the colours real fire makes. The others swap that law for PGSX colour ramps. Hot air bends the wall behind the flame (heat shimmer), and a couple of hundred sparks at most ride the rising air as short streaks, with ash drifting above them.

The base of every flame is shaped to its source. Fuel goes in as a rounded cup that tapers into the wick, torch head or brazier bowl, so the root is narrower than the flame above it and widens only as it rises.

Your pointer, or your finger, is a breath. Sweep across the flame to bend it, or hover close to fan it brighter. Six presets: Torch, Candle, Brazier, an Arcane violet, a blue Gas flame, and Ghostfire, a cold, pale spectral flame with a hollow core and slow tendrils.

Light the torch

Water · creative flow

Keep the work flowing

Creative flow is a lot like the small fall beside this card. It runs while you stay with it, and a hand in the stream changes its shape without stopping it. Run the pointer through the water to part it and watch it close again. Step away and it slows to a still, ready for when you come back.

Open the water

Water: four moods of cerulean

The water is one solver with four moods:

  • Pond. A grid of heights, each pulled toward its neighbours with a little momentum. That is all a wave is. The surface bends your view of the pebbles below and gathers sunlight into caustics.
  • River. A current that runs fastest down the middle and parts round two rocks. Your pointer leaves a trail of eddies that the water carries away.
  • Waterfall. A sheet that streaks longer as it falls faster. Your hand opens a gap exactly where it is, white at its edges, and the flow heals it.
  • Ocean. Eight to sixteen waves move the water in small circles, so the crests sharpen. Light glows through thin tops that face the sun.

The water answers your hand, but gently. A hover is a whisper and a deliberate stroke leaves a short trail. The rings stay close to where you touched, and the water is calm again about two seconds after you stop.

Touch the water

Built to be calm: the rules

Fog, fire and water are easy to overdo. Each of these media has its own design rules, written before the page was, in the same spirit as the line-work that runs through the rest of the site.

  • Content first. A medium never draws behind words. The mist and the flame keep to their cards' lower edges, the waterfall keeps to its own column, and the stage's captions sit under it, not on it.
  • No hard edges. A medium never ends on a drawn line. The stage fades into the page at its top and bottom, and every panel embellishment fades out on all four sides.
  • Motion is yours. Turn on reduced motion, or pause the little runner in the site's header, and each medium becomes one still picture. With high contrast or forced colours turned on, the simulations are switched off, and the cards and their words stay.
  • Rest when nobody is near. Left alone, the fog drifts and settles, the flame banks down, and the water eases to a stop. Then the drawing loop stops altogether, so a page you have walked away from costs nothing.
  • Nothing kept. Every setting lives in the page while you use it. Nothing is stored or sent.

Smart about your device

Before anything draws, the page takes a quick look at what it is running on, and picks one of four levels. A phone gets a lighter grid and a calmer frame rate. A device with no WebGL2, or with Save-Data turned on, gets still pictures instead. While a simulation runs, a governor watches how long each frame takes. If the device starts to struggle, it trims the grid, the sparks and the resolution a step at a time before you would notice a stutter, and climbs back up when there is room again.

The Atelier loads one medium at a time. The flame's code is only fetched when you first choose Flame, and switching media frees the old simulation completely before the next one starts. On this page each panel's code is fetched only as you scroll near it.

Open the Solver Atelier, pick a medium and stir it. If you have not yet seen them, the Physics lab and five more simulations you can touch are on the Simulation page. If you want fog that parts round your product, or water that answers a visitor's hand, in your own colours, start a conversation.

About the author

Jacob Alan Strange (StrangeBoltz) is an independent developer building PGSX: Precision Guided Simulation eXperiences, from games and apps to utilities and simulations.

About Jacob