Artistic Deconstruction

After playing about with animations of evolved lines, I took a step back to do something similar with the original triangle images.

I’ve recently refined the algorithm to improve the results. Two different tweaks have improved the evolutionary process (a little intelligent design if you will). First, when adding new triangles I colour each vertex with the underlying colour from the target image. They are still transparent and, for early triangles, soon grow large and change colour radically, but it seems to help the latterly added ones.

Second, I periodically recycle the least effective triangle. This could be the triangle that does the least good or most harm or simply one of the ones that does nothing at all. Again this has little effect early on, but as I often limit the number of triangles, then throwing away the worst one let’s an image stuck in a rut continue improving.

Add these two new features and you get the following results (click to expand):

(from left to right, original painting, previous best, new best)

 

The gradients are certainly nicer and there’s more detail in there as well. If I didn’t know otherwise I’d assume this was a low quality jpg rather than a set of overlying triangles (in case you were wondering, I’ve checked, and a similar quality jpg uses a lot less storage besides taking many hours less to produce a result).

After this improvement I wondered how the various triangles affected the final result, so decided to produce an animation to show it. To do this I captured a series of frames after iteratively removing the triangles from front to back. As there a lot more subtle triangles drawn last, and as 1000 triangles would take 33 seconds to draw at 30 frames second, I removed a lot more per frame at the start, slowing it down as the triangles got larger and more intrinsic to the fitness of the image.

Here’s the result:

mona_lisa

…and because it’s good to have a bit of variety, here’s Captain America too (he gets 2000 triangles, as the image is larger and there are more distinct colours that don’t nicely meld into each other like Mona’s).

captain_america

To be explicit, that’s not how the triangles evolved. Evolution is much more dynamic than that. It’s just where everything ended up.

It’s certainly interesting to see how large triangles lay the foundation and smaller and smaller triangles refine the final result.

Leave a comment