Skip to content

piedoom/modsynth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

modsynth

modsynth is an implementation of model synthesis intended for use in interactive applications like games. It can take a grid of arbitrary data and synthesize new grids with local similarity. This is very similar/also known as "wave function collapse" (wfc).

Examples

Input samples

🟩🟩❎❎❎🟩🟩🟩🟩🟩    🟪🟪🟪🟪⬜⬜🟩🟩🟩🟩
🟩❎🟦🟦🟦❎🟩🟩🟩🟩    🟪🟪🟪🟪🟪⬜⬜🟩🟩🟩
🟩❎🟦🟦🟦❎🏠🟩🟩🟩    🟪🟪🟪🟪🟪🟪⬜⬜🟩🟩
🟩❎🟦🟦❎🟩🟨🟨🟩🟪    🟪🟪🟪🟪🟪🟪🟪⬜⬜🟩
🟩❎🟦🟦❎🟨🟨🟩🟩🟩    🟪🟪🟪🟪🟪🟪🟪🟪⬜⬜
🟩❎🟦🟦❎🟨🟩🟩🟩🟩    🟧🟪🟪🟪🟪🟪🟪🟪🟪⬜
🟩❎🟦🟦❎🟩🟩🟩🟩🟩    🟧🟧🟪🟪🟪🟪🟪🟪🟪🟪
🟩❎🟦🟦🟦❎🟩🟩🟩🟩    🟨🟧🟧🟪🟪🟪🟪🟪🟪⬜
🟪❎🟫🟫🟫❎🟩🟩🟩🟩    🟨🟧🟧🟪🟪🟪🟪🟪⬜⬜
🟩❎🟫🟫🟫❎🟩❎❎🟩    🟧🟧🟪🟪🟪🟪🟪⬜⬜🟩
🟩❎🟦🟦🟦❎❎🟦🟦❎    🟧🟪🟪🟪🟪🟪⬜⬜🟩🟩
🟩❎🟦🟦🟦❎🟦🟦🟦❎    🟪🟪🟪🟪🟪⬜⬜🟩🟩🟩
🟩❎🟦🟦🟦🟦🟦🟦❎🟩    🟪🟪🟪🟪⬜⬜🟩🟩🟩🟩
🟩❎🟦🟦🟦🟦🟦❎🟩🟩    🟪🟪🟪⬜⬜🟩🟩🟩🟩🟩
🟩❎🟦🟦🟦❎❎🟩🟩🟩    🟪🟪🚃🚃🚃🚃🚃🚃🚃🟩
🟩🟩❎❎❎🟩🟩🟩🟪🟩    🟪⬜⬜🟩🟩🟩🟩🟩🟩🟩

Output

🟪🟩🟨🟩🟪🟪🟪🟩🟩🟩❎❎❎🟩🟪🟪
🟪⬜🟩❎🟩🟩🟪⬜⬜⬜🟩🟩❎🟩🟪🚃
🟪🟪⬜🟩🟪🟪🟩🟩🟩🟩🟩🟩🟩🟨🟩🟩
🟪🟪🟪🟩🟪🟪❎🟩🟩🟩🟪⬜⬜🟩🟪🟩
🟪🚃🚃🚃🟩🟩🟩🟩🟨🟩🟩🟩🟪⬜🟩🟩
🟪🟩🟩🟩🟩🟩🟩❎🟩🟩🟩🟪🚃🚃🚃🟩
🟪🟪🟪🟩🟩🟩🟩🟩🟩🟪🟪⬜⬜⬜⬜⬜
🟪🟩🟪⬜⬜⬜⬜⬜🟩🟪🟪⬜🟩🟩🟪🟪
🟪🟪🟪🟪⬜⬜🟩🟩🟨🟩🟪🟩🟩🟩🟪🟪
🟪🟪🟪🟪🟪🟩🟩❎🟨🟩🟪❎🟩🟪🟪🟪
🟧🟧🟧🟧🟧🟪🟩🟩🟩🟩🟩🟩🟨🟧🟧🟪
🟨🟨🟨🟨🟧🟪🚃🚃🟩🟪🟪❎🟩🟪🟪🟪
🟩🟩🟨🟩🟪🟪⬜⬜🟩🟩🟩🟩🟩🟪🟪🟪
❎🟨🟧🟪🟪⬜⬜⬜🟩❎❎❎🟩🟪🟩🟪
🟩🟩🟪🟪🟪🟪🟩🟩🟩❎❎🟩🟩🟩🟩🟪
🟪🟪🟪🟪🟪🟩🟩❎🟩🟩🟩🟪🟪🟪🟪⬜

Features / limitations

I want to implement everything here eventually.

  • synthesize from input samples (no need to specify constraints manually)
  • multiple sample support
    • multiple sample weight adjustments
  • detection of grid boundaries when calculating probabilities (see maze_2d example to see how the edge of the grid isn't properly synthesized)
  • simple backtracking
  • 3D support
  • generation with smaller segments
  • bevy integration

As it stands, it's pretty slow to generate and often fails, espcially at bigger sizes.

Releases

No releases published

Packages

No packages published

Languages