GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - CodingTrain/Wave-Function-Collapse

BranchesTags
Open more actions menu

Latest commit

 

History

67 Commits
67 Commits

Folders and files

NameName
Last commit message
Last commit date
Processing
Processing
 
 
gifs
gifs
 
 
p5js
p5js
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 

Repository files navigation

Wave-Function-Collapse

Straight out of quantum mechanics, Wave Function Collapse (WFC) is an algorithm for procedural generation of images. This repository features two approaches to the WFC: the Tiled Model (Coding Challenge 171) and the Overlapping Model (Coding Challenge #186). Both implementations are available in JavaScript (p5.js) and ported to Processing (Java).

GIF animation of the tiled WFC algorithm GIF animation of the overlapping WFC algorithm

Coding Challenges

  • Coding Challenge #171: Wave Function Collapse
  • Coding Challenge #186: WFC Overlapping Model (Available now exclusively on Nebula!)

Archived Raw Footage

  • πŸ”΄ Wave Function Collapse Tiled Model Live Stream #1
  • πŸ”΄ Wave Function Collapse Tiled Model Live Stream #2
  • πŸ”΄ Wave Function Collapse Tiled Model Live Stream #3
  • πŸ”΄ Wave Function Collapse Overlapping Model Live Stream #1
  • πŸ”΄ Wave Function Collapse Overlapping Model Live Stream #2

Overview

Wave Function Collapse is a constraint-satisfaction algorithm inspired by quantum mechanics. At a high level, you have:

  1. Tiles (or β€œpatterns”) that can appear in each cell.
  2. Adjacency rules describing which tiles can appear next to each other.
  3. Entropy that helps decide which cell to collapse (choose a tile for) next.
  4. Propagation to eliminate invalid tiles from neighbors as constraints tighten.

Completed

  • Implementation of Tile Model (Challenge 171)
  • Implementation of Overlapping Model (Challenge 186)
  • Processing (Java) ports for both models

Corrections / Additional Features

  • Additional edge cases for tiles 4 and 5 (Tiled Model).
  • Computed Property Names (Tiled Model) Issue #35
  • Backtracking for conflict resolution.

Community Contributions and Improvements

  • TileGrid Helper Class by @jonnytest1 A generic grid layout approach using p5.js vectors, making it easier to unify directional logic and reference valid neighboring positions.
  • Grid Update Optimization: Pull Request #40 introduces a more efficient method for updating grid cells by propagating changes only to affected cells, which improves performance and accuracy. The drawing process is also optimized, allowing multiple updates per tick, speeding up the overall process.
  • Using Piskel to create a source image
  • Highly optimized version supporting both single-image and pre-tiled source images A detailed write-up of how the changes were done and why can be found in its own readme here
  • An optimised overlaping model using queues (instead of recurcion) and backtracking to avoid paradoxes. Version @alin256. The version also adds some GUI improvements.

Key Resources

  • Wave Function Collapse algorithm source
  • Wave Function Collapse Processing forum discussion
  • Gridbugs Procedural Generation with Wave Function Collapse
  • Model Synthesis by Paul Merrell
  • WFC using local storage by @kfahn22

About

No description, website, or topics provided.

Resources

Readme
Activity
Custom properties

Stars

219 stars

Watchers

1 watching

Forks

63 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.