Builtin Library
- ..
- README.md1.5 KB
- bindings.yaml1.2 KB
- shader.wgsl4.9 KB
README.md
terrain_stamp
Blends a source texture into a scalar channel under a world-space transform.
The source is an ordinary .texture. That is the point: importing a real-world
elevation model and placing an authored shape are the same operation, so there
is one path for both and no separate importer.
Sampling runs in world space. Each destination cell's world position is carried
into the stamp's local square — translated to at, rotated by rotation,
scaled so the square spans radius * 2 metres — and the texture is read there.
A cell outside that square is left untouched, so the op's declared extent is
exact and the evaluator dispatches only the tiles the stamp reaches.
channelIndex picks which of the texture's four channels carries the value;
amplitude scales it into metres and bias offsets it, so an 8-bit greyscale
heightmap in 0..1 becomes real elevation. falloff feathers the disc inscribed
in the square, which is what lets a stamp meet the surrounding terrain without
a seam.
Compare terrain_layer, which blends a raster that already shares the field's
grid and therefore needs no sampling at all.
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.