But is your algorithm really qualitatively all that different from previous search methods (e.g. Efros and Leung), if you are still (uniform random?) sampling over the input distribution of patches?
I notice also your input textures tend to have sharp boundaries (as is common in pixel art). It would be interesting to see the results when the input has a lot of "noise", such as high def images of rocks or clouds ;)
While I still prefer search methods because they are easy to implement (and give better results), "deep" methods are definitely gaining some ground:
Combining Markov Random Fields and Convolutional Neural Networks for Image Synthesis
Efros' and Leung's method doesn't satisfy the (C1) condition. The closest previous work is Paul Merrel's model synthesis.
WFC and texture synthesis serve similar purposes: they produce images similar to the input image. However, the definition of what is "similar" is different in each case. If you have a high def input with noise (like realistic rocks and clouds) then you really want to to use texture synthesis methods. If you have an indexed image with few colors and you want to capture... something like the inner rules of that image and long range correlations (if you have an output of a cellular automata, for example, or a dungeon), then you want to use WFC-like methods.
Btw, I have classic texture synthesis algos in a different repo: https://github.com/mxgmn/SynTex
I assume that if you feed WFC a large input image, it just thinks of that as a very complex set of rules that are harder to satisfy than those of a small input?
Is there a way, then, to instead train the WFC algorithm on a large corpus of small, similar samples, such that it can try to derive the rules common to all the inputs in the corpus, and produce one image that "really" fits the rules, rather than just the ephemeral quirks from an individual sample?
Would there be, for example, a way to train WFC to produce outputs matching the level-design "aesthetic" of a given game, rather than just "continuing" a particular level?
But the first thing you'll notice if you feed it an image with a lot of patterns, is that it will work very slowly.
Yeah, the corpus thing can be done if we cut out rare patterns and leave only frequent ones. I haven't tried it though.
Since the input is shredded into a multiset of N by M rectangles, it's the opposite: assuming the small input image is a portion of the large one, the large image model adds examples to the ones in the small image model, so the set of cases it can fit an example to is the same or larger.
So what I'm really after is a way to iteratively "perturb" the sample in such a way that the resulting texture will smoothly reflect those changes.
Take a look at this rough illustration:
Op-Art Texture Synthesis
You mentioned rotation and mirroring type bitmap ops in your algorithm. But how do we precisely apply a series of dynamic filters to the input to "evolve" the patch? Even using overlapping kernels it seems quite intensive! And prone to artefacts...
It would be interesting to apply this concept to wavelets (instead of pixels or voxels) in order to work on real-life pictures.
Also, 3 dimensions as in X, Y and time, to work on animated GIFs. Think about an infinite, never repeating Blue Ball Machine! http://m.imgur.com/5Flh68G
you start from a finite pattern, which becomes the 'rules' of your created universe.
Then, using this wave function collapse algorithm you expand it into an infinity where the possibilities are endless within the constraints of those generator rules
We have a LOT of 3-D images (per voxel is ~200nmx200nmx~600nm for a lot of 1028x1028 .tiff images all stitched together) and would love to feed these images BACKWARDS into this. IE we have the 'far field', and we want the 'elements' that make it up. Say we have a large amount of data on the Pituitary gland, and we want to compare the 'elements' of the Pituitary to the 'elements' of the hippocampus. We know a lot of these differences, but there may be 'something else' in there that we humans are not seeing. This may be of great use to use for disease pathology like Lewy Body Disease precursors.
Still, thanks a ton for this info! I think it can really help with some computational bio stuff another lab is working on here (viral similarity in genes in your DNA)
Don't really understand the technique, but would like your thoughts on if it's possible to give a Penrose tile set as a seed and see if aperiodic order is generated.
I'm not sure, but I think that Penrose tilesets are what I call "easy": you can't run into a situation where you can't place a new tile. It would be great if someone here could confirm or deny this.
So if this is the case, then Penrose tilesets are not interesting to WFC, because you can produce arbitrary tilings with much simpler algorithms.
Right now though WFC is only working with square tiles, but it's not hard to generalize it to arbitrary shapes. Paul F. Harrison made a tiling program that supports hex tiles: http://logarithmic.net/pfh/ghost-diagrams See also the relevant paragraph in the readme (just search the word "easy").
source: my own quasicrystal simulations (http://www.nature.com/nmat/journal/v14/n1/extref/nmat4152-s2...)
Is that the idea? The description wasn't completely clear to me.
I don't understand about "a single color" unless you mean setting all output pixels to the same color, which would only satisfy the constraints if the input has an NxN patch all one color.
I hope my comment didn't seem to imply that the work seemed unoriginal. I don't think that; I wanted to check my reading.
The algorithm used is exactly what you described here. It wasn't obvious to me that probability density functions were not tracked (the algorithm only tracks which NxN patch are allowed at each location) and randomness only come into play when a random valid choice is made, and there each valid patch is chosen probability proportional to its number of occurrence in the input.
You understood right, it's constraints + probabilities.
Btw, I have different algorithm that satisfies (C2) perfectly, but not (C1): https://github.com/mxgmn/ConvChain
I might try this approach to generate formal poetry -- it's something I've done by backtracking before, and I'd considered doing something like your ConvChain.
It detects places in songs where the sound is similar, and can jump between these places in the track to make a seamless unending song.
Its interesting to think about it for a spectrogram because "similarity" is different in each dimension (freq vs. time).
Frequency is also perceived logarithmically, so you would probably want to convert to e.g. Mel scale before applying this algorithm (a 2000-2100Hz change is much subtler than a 200-300Hz change).
Similarly, you can unpack a linear sequence of sound samples into a two-dimensional plot of frequency and amplitude with a fourier transform.
Music is not sound, it's made of sounds. The fact that it gets mixed down to a single waveform when you consume it, either in the studio or when it hits your ear, isnt particularly relevant to how its made. I suppose the same is true of images though.
Markov chains applied to midi have been able to make "locally similar" stuff since forever. I wonder how this algorithm could be applied to higher-order aspects of music notation.
These are just multiple signals in a single dimension (time).
Fourier transform by itself is still 1D (amplitude vs. frequency); to get to 2 dimensions you can plot it over time i.e. a spectrogram.
Given that and the simplicity of just providing a bitmap as input, this could be adapted well to provide customization to the player as well.
Also note how PatchMatch can work with constraints.
Photoshop's implementation of PatchMatch handles constraints perfectly, yes.
Yeah, you a right, I'll upload slower gifs. Right now youtube video has the slowest speed, in fact it has segments with no frame-skipping at all: https://youtu.be/DOQTr2Xmlz0
This could be great for generating maps in a sprite based strategy game!
The blog itself hasn't been updated it in a while as I've been in the midst of some pretty serious rewrites/refactors over the past several months. Since that post I've rewritten the game in TypeScript, rewritten the core engine to use the ECS (Entity Component System) pattern, and right now am actually in the midst of a rewrite of pretty much the whole game. Hence I mentioned the rewrite of the mapgen code, the first version of which was probably written 2 years ago hehe. I had a huge amount of features built up over 2 years (idealogically similar to DF in that regard heh) but realized I needed to pare down the feature set to get an alpha out so people could play. It's also allowing me to address some fundamental flaws that the engine built up over the past year or two. So that's the point where I'm at now.
Feel free to sub to the mailing list if you'd like to know about any updates and when the game comes to fruition you'll be notified ;)
Plus, dungeons could be a lot more interesting. It'd be interesting to see what could be done with it...
 - http://i.imgur.com/UJeLy.png
No, not really. ConvChain though is related to symmetry breaking, the same way as MCMC simulation of the Ising model is https://github.com/mxgmn/ConvChain
Super neat visuals and I can't wait to play with this, as someone who knows nothing about this kind of "stuff".
The license is MIT.
How can I compile / run it?