Skip to content
/ WFC Public

A C++, voxel-based implementation of the WFC algorithm for a senior capstone project

Notifications You must be signed in to change notification settings

clach/WFC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wave Function Collapse

A C++, voxel-based implementation of the WFC algorithm for a senior capstone project

Overview

A C++, voxel-based implementation of Wave Function Collapse. This algorithm takes in a tileset and some adjacency information about those tiles (which tiles can sit next to which, and in what direction) and can generate infinite configurations in an NxNxN grid using those tiles. A video presentation and demo can be found here.

Build Mode

This implementation featues a build mode, in which the user can place down starting tiles and then run the algorithm.

Iterative Mode

There is also an option to watch the algorithm run iteratively: at the start, each grid cell contains a transparent cube representing the potential tiles that can be placed in that cell. As the algorithm progresses, the number of valid tile options for a given cell decreases, and the transparent cube in that cell decreases in size until it disappears completely and is replaced by that cell's observed tile.

Tilesets

The "knots" tile set was created by the original author, while I created the other two tile sets in MagicaVoxel.

Knots Castle Buildings

Future Steps

As of writing this readme, it's been several years since I worked on this project and there are lots of things I would change! The most obvious is to instance the tile meshes, as any configuration will contain the same 10 or so tiles with different translations and rotations. In general, thinking about this project from a more data-oriented mindset would probably help a lot. It would also be interesting to add a backtracking algorithm to resolve unsolvable configurations, which can happen not infrequently depending on the tile set selected and number of user tiles placed in build mode.

About

A C++, voxel-based implementation of the WFC algorithm for a senior capstone project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages