All effects

heat = avg(below) − cooling

Fire.

1993 to today

Seed the bottom line with random heat, let it rise and cool, colour it black-red-yellow-white. A few lines of code that every coder of the '90s wrote at least once, and that still looks alive.

8-bitPCGPU

How it works

The algorithm

Keep a buffer of heat values. Every frame, write random hot and cold values into the bottom row. Then, from top to bottom, set each cell to the average of the cells below it, minus a little cooling. Heat drifts upward, spreads and fades. Map heat through a palette that runs from black through red and yellow to white. Doom's version instead copies each value one row up with a random sideways jump and a random decrement.

The old-hardware trick

Heat is one byte per pixel and the palette does the colouring, no RGB maths at all. The average of four neighbours is three additions and a shift by 2. On VGA mode 13h the heat buffer can simply be the screen.

Per frame, in pseudo-code
bottom_row = random(0 or 255)
for y in 0..h−1:
  for x in 0..w−1:
    heat[y][x] = ( heat[y+1][x−1] + heat[y+1][x]
                 + heat[y+1][x+1] + heat[y+2][x] ) >> 2
                 − cooling
pixel = palette[heat]          // black → red → yellow → white

// Doom PSX: heat[y−1][x − r + 1] = heat[y][x] − (r & 1)

Timeline

Documented milestones, with a source for each. Famous examples, not claims of who did it first.

  1. 1993PC

    FIREDEMO

    Javier ‘Jare’ Arévalo / VangeliSTeam · DOS · VGA

    Coded 9–10 May 1993 and released with source: the first famous fire effect, months before Iguana's Inconexia. Hans Wennborg's walkthrough quotes Jare on how it works.

    Source
  2. 1993PC

    Fire in a full demo

    Iguana · Inconexia · DOS

    Shown at Assembly 1993: the fire as part of a complete production, beyond a stand-alone experiment.

    Source
  3. 1995PC

    The Doom fire

    PlayStation Doom team · PlayStation

    The title-screen fire moves palette-indexed heat upward with random decay and sideways displacement, not the four-neighbour average.

    Source
  4. 20028-bit

    Fire in 256 bytes on a C64

    Flugeldufel · Fire [256 byte] · Commodore 64

    A tiny fire on the old 8-bit machine, as a size-coding challenge.

    Source
  5. 2007GPU

    Perlin Fire

    Andrei Tatarinov / NVIDIA · GeForce 8800 · shaders

    Volumetric flames from 3D and 4D simplex noise, animated per pixel instead of propagating a 2D heat buffer.

    Source
  6. 2018GPU

    How Doom fire was done

    Fabien Sanglard (after Samuel Villarreal) · JavaScript

    A compact, inspectable reconstruction of the palette and transport mechanism, building on Doom 64 reverse engineering.

    Source
  7. 2019GPU

    The classic fire on a GPU

    4rknova · GLSL

    Weighted upward heat propagation and a colour lookup in shader passes, the original mechanism preserved instead of noise-only flames.

    Source

Over time

6 live versions, from the oldest platform to today: 4 on the CPU, 2 on the GPU. Retro versions run at their original resolution and palette. Demos pause when off screen.

PC · VGA mode 13h

Averaging fire

1993

Random bottom row, four-neighbour average, cooling by one per row, a 256-colour black-red-yellow-white palette.

PCCPUheat buffer256 colours
Detail page
C64 · multicolour

C64 fire

2002

The same algorithm in fat 2:1 pixels and the C64's own muted fire colours: black, red, orange, light red, yellow, white.

8-bitCPU16 colours256-byte spirit
Detail page
PlayStation · 37 colours

Doom fire

1995

Fabien Sanglard's reconstruction of the PSX Doom fire: 37 palette indices, each copied one row up with a random sideways hop and decay.

PCCPUDoom37-colour palette
Detail page
PC · VGA

Burning logo

mid-'90s

The intro classic: the letters themselves are the heat source, so the name burns. In a cooler, violet-to-white palette.

PCCPUlogoheat source
Detail page
GPU · GLSL

Noise flame

2007

No buffer, no history: domain-warped fractal noise scrolls upward through a flame-shaped falloff, evaluated per pixel.

GPUGPUfbmprocedural
Detail page
GPU · raymarched

Volumetric fire

today

A turbulent cone of density marched along every view ray, glowing by temperature, while the camera circles it.

GPUGPUvolumeraymarching
Detail page