All effects

height = screen_h / distance

Raycasting.

1982 to today

Not a ray per pixel: a ray per column. Walk it across a flat tile map until it hits a wall, and the distance tells you how tall to draw that slice. The trick that let a 1 MHz 6502 draw a maze in 1982, and later made a 286 feel like a 3D world.

Research8-bit16-bitPCGPU

How it works

The algorithm

The world is a 2D grid of wall tiles, seen from eye height. For each screen column, cast one ray from the player across the grid with a DDA (digital differential analyser): step to whichever cell border, x or y, comes first, until the cell holds a wall. The perpendicular distance to that wall gives the height of the vertical slice to draw, centred on the horizon. Where along the wall the ray landed picks the texture column; scale that column to the slice height and you have textured walls. Floors and ceilings come from casting per row instead: every row of the floor is one fixed distance away, so its texture coordinates step linearly across the screen.

Why a 286 could do it

320 rays instead of 64,000, and each ray only adds a precomputed delta per grid line. Using the distance perpendicular to the camera plane (not the true ray length) removes the fish-eye bulge for free. Walls are always vertical and the eye never tilts, so every wall slice is a pure vertical scale of one texture column: Wolfenstein 3D compiled a scaler routine per height. Shading y-facing walls darker gives instant depth.

Per frame, in pseudo-code
for x in 0..319:
  ray = dir + plane · (2x/320 − 1)
  cell = floor(pos) ;  side_dist, delta = ...
  while map[cell] == 0:                 // DDA
    if side_dist.x < side_dist.y: step x
    else: step y
  d = perpendicular distance
  slice = 200 / d
  draw texture column u = frac(hit) scaled to slice

Timeline

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

  1. 19828-bit

    Wayout

    Paul Lutus · Sirius Software · Atari 8-bit · Apple II

    A first-person maze with free rotation, drawn column by column across a tile map on a 1 MHz 6502: generally named as the first raycasting game.

    Source
  2. 198716-bit

    MIDI Maze

    Xanth Software F/X · Atari ST

    Flat-shaded raycast maze on an 8 MHz 68000, with up to 16 STs linked over their MIDI ports for the first deathmatches.

    Source
  3. 1991PC

    Hovertank 3D

    id Software · MS-DOS · EGA

    Flat, untextured walls drawn by casting rays across a tile map: the first of two raycasting games John Carmack built for Softdisk before Wolfenstein.

    Source
  4. 1991PC

    Catacomb 3-D

    id Software · MS-DOS · EGA

    Added texture-mapped walls in 16 colours, the bridge between Hovertank and Wolfenstein.

    Source
  5. 1992PC

    Wolfenstein 3D

    id Software · MS-DOS · VGA

    256-colour textured walls at speed on a 286: not the first raycaster, but the VGA breakthrough that took it mainstream and started the first-person shooter.

    Source
  6. 1992PC

    Voxel Space

    NovaLogic · Comanche · MS-DOS

    The same per-column casting over a height map instead of a tile grid. See the voxel landscape page for that branch.

    Source
  7. 2004Research

    Lode's raycasting tutorial

    Lode Vandevenne · Tutorial

    The widely used write-up of DDA wall casting, textures, floor casting and sprites that most modern raycasters are learnt from.

    Source

Over time

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

Atari 8-bit · 6502

Wayout maze

1982

In the spirit of Paul Lutus's Wayout: a handful of chunky columns, four colours, two wall shades by facing and black outlines at corners, at a modest frame rate. Free rotation through a tile map on a 1 MHz CPU.

8-bitCPUDDA4 colourschunky
Detail page
PC · EGA 16 colours

Flat walls

1991

Like Hovertank 3D: one ray per column, one flat colour per wall material, darker on the y-sides. Grey ceiling, green floor.

PCCPUDDAEGA
Detail page
PC · VGA 320×200

Textured walls

1992

As in Wolfenstein 3D: brick, wood and stone textures, each wall slice one scaled texture column. Floors and ceilings stay flat colour.

PCCPUtexture columns256 colours
Detail page
PC · VGA

Floor & ceiling casting

1993

Textured floors and ceilings cast per row, plus distance shading: the step the later raycasters took before Doom moved on to sectors.

PCCPUfloor castingfog
Detail page
GPU · GLSL

Per-pixel raycaster

today

Every pixel runs its own column's DDA in a fragment shader: the old algorithm, unchanged, a thousand times over.

GPUGPUDDAshader
Detail page