Builtin Library
- ..
- README.md1.5 KB
- bindings.yaml1.5 KB
- shader.wgsl4.4 KB
README.md
terrain_coast
Pulls the ground outside a landmass down to a seabed altitude, by a radial falloff about a point.
The land weight is 1 inside radius, falls to 0 across falloff metres beyond
it, and the height is interpolated between the seabed and whatever the stack
already built:
value = mix(seabed, prev, landWeight)
The interior keeps its landscape untouched, the rim slopes off it, and everything past the rim sits at the seabed. Put the seabed below the sea level and the result is an island — the terrain ends before the field's rect does, and the rect goes on carrying the sea.
shapeMode picks the metric: 0 is a disc, 1 is the Chebyshev square.
This op covers the whole field, not the disc it is centred on: the ground it changes is the ground outside that disc, and an op that only touched its own radius would leave the far corners standing above the water.
It is an ordinary op in the stack, so an erosion below it weathers the coastline it drew, a flatten cuts a harbour into it, and a river carves a mouth through it.
terrain_coast_mask is the same operation driven by a painted raster instead of
a radius, for a coastline whose outline is drawn rather than described.
Every op carries a mask. The op's weight at a cell is scaled by what the mask reads there — multiplied in, or subtracted out — so the op applies only where the mask lets it and a cell the mask holds out keeps exactly what it already held, at every blend mode. An op that names no mask writes at full strength everywhere.