11 comments

[ 4.8 ms ] story [ 42.6 ms ] thread
This is so cool. Does anyone have other examples on GitHub of procedurally generated art like this?
I don't know if it applies, but I post all my sketches on Github (but I use p5js, Javascript's Processing flavour): https://github.com/rberenguel/sketches

If you take a look at reddit.com/r/generative (and /r/proceduralgeneration) you can find interesting projects and ideas, and sometimes people also post their code.

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).

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.

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.
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.
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.

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.
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.
(comment deleted)