Rosemaps - Inverse Flood-fill

Sometimes, making a mistake is the best thing that can happen. Keeping an open mind and an experimental attitude can show you new worlds. The new world I want to show today is what I term a Rosemap. It was born from a bug in a Flood-fill algorithm, that made it function the complete opposite way than it should, and created this:


The name Rosemap refers more to the look than the method. It creates areas of high and low contrast, as well as making up strangely organic shapes of a certain thorny nature. You might recognise that it looks a bit like a drunken walk rendering - but just a bit, because it is different again.

The first question I ask whenever I find a new algorithm for creating art-pieces is to ask how big the diversity is:

The hue is different from picture to picture, but the differences obviously go beyond just a palette swap. The shapes that are generated show quite a lot of diversity, though mostly on a small scale. On the big scale, all the pieces show the same thorny trails.

Perhaps there are ways to alter the algorithm to create pieces that look truly unique. Right now though, all of these are made with the same, pretty simple algorithm. Even better than explaining how the algorithm works is showing it:

So we see a point whipping around and filling in the screen pixel by pixel. The motion of this point is completely random, and it may as well move backwards as forwards. Each time the point moves to a pixel that has already been visited, it dies, and starts over from the last position. This is why it sometimes draws paths that are several pixels wide - because it zig-zags, runs into itself and dies, tries again, and so forth.

Each step the point moves, it changes its colour by a random amount - when it jumps back to an earlier position, it also remembers what this value was. It actually is a bit of a lie to say the colour changes - rather, it is a one-dimensional value that cycles through a colour palette that goes in a circle through:


I call it a circle because it is taken from a circular cutout of a gradient:

Ignore that the hues do not match up

I quite like this method of choosing colours. It lets a one-dimensional value create a colour that is all but one-dimensional. The colour also loops indefinetely.

If we go back to the rendering, the strange thing about this method is that the algorithm is basically an "inverted" flood-fill method. What is this flood-fill? Well, it looks like this:


If you ignore the holes, this is almost identical to the kind of art for instance described by the excellent Sighack. This has its purposes too, but it is interesting to ponder how just a small change can create vastly different outcomes.

As one can tell, the result of the Rosemap-algorithm is very different from the Flood fill-algorithm. The "inversion" is what direction the data structure goes. It can either be:
  1. A stack (first in, last out). The point continues until it hits something and then jumps as little back as possible. This creates the spiralling, thorny tendril of the rosemap.
  2. A queue (first in, first out). The point always jumps as far back as possible, meaning that all parts of the structure grow at once in a concentric pattern.
The Flood-fill method, with its centrality, is much simpler to take in and a bit more, er, aesthetically pleasing in a way, like a post from /r/oddlysatisfying that you look at for a second and then forget. 

However, it has almost no diversity in form compared to the Rosemap. While the Flood-fill moves your attention to its centre, the Rosemap is much more organic. Perhaps it can even be called crowded, at least in comparison. But at least to me, there is something interesting about the strange, spirally patterns formed by the Rosemap - shapes that you could not predict from a simple description of the algorithm. The Rosemaps are thus an example of emergence, which is what makes them, to my mind, art.


Finally, I did some more experimentation where I varied more freely the colours used. I still used the same method as described above, the circular cutout, only that I let the colours at the four corners of the square gradient be chosen completely randomly. It turns out the best solution might still be having half the colours be black.



Reddit user /u/adsilcott/ made the great suggestion to see if this could become a tileable texture by letting the tendril wrap around the edges of the image. It totally works! Do excuse the colours which really are not good for this purpose, but as proof of concept, here we can see that indeed, one can create tileable textures this way:


Here, the original Rosemap is surrounded by copies of itself of itself - half of one above, below, left and right, making this image about 2x the original size.

Comments