Wave Function Collapse - has anyone done it with Grasshopper?

Just finished reading this interesting article on wave function collapse. I was wondering if anything like this or another procedural modeling method has been implemented grasshopper?


Here are some examples in action:


Very cool, I must look at that more closer… Truchet are a simplier version

Is this code that is useful to this? https://github.com/JustynaJS/wave-function-collapse

@scottd yeah i saw that too. It might be, I couldn’t figure out quite how to use it though or find any examples of it in the wild.

Thanks for sharing. I didn’t know this algorithm. Very interesting, a must know for those interested in diffusion limited aggregation and other composition algorithms. But the nomenclature, even though it’s inspired by quantum mechanics… fff, dysfunctional aesthetics.

If I have understood it well, given a set of modules with some connectivity between them (not all modules can be connected to all modules), and given one or several initial modules, these are propagated (finding which modules to connect as neighbors) but instead of choosing which module to connect, all those that cannot be connected are discarded and propagation continues until a module space is restricted to a specific module because there is no possibility of several modules, and the loop is repeated with more and more restrictions (modules chosen in specific spaces). Then you have composed using some initial elements looking to minimize entropy (as a measure of possible states) in a constraint system.

It’s cool as a concept, as a procedural algorithm… you get good or bad results if you choose good or bad modules and connectivity. And at the implementation level, I suppose that you can add other types of restrictions different from the connectivity one, like defining some intentionality, preserving some properties, guaranteeing some functionality, etc, but I doubt very much that you can include these heuristics in the middle of the process to be efficient if the state in the middle of the process is a few modules and the rest of modules pure uncertainty.

I’ve been wanting to implement WFC in grasshopper for a while now, here is my take. You have to define all the module adjacency constraints manually and its limited to 2D. It tends to fail a bit for large grids, but it should reach a solution given enough attempts. wfc_0.10.gh (324.3 KB)


Here is more Wave function collapse inside RHino and Grasshopper:

Very cool.

1 Like

i don’t know anything about this wfc stuff, but your definition is cool as hell! you making a video game?