Generate Voronoi diagrams in your browser. Control cell density, seed drift, border thickness and colour, then export a PNG. Runs as a fragment shader on the GPU.
Knobs patch the running animation live. A few (marked in the code as baked-in values like particle counts) restart the preview.
Nearest-seed cells from a 3×3 neighbour search, drifting live.
Your code runs in a sandboxed frame with no access to this page, and it is never sent to a server. three.js demos load the library from jsDelivr; the rest need nothing but the browser.
Scatter points across a plane, then colour every position according to which point it is nearest. The result partitions the plane into one cell per seed, with borders lying exactly halfway between neighbouring seeds. That single rule produces the cracked, organic look that turns up in giraffe markings, dried mud, foam and cell tissue.
The same structure answers nearest-facility questions directly. Draw a Voronoi diagram over a map of hospitals and each cell is the region for which that hospital is the closest one.
Rather than computing the diagram as geometry, this generator solves it per pixel in a fragment shader. Space is divided into a grid with one seed per grid square, and each pixel checks its own square and the eight around it for the nearest seed.
Searching a three by three neighbourhood is not an approximation for this arrangement: with one seed per cell, no seed outside those nine squares can be closer than the nearest one inside them. That bound is what keeps the whole diagram cheap enough to animate while the seeds drift.
A division of a plane into cells, one per seed point, where every position belongs to the cell of the seed it is closest to. The borders sit exactly halfway between neighbouring seeds.
As a fragment shader on the GPU. Each pixel searches its own cell and the eight surrounding ones for the nearest seed, which is enough to get the correct answer while staying fast enough to animate.
Yes, as a PNG at the size shown.
Procedural textures for stone, scales, cracked earth and foam; mesh generation; and any nearest-facility problem such as which shop, cell tower or hospital is closest to a given point.
Yes. Set seed drift to zero for a static diagram, or raise it for a slowly shifting pattern.