qmetrics.net

WaveFunctionCollapse

Procedural bitmap and tilemap generator from one example

WaveFunctionCollapse builds output images that reuse only local pixel patterns found in a sample input. It supports bitmap synthesis and tile-based level layouts for games and art.

Overview

WaveFunctionCollapse is a program that generates bitmaps resembling a provided input image at a local level. Outputs may only contain N×N pixel patterns that appear in the sample, and over many runs the frequency of patterns should stay close to what the input shows. The method starts from an unobserved grid, repeatedly collapses low-entropy regions to definite colors, and propagates constraints until the image is fully determined or hits a contradiction.

Beyond flat images, the same ideas extend to tilemaps through a simple tiled model with adjacency rules, symmetry helpers for tilesets, and support for constraints so partial human-made layouts can be completed automatically. Higher-dimensional voxel-style models and combinations with other synthesis methods are further applications.

You can build the reference implementation from source with .NET Core on Windows, Linux, or macOS, download a Windows release, use an interactive build from itch.io, or run a version in the browser. The algorithm has been reimplemented in many languages and adapted into game engines such as Unity, Unreal Engine 5, Godot 4, and Houdini. Commercial and indie titles including Bad North, Caves of Qud, Townscaper, and others have used it for procedural content.

The approach is approximate rather than exact quantum simulation; contradictions can stop a run because related decision problems are hard in the general case, though failures are uncommon in practice. Related write-ups, demos, and community ports support deeper study.

Key features

  • Bitmap generation from one sample image
  • Tilemap model with adjacency constraints
  • Observation and propagation collapse cycle
  • Optional pattern rotations and reflections
  • Constraint and autocomplete support
  • Simple tiled and overlapping models
  • Console reference implementation
  • Browser and packaged graphical builds

Use cases

  • Procedural game levels and maps
  • Texture-style pattern synthesis
  • Tileset-based world building
  • Voxel and higher-dimensional layouts
  • Research and teaching procedural methods

Tags

Similar software

Babylon.js

Browser JavaScript engine for WebGL and WebGPU 3D

Babylon.js is a web 3D engine for building games, configurators, digital twins, and XR experiences in the browser with TypeScript-friendly npm packages.

★ 26.5k⟳ yesterdayApache-2.0
GamingDesktop/CLI app

Assimp

C++ library importing many 3D asset file formats

Open Asset Import Library loads more than forty 3D file formats into one shared in-memory scene representation. It also supports a growing set of export formats and mesh post-processing steps.

★ 13.3k⟳ yesterdayBSD-3-Clause · open core
GamingDesktop/CLI app

Noclip.website

Browser-based digital museum of video game levels

Noclip.website lets you explore reconstructed video game maps in a 3D viewer. Reverse-engineered level data from many titles is presented with camera controls and save states.

★ 4.3k⟳ 13 days agoMIT
GamingDesktop/CLI app

Godot HeightMap Plugin

Godot editor plugin for heightmap-based 3D terrain

A Godot 4.6+ terrain plugin written in GDScript with painting, LOD, holes, grass, and coloring. Install into a project as an editor addon; maintenance focuses on fixes rather than new features.

★ 2.3k⟳ 14 days agoMIT
GamingDesktop/CLI app

DirectXTex

Direct3D texture I/O and processing library

DirectXTex reads and writes DDS and other image formats and performs texture processing for Direct3D resources, including resizing, conversion, mips, and block compression.

★ 2.2k⟳ 7 days agoMIT
GamingDesktop/CLI app

glTFast

Runtime and editor glTF import and export for Unity

Unity glTFast loads and saves glTF 3D assets in games and in the Editor with a focus on speed and small builds.

★ 1.5k⟳ 2 months agoApache-2.0
GamingDesktop/CLI app