Series

How Wave Function Collapse Works

Procedural generation from local constraints

Wave Function Collapse (WFC) generates complex patterns from simple rules. Start with a small example and watch the algorithm propagate constraints to fill an entire grid, volume, or sequence.

  1. 001
    Intermediate The 2D Simple Tiled Model

    Observe, collapse, propagate -- the canonical Wave Function Collapse loop, running on a 2D grid you can watch.

    3 min
  2. 002
    Intermediate 3D Isometric WFC

    Six neighbours instead of four -- the same algorithm, one dimension up, rendered with an isometric camera.

    2 min
  3. 003
    Intermediate WFC for Music

    A one-dimensional WFC where the tiles are chords, the adjacency rules come from music theory, and everything plays through Web Audio.

    3 min
  4. 004
    Intermediate WFC for Text

    A 1D WFC where the tiles are syllables, words, and sentence fragments -- and adjacency encodes linguistic structure.

    3 min
  5. 005
    Advanced The Overlapping Model

    Instead of hand-authored tiles, learn adjacency rules from a sample image -- then grow a bigger image that is locally similar everywhere.

    4 min

Going Deeper

Robustness and speed -- making WFC work reliably and efficiently at scale.

  1. 006
    Advanced Constraints & Backtracking

    What happens when WFC paints itself into a corner -- failure recovery, constraint propagation strategies, and how to make collapse more robust.

    6 min
  2. 007
    Advanced Performance & Entropy Heuristics

    Making WFC fast -- smarter cell selection, acceleration structures, and techniques for real-time generation.

    6 min