I found a cool Voronoi variant that gives a nice fractal boundaries to each Voronoi cell, that is very efficient to compute. It seems like a good fit for coastlines, which are often similarly fractal in nature.
https://www.shadertoy.com/view/sfKSDw
Let me explain.
“Jittered” Voronoi is where you start with an infinite grid, and then for each square in the grid, you pick a random point called a site in that square. Then you make a Voronoi diagram from those sites. It’s the same thing as Worley noise, except instead of outputting the distances, the output is the choice of point you are nearest to, partitioning the plane.
It has the nice property that it’s very easy to compute on a per-point basis: for a point p you just find the nearest 25 grid cells, find each of their sites (via a hashed pseudo-random number generator), and then find which is nearest to your point. No need to actually construct the Voronoi diagram, or worry about the infinite size of the plane.
Here’s our new procedure, described mathematically:
1) Again, start with an infinite grid of squares, and pick a site for each via PRNG. These are the root, layer 0, sites.
2) Make a new grid, with squares half the size, and pick layer 1 sites for them. For each layer 1 site, find its parent site in layer 0, which is defined as the nearest site.
3) Repeat step 2 indefinitely. Each time, halve the grid size, and find parents in the layer above. The partition each site belongs to is the root site you get to when tracing the parents upwards.
As you recurse, you fill the plane with sites, which can be extended to an almost-everywhere partition of the plane.
... continue reading