Skip to content

Rust Implementation of Wave Function Collpase Algorithm

Notifications You must be signed in to change notification settings

bbstilson/wfc-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wfc-rs

Original Algorithm: https://github.com/mxgmn/WaveFunctionCollapse

Explanation for tiled model: https://robertheaton.com/2018/12/17/wavefunction-collapse-algorithm/

Explanation for overlap model: https://www.gridbugs.org/wave-function-collapse/

Renderings

animated flowers

cargo run --release -- ./input/flowers.png --make-gif -o 80,40 overlap -t 3,3

animated rotated/reflected flowers

cargo run --release -- ./input/flowers.png -o 80,40 --make-gif --with-tile-variations overlap -t 3,3

animated city

cargo run --release -- ./input/smog-city.png --make-gif -o 80,40 overlap -t 4,4

animated village

cargo run --release -- ./input/village.png --make-gif -o 80,40 overlap -t 3,3

animated tile town

cargo run --release -- ./input/mini-world-meadows.png --make-gif -o 20,20 tile -t 16,16

Running

cargo run --release -- --help

wfc-rs 0.1.0
Brandon Stilson
Run wfc-rs

USAGE:
    wfc-rs [OPTIONS] --output-dimensions <OUTPUT_DIMENSIONS> <INPUT> <SUBCOMMAND>

ARGS:
    <INPUT>    Input location. If running in 'tiled set' mode, this is assumed to be a directory

OPTIONS:
    -h, --help
            Print help information

        --make-gif
            whether or not to make a gif (warning: very slow)

    -o, --output-dimensions <OUTPUT_DIMENSIONS>
            Output dimensions. If running in 'tiled' mode, then this is the tiles. If in
            'overlap' mode, then it is in pixels

    -V, --version
            Print version information

    -w, --with-tile-variations
            whether or not create all variations (rotations and reflections) of tiles

SUBCOMMANDS:
    help       Print this message or the help of the given subcommand(s)
    overlap
    tile

TODOs

  • directional weights
  • shannon entropy of cells
  • voxels

Attribution

About

Rust Implementation of Wave Function Collpase Algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages