felixturner/hex-map-wfc

JavaScript

442

81 commits

updated Mar 10, 2026

See the code

README

Hex Map WFC

Procedural medieval island worlds from 4,100 hex tiles, built with WebGPU and a lot of backtracking.

Live Demo | Read the Article

Screenshot

Features

  • Modular Wave Function Collapse — 19 hexagonal grids solved independently with cross-grid constraint matching
  • Layered Recovery System — unfixing, Local-WFC, and mountain fallbacks for 100% solve rate
  • 30 Hex Tile Types — 6 rotations and 5 elevation levels each (900 states per cell)
  • WebGPU Rendering — Three.js with TSL shaders for all custom visual effects
  • BatchedMesh Optimization — 4,100+ cells in ~38 draw calls, 60fps on desktop and mobile
  • Post-Processing Stack — GTAO ambient occlusion, depth of field, vignette, and film grain
  • Dynamic Shadow Maps — frustum fitted to camera view for crisp shadows at any zoom
  • Animated Water — caustic sparkles and coastal waves with cove-aware thinning
  • Noise-Based Placement — Perlin noise for organic tree, building, and decoration clustering
  • Seeded RNG — deterministic, reproducible maps from any seed

Getting Started

npm install
npm run dev
npm run build

License

MIT

Credits

felixturner/hex-map-wfc

JavaScript

442

81 commits

updated Mar 10, 2026

See the code

README

Hex Map WFC

Procedural medieval island worlds from 4,100 hex tiles, built with WebGPU and a lot of backtracking.

Live Demo | Read the Article

Screenshot

Features

  • Modular Wave Function Collapse — 19 hexagonal grids solved independently with cross-grid constraint matching
  • Layered Recovery System — unfixing, Local-WFC, and mountain fallbacks for 100% solve rate
  • 30 Hex Tile Types — 6 rotations and 5 elevation levels each (900 states per cell)
  • WebGPU Rendering — Three.js with TSL shaders for all custom visual effects
  • BatchedMesh Optimization — 4,100+ cells in ~38 draw calls, 60fps on desktop and mobile
  • Post-Processing Stack — GTAO ambient occlusion, depth of field, vignette, and film grain
  • Dynamic Shadow Maps — frustum fitted to camera view for crisp shadows at any zoom
  • Animated Water — caustic sparkles and coastal waves with cove-aware thinning
  • Noise-Based Placement — Perlin noise for organic tree, building, and decoration clustering
  • Seeded RNG — deterministic, reproducible maps from any seed

Getting Started

npm install
npm run dev
npm run build

License

MIT

Credits

Significant stargazers

Aarni Koskela

536 followers · starred Mar 2026

kumavis

1,487 followers · starred Mar 2026

Dan Goodman

136 followers · starred Mar 2026

Michi Hoffmann

144 followers · starred Mar 2026