Raycasting

Version 5 of 5

Per-pixel raycaster.

GPU · GLSL · today

This version

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

How this version works

This GLSL version renders at a configured scale of 0.7, with every fragment independently walking the grid for up to 48 steps. The map is defined by shader conditions rather than a stored tile array, and wall height determines whether the fragment belongs to a wall, floor or ceiling. Wall patterns are procedural: brick uses staggered mortar tests, while the other materials use sinusoidal stripes. Walls combine side darkening, exponential distance fading and a vertical brightness gradient; the floor is a faded checkerboard and the ceiling a faded blue-grey.

The trick in this version

The fragment shader repeats the same horizontal ray traversal for every pixel in a column instead of sharing one CPU result across that column. GPU parallelism handles this duplication, while procedural map and material calculations avoid texture-buffer lookups.

Historical context

  1. 2004 · Lode Vandevenne

    Lode's raycasting tutorial

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

  2. 1992 · id Software

    Wolfenstein 3D

    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.

  3. 1992 · NovaLogic · Comanche

    Voxel Space

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

Platform
GPU · GLSL
Era
GPU
Rendered on
GPU
Tags
DDA · shader
Sources
Lode's raycasting tutorial (2004)Wolfenstein 3D (1992)Voxel Space (1992)