w

wfc

v9bc36fclibrary

No description provided.

0 stars0 forksUnknownupdated 5 months ago
Open repo

Wave Function Collapse on Graphs

A procedural content generation application written in Odin that is based on the Wave Function Collapse by Maxim Gumin WFC to generate structured outputs from input examples. The application loads pattern examples (PNGs) from a directory and generates new outputs based on adjacency and pattern constraints.

The main difference is that you are not restricted to generating outputs on a grid. Before the shape of the input defined the shape of the output. This implementation cuts this dependency and allows you freedom in how to shape the output.

Examples

Demo GIF

Overview with different kind of cell arrangements

On grid like graphs the output is the same quality as the original. Grid

Irregularly arranged cells pose no problem. Circular

You can make the graph complex, with different regions and complex edge-cases. Mixed

Even randomly placed cells, with different amount and distribution of neighbours can be used. Noise

Though the larger or more complex the graph, the longer it may take to generate a complete output. (See my paper(in german) for more in depth explanations and analysis)

Features

This project:

  • Implements a Wave Function Collapse–style generator on graph‑like structures.
  • Generates new outputs based on constraints extracted from the example image.
  • The algorithm can take any input image and any graph-structure, but output quality may suffer in some cases.

Technical Information

  • the program is written in Odin and uses Raylib to display and DearImGUI for the ui.
  • everything besides that is implemented from scratch

Build & Run

If you feel brave, try if you can build and run it on your machine. No warranties.

You will need to install the odin compiler.

Then setup the project.

git clone https://github.com/mrmetube/wfc
git submodule init
git submodule update --recursive

Build.

odin run build

Run the app.

.\build\wfc.exe .\data\images

Usage

The UI is rough, as I made in a way to help me develop. It is not polished for end-users, or more percisely I was the only intended end-user.

The Extraction UI lets you select the used image.
In the Grid window you choose from some preset-graphs and adjust their size or parameters or below make your own.
The Generate section lets you control the running generation, pause and resume and scroll back through the steps.
The Stats and Visual Options show different information next to or on the graph.

Package Info
Version
v9bc36fc
License
Unknown
Author
@MrMetube
Type
library
Forks
0
Created
11 months ago
Updated
5 months ago
Health
maintained
has releases
has readme
has license
Activity
last 56 weeks