Gpu Painting is a GPGPU project I started after reading the interesting article of Roger Alsing titled: "Genetic Programming: Evolution of Mona Lisa".
The basic idea behind my project is trying to reproduce the oil painting technique using genetic programming and the power of the modern GPUs. So, I'm not aiming to reproduce a picture in a photorealistic way, but I'm trying to obtain something similar to the oilify filter in Gimp.
Even if I have a good experience about GPGPU programming thanks to my previous projects, I have to admit that I've a very basic knowledge about genetic programming, so at the moment the project is more an big hack than a real research, but after I realized a first prototype I got some encouraging result, so I've decided to go on with the development.
The current version of the program is evolving a DNA made by a fixed number of genes. Each gene represents an ellipse filled with a gradient of color (opaque in the center and transparent at the borders) and is made by the following data: center(X, Y), radiusX, radiusY, color(R, G, B, A).
Summing more gradients on the same canvas in a proper way it's possible to reproduce something similar (more or less) to the original image.
The fitness is computed summing the distances amongst the pixels of the reference image and the ones of the generated image, so for each pixel it's computed the value d = dot(dV, dV) where dV = (C2 - C1), C1 and C2 are the RGB colors of the reference image and of the generated one.
Actually the project is still in an early state, but it's already possible to obtain good visual results as showed by the images in this page. Anyway, at the moment the most important thing is the amazing speed of the evolution obtained exploiting the GPU power and the advanced features offered by OpenGL like vertex arrays, VBOs, PBOs and FBOs.
The current implementation is able to mutate 600000 times a DNA made of 500 genes in less than 12 minutes (as the Mona Lisa showed in the picture on the top-left of this page) using a modern graphic card like a Nvidia 8600M GT on my laptop. Best results can be obtained using a better GPU, I hope to post some more detailed benchmarks soon.
I'm planning to improve the current results and to experiment a lot of different ideas I have on the topic, furthermore I'd like to study the genetic programming in detail so to have a better understanding of the problem and hopefully more solutions/tests to try.
I'll post more details about the project and probably the source code as soon as I'll finish the first tests I've planned and I'll have a more stable implementation and a polished code.
The following images are generated using 600 (left) and 500 (right) genes and 630000 (left) and 52500 (right) mutations: