TerraFractal, part 5: co-refinement, and why negotiation never finishes

If the rivers had nothing to negotiate with in the lowlands, the answer seemed to be: grow the features and the rivers together.

The plan

At each scale, starting from the largest:

  1. Add that scale’s features: the next tier of ridges and spurs, the next octave of relief.
  2. Solve the drainage at that scale against all of them at once. Coarser rivers are fixed. Same-scale features and rivers push and pull until they fit.
  3. Add divides between the sibling rivers.
  4. Go one scale smaller and repeat.

The hope was that each round would leave a smaller mismatch between the drainage and the relief, until at some scale the mismatch was small enough to brute-force away inside each tile.

What happened

It never got there. Each round shrank the mismatch and left one.

In every round the relief came first and the drainage was a correction to something that didn’t know about it. Every correction created its own small mismatch at the next scale down. And a drainage solve is the opposite of something you can compute anywhere at any scale: it needs the whole neighbourhood at a fixed resolution before it can answer for any one point.

Pieces of it worked. Breaching dams where trapped water would break out in the worst floods, not just where evaporation balanced. Continental divides as the highest path between coasts. Separating “this line must drain to the sea” (a rule with a position) from “this is the shape of the channel” (which needs the water volume and the rock, only known later). But the overall approach was stuck.

The diagnosis

Stepping back, the pattern across all three attempts was the same. I kept doing deliberate modelling inside a grid with a fixed resolution, then needing careful negotiation between tiles and between levels to make the pieces agree.

The alternative is to describe the terrain as mathematical functions that can be calculated at any position, at any precision, with no negotiation. A function doesn’t have neighbours. Ask it about a point and it answers.

The same terrain stored on a grid (top) and evaluated as a function (bottom)
The same terrain stored on a grid (top) and evaluated as a function (bottom). Zooming into the grid only blurs what was stored. The function keeps producing detail, and two neighbouring tiles asking about the same point get the same answer.

That doesn’t remove the drainage problem. Water still needs the whole basin to know where it goes. But it shrinks the part that needs a solve to one place: once, at the landmass scale. Below that, everything should be a function of position plus what was handed down.

That’s the current approach, part 6.