Black Week: −40% Pixor is $19.99 $11.99 until 2 December, on itch.io →

Volumes: smoke, fire and liquids

A volume is a box of voxels rather than a surface: a smoke plume, a flame, an explosion, water. Pixor reads .vdb files from Blender, EmberGen and Houdini, and has a few of its own for when you have no simulation tool.

A volume has no geometry. It is drawn by walking a ray through it for every pixel, on the processor, and what comes out goes into the same picture the model does — so a flame sits in front of a hand, a character stands inside smoke, and the bands, lines and cleanup treat it exactly as they treat anything else.

Adding one

In the Scene step, the Outliner’s + menu, under A volume:

Puff a round puff of smoke
Flame hot and narrow below, cool and wide above
Cloud wide, flat underneath, lumpy on top
Mist thin, low and even
From a .vdb file… a simulation from Blender, EmberGen or Houdini

A volume is a Volume node of the Scene graph, and its row in the Outliner is the same node: a Row after it is a row of volumes, each placed by its copy, and one wired into nothing is not in the scene. Its settings are on the node too (pxr project scene game.pixor --set flame.voxels=48, by the volume’s name).

On the command line: --volume flame:0.5,0.8,0.5:0,0.55,0, where the numbers are the size and then the position, in metres. A path to a .vdb works in the same place: --volume smoke.vdb:1.2. Left without a size (smoke.vdb, fire_0001.vdb::0,1,0:24), a file is drawn at the size it was baked, as the app opens it.

Size is what it draws. A file’s size and place are measured on the box of what the look draws of it, over every frame it draws, not on its domain: the faint haze a simulator leaves up to its walls is left out, so widening a domain to stop a plume being cut off does not shrink it, and thin smoke a long ray adds up is counted, so a low Thickness that draws a tall, wispy plume is never cut at the top of the sprite. A lower Thickness draws more, so the same Size then holds a smaller fire with its plume.

Carried by a bone, a volume goes where the bone goes in every clip — a torch’s flame in a hand — and stays upright, as fire does; its position is then measured from the bone. On the command line, @BONE at the end: --volume flame:0.25:0,0.05,0@hand.r.

Turns with it: carried by a bone or a part that also turns it — a missile’s exhaust, a beam from a staff, an aura on a banking ship. Its position is then measured along the node’s own axes and places the volume’s middle, not its bottom, so a trail lies on the nozzle’s line. On the command line, :on=NODE: --volume exhaust_0001.vdb:4:-2.7,0,0:28,2,4:on=Body puts a plume four metres long behind a missile flying +x, on every side of a ring and in every pose of its clips.

Any of its settings follows as :KEY=V, by the name the project file gives it: --volume boom_0001.vdb:3::40,1:colour=#4a3a4a:fire=fire:glow_over=0.15 (fire is a ramp’s name, #hex colours coolest first, or none). On a project, pxr project set game.pixor --volume-colour '#4a3a4a' --volume-fire fire sets the colours of the volumes it adds.

Carried by an effect’s emitter, a volume is part of that effect: it is drawn on the effect’s own rows, from the effect’s first frame, wherever the emitter is — on its bone, or where a clip’s keys move it — and on no other row. The smoke of an explosion, the fire of a spell. Its position is then measured from the emitter. On the command line, @effect:N for the project’s Nth effect: --effect explosion --volume puff:1.5@effect:1.

How it is drawn

These are under How it is drawn in the volume’s Inspector.

A Flame volume over a brazier, drawn in pixel-art bands from hot to cool

  • Thickness is how much volume a pixel needs before it is drawn at all. Higher gives a tighter, harder shape; lower a wispier one.
  • Soft edge is how wide the fraying edge is. The edge is dithered away in an ordered pattern anchored to the volume itself, never blended, so every pixel stays on the palette and the pattern does not crawl as the volume turns.
  • Self-shadow is how much the volume darkens where the light has to come through it.
  • Colour is the volume’s own — its smoke — and its ramp is built from it. Fire colours are the colours the part that burns is drawn in, coolest first: a dull red rim, then orange, yellow and a white-hot core. The hotter a part, the further along the list it takes, each colour a band of its own that glows whatever the light. Type one of the effects’ ramps (fire, frost, magic, poison…) for a blue or a green fire (the volume’s Scene graph node lists them), or up to eight #hex colours, commas between; none means nothing burns, which is what smoke wants. A volume opened from a .vdb comes in at the size it was baked. Glows over says how hot a part has to be before it burns at all; the heat above it is cut evenly between the fire colours, up to Hottest at: heat over that takes the hottest colour. Both are shares of the hottest flame of the whole sequence, so a one-frame flash would leave everything else in the two coolest colours; lower Hottest at (heat_max=0.4) and a snowflake held for ten frames before it shatters burns white at its heart. Fire by frame (heat_each_frame=on) bands each frame from its own hottest flame instead. A simulation’s heat is smoothed as it is read, and so is the smoke its light is taken from (its outline stays its own), so the bands are shapes, as a pixel artist draws fire and smoke, rather than the speckle of every voxel.
  • Smoothing is how many times that is done, 0 to 8 (1 to start with). 0 keeps every voxel’s own light; a big, churning simulation whose smoke comes out mottled wants 3 or so, for broad lit and shaded sides and wider fire bands.
  • Voxels is how finely the volume is cut up along its longest side. A sprite pixel wants one or two voxels: more only shimmers, because a different voxel wins the pixel every frame. A 256³ simulation is cut down to this on load, which is why a plume at 32 px stays still.
  • Samples is how many points on a ray are looked at per voxel. Two is enough at sprite sizes; more is smoother and slower.

Volumes take no glint: a cloud has none, and the density they are shaded from is bumpy enough to sparkle if they were allowed one.

Sequences: making it move

One .vdb is one still volume. A simulation writes a file a frame — fire_0001.vdb, fire_0002.vdb, and so on — and pointing Pixor at the first of them plays the rest.

In the volume’s Sequence section:

Frames how many files to play, counting on from the one you opened
Every take one file in N: a simulation is usually written at more frames than a sprite wants
Close the loop over cross-fade this many frames from the end back into the start, so the sprite plays round and round without a jump. Those files become the fade and do not play: five files with a fade of one are four frames

On the command line the sequence follows the size and the place: --volume fire_0001.vdb:1.5::24,2,4 — 24 files, every second one, the last four faded back into the first.

A sequence plays along with whatever motion the sheet already has: put a fire beside a walk cycle and the fire’s frames are the walk’s frames. When there is nothing else moving, the sequence is the motion and gets an action of its own, called volume, and an effect can play inside it like inside any clip: --volume blast_0001.vdb:6::28 --effect debris@volume+2 throws the debris of a simulated explosion on its third frame. A looping effect laid over a one-shot sequence (--effect sparkle@volume+8) stops on the last frame the volume is drawn on, dying down by then, so the whole ends at nothing; stop=F or once says otherwise.

Every frame is placed by the same transform, taken from the box the whole sequence fills (what its drawn frames draw), so a plume that grows does not shrink the picture back each frame. That also means Size is the size of the whole sequence, not of its first frame.

A sequence is never in memory whole: each file is read once to find that box, and then again when the sheet or the preview reaches its frame, with the last three kept. A long simulation costs time to read, not memory.

What Pixor reads

.vdb files holding float or vector grids in the usual tree, with values stored plainly, zipped, or packed with Blosc-LZ4 (split into a stream per byte or not, as Blosc 1.14 and later write it), all of them or only the active ones — which is what Blender, EmberGen, Houdini and OpenVDB’s own tools write. Pixelates for a grid named density, smoke, fog or d, then flame, fire, temperature or heat for the hot part (the first the file has, even empty: where a fire burns is what glows, while its temperature runs on up through the smoke, so a fire whose flames have gone out leaves smoke, not a glowing cloud), then velocity for the motion the anti-flicker pass uses. A liquid’s surface (a level set) is read as a thickness with a hard edge, solid all the way through.

Flames are drawn however thin the smoke. A flame grid counts as thickness wherever it burns, so a fire whose smoke dissolves — Blender’s Fire flow, or smoke with Dissolve on — is still its flames. Where the volume is hot it takes its Fire colours, hottest last, whatever the light; Glows over is how hot, as a fraction of the hottest flame.

Blender’s bakes stand up. Blender has +Z up, where OpenVDB, Houdini and EmberGen have +Y. Pixor knows a Mantaflow file by the tag Blender writes on its grids and turns it upright, so a plume rises as it did in Blender. A level set you write yourself is taken as +Y up.

Anything Pixor cannot read says so by name rather than coming out wrong: another compressor, another kind of tree, a sheared transform. pxr inspect fire.vdb prints a file’s grids, their size and their voxel size.

What is not there yet

  • Liquids are read and drawn as a volume, with no foam and no reflection. A sheet of water with both is the world’s Water node (Worlds).

What this page describes is in the full version; the free browser demo keeps to the default look and the PNG sheet.

Try in browser Get Pixor