Trial and error.
What artist has not at some point resorted to “I’ll just try this and see if it looks better.“?
You might say that, in light of Darwin’s model of natural selection, nature itself does the same: make a genetic mutation or two, or a billion, and see what works.
Swedish programmer Roger Alsing has created a playful experiment in “genetic programming” applied to image making, in which he wrote a small program for rendering 50 translucent polygons into an image area.
He set it to mutate slightly with each iteration, so that each pass of the program produces a different distribution of the polygons (the “genetic mutation”).
The fact that the polygons are translucent allows for many smaller subtle shapes within the composition, produced by overlapping areas of color, like laying an area of yellow glaze over both blue and green shapes in an oil painting.
At the end of each rendering sequence, the program uses a “fitness function”, basically a small routine to compare the resultant image pixel by pixel with a target image, in this case an image of the Mona Lisa.
Based on the “fitness” of the image, the program keeps either the new “dna” or the existing “dna”, whichever is more like the target, as the basis of the next mutation and iteration.
Trial and error. Survival of the fittest.
There is a selection of images on Alsing’s blog showing various renders, from which I’ve pulled a few representative samples, above. (For those who are programmatically inclined, there is also a faq with some of the basics.)
Under each of the sample images is a filename that shows the number of times the program had to run to reach that particular image.
The one at bottom-right shows 904,314 incidences of “I’ll just try this and see if it looks better“.