Presets
Playback
Style
Simulation
Mosaic parameters
Brush parameters
Ink parameters
Layers
Model check
The science
What is modelled
One reference picture (a procedurally drawn landscape) is re-painted by three different mechanisms, each with its own physics or geometry. Nothing here is a neural style transfer; every style is a small, inspectable algorithm.
Equations
- Mosaic. Seeds
sidefine Voronoi cells (all points nearer tosithan to any other seed). Lloyd's algorithm moves every seed to its cell centroid, which lowers the quantisation energyE = Σ w(p) |p − si(p)|² / Σ wat every step. Weightsw = 1 + 6a|∇L|put more tesserae where the picture has edges. For equal cells of area A/N the best possible value is the hexagonal latticeE / (A/N) = 5/(18√3) ≈ 0.1604. - Strokes. A stroke follows the contour direction
t = (−gy, gx)/|g|(perpendicular to the luminance gradient g of a blurred copy of the picture), blended with a curl-noise flow. Curl noise isu = (∂ψ/∂y, −∂ψ/∂x)of a Perlin fractal potential ψ, so∇·u = 0: the flow has no sources or sinks and strokes never bunch up. Brushes go from large to small (three layers) and a stroke stops when the blurred colour changes by more than the edge tolerance. - Ink. Pigment concentration C obeys
∂C/∂t = ∇·(D ∇C) − ∇·(u C) − k C. Paper fibres vary D from cell to cell, u is the curl-noise capillary flow, and the termk Cbinds ink to the paper (bound ink B gains what C loses, so C+B is conserved). A single drop spreads as a Gaussian withσ²(t) = σ0² + 2Dtand peakQ / (2πσ²). Colour is Beer-Lambert absorptionI = Ipaper e−s(C+B)of cyan, magenta and yellow pigment.
Checks run in the page
- Lloyd relaxation of 200 random seeds: the energy must fall monotonically and end near, but never below, the hexagonal value 0.1604.
- An isolated ink drop on a fresh grid: measured variance and peak compared with the analytic Gaussian, and the total ink unchanged.
- The curl-noise field is differentiated with two different step sizes and its divergence compared with the size of its gradient; the whole ink solver (flow, grain, absorption) must conserve total mass to rounding error.
The checks use fixed test setups, not your sliders, so they do not freeze the page; press Re-run checks to repeat them.
Honest simplifications
The reference is synthetic, colours of the ink are a simple subtractive model, not real pigment optics, and the explicit finite-volume ink solver uses a first-order upwind scheme, which adds a little numerical diffusion when the flow is fast. Brush strokes are not a physical bristle simulation. The sim is educational and artistic: it shows the algorithms behind mosaic, painterly and ink effects, not a general style-transfer engine.
What to try
- Mosaic: set the detail-adaptive density to 0 and watch the cells settle into near-hexagons; raise it and cells crowd along edges.
- Strokes: set the curl share to 0 (strokes obey contours) then to 1 (strokes obey only the noise flow).
- Ink: set absorption to 0 and the flow high for marbling; set grain to 1 for feathery edges.