Builtin Library
- ..
- README.md1.9 KB
- bindings.yaml4.2 KB
- shader.wgsl9.6 KB
README.md
terrain_erode_stream
Stream-power erosion on a grid of at most a few hundred cells a side, the step terrain.erode runs for model = "stream".
One dispatch is one step, picked by the MODE specialization, and each step writes one cell per thread from the buffers of the step before, so a run gives the same ground every time.
MODE | One thread per | Writes |
|---|---|---|
down | work cell | the mean of the field cells it covers |
sum | work cell | the sum of the weights of its drops to its neighbours, the edge draining outward |
area | work cell | one Jacobi pass of the drainage area in cells: one plus what each higher neighbour sends it, each neighbour sharing its area among its lower neighbours by drop ^ power |
incise | work cell | the height after the implicit step (h + F * h_r) / (1 + F) toward the steepest lower neighbour, F = K * A^m * dt / run, plus the uplift step; K varies by variation over variationSize metres by the seed; with keep 1 the step lowers a cell and never raises it |
relax | work cell | the height after the talus limit (rest, rate) and creep between the four neighbours; with keep 1 the limit is the steeper of rest and the slope the two cells had when the run began, and creep evens out only the change |
up | held cell of the field | the work grid read bilinearly, src * scale - subtract * aux |
The step never lowers a cell past the neighbour it drains to, so a long run settles instead of running away. A depression with no lower neighbour keeps its water: its area stays in it and nothing cuts it.
With keep 1 the run keeps the shape it started from wherever the cutting does not reach: a closed basin holds its depth, since the filled surface steers the drainage across it without raising its floor, and a face steeper than the talus limit stands.