
Genetic Drawing - runxel
https://github.com/anopara/genetic-drawing
======
mkl
I've done some things like this before, with lines, ellipses, etc., but the
brush strokes are neat, and look much better. I wondered what fancy brush
engine it was using, but it turns out just four images of brush strokes do
quite a good job!

It would probably be possible to use a brushstroke engine like say Krita's to
do better, but I don't know how accessible that is outside the GUI, and the
CPU implications might end up challenging (often many strokes need to be
randomly generated before you get one that's an improvement worth keeping).

~~~
regularfry
Generating images is interesting because you can use the difference between
the original and the last generation to bias the search, which can cut down
the number of strokes you need to test.

On the other hand, what's happening here is also slightly different to what
people usually mean by genetic optimisation in that it looks like it's only
the most recent brush stroke that's being randomised. Normally you'd keep the
entire stack of strokes around as a genome and allow any of them to mutate,
which means you'd need to do a full render at every generation, as opposed to
just blitting a single stroke per generation.

~~~
regularfry
On reading the code, I think the latter is actually what it's doing. Might
have a bit of a play with this, it looks fun.

------
rlp
Very nice! The sampling mask makes a big difference. I played around some with
creating shaders in Unity for this type of thing last year. I liked how it
looked on still frames, but I was never quite satisfied with the results for
movement.

~~~
mkl
Is this generating each frame from scratch, or are they aware of the frame
before?

With the genetic drawing method linked, you could start with the current
frame, and add brush strokes to the regions that are different to make it more
like the next frame. That way things that aren't changing would stay still and
not flicker.

~~~
rlp
Yes, it's aware of the previous frame. I believe I used some kind of motion
"heat map" that would indicate where the changes were needed based on
accumulated deltas that would gradually decay. However, I still had to keep
the brush strokes on a reasonably regular-ish grid to get enough paint brush
coverage for real-time rendering. Also, if they were too randomly placed, the
image jumped around too much.

------
jonluca
This is so cool. Does anyone have other examples on GitHub of procedurally
generated art like this?

~~~
snakeboy
[https://github.com/fogleman/primitive](https://github.com/fogleman/primitive)
is a favorite of mine.

------
dmos62
How is this performance-wise? Would be cool to apply to a video, where you'd
drop ~4/5 frames and then start drawing, but instead of starting with a blank
for each frame start with the previous frame.

