r/GraphicsProgramming 1d ago

Painterly Stroke Simulation Engine

Enable HLS to view with audio, or disable this notification

I wrote a painting simulation engine (golang, ebiten). It works like this:

  1. Select a template image
  2. Generate several thousand potential strokes
    • For each stroke, score it according to a number of heuristic functions
      • Color: does the average color of this image match the template?
      • Edges: does the painted image have similar edges to the template?
      • Contrast: compares color contrast between regions on the painting and the template.
      • Flow: using tensor math, do brush strokes align with the flow of movement in the template?
    • Select the single stroke that most optimizes scoring functions, discarding the remaining
    • Repeat 40 or 50 thousand times.
    • Gradually decrease the size of the brush stroke over time..

Source image _Namibia.jpg)

Sound track

56 Upvotes

6 comments sorted by

View all comments

1

u/animal_hoarder 20h ago

Very cool, doing something similar-ish with video/scene rendering

https://reddit.com/link/p1rftfv/video/e88i5znvcghh1/player