Builtin Library
- ..
- README.md1.9 KB
- bindings.yaml2.1 KB
- shader.wgsl10.6 KB
README.md
terrain_mask
A soft-band rule over one feature of a raster, written into a named layer.
| input kind | value | unit |
|---|---|---|
| 0 height | the surface's own value | world metres |
| 1 slope | the angle of its gradient | degrees from flat |
| 2 curvature | its Laplacian — positive in a gully, negative on a ridge | 1/metre |
| 3 noise | gradient noise over world position | 0..1 |
| 4 curve | distance to a polyline's sampled control points | world metres |
A band is min .. max, feathered by feather — a soft half-width in the
input's own unit — on either edge; a side left open (±1e29) is not a bound
at all. jitter perturbs the sampled value before the band, by up to
jitter over a gradient-noise field sized jitterSize, so the boundary
wanders instead of tracing a contour. invert swaps what the band selects.
The height/slope/curvature inputs are derived from the raster's own
"height" layer, read through op_source at the same resolution as the layer
this op writes — one indexed read per cell, no resampling. slope and
curvature are central differences over step world metres.
The curve input reads a polyline's sampled control points off op_payload
— the same array terrain.project rides — and measures distance to it in
the ground plane; a control point's height plays no part in the distance.
blend decides how the band's weight meets what the layer already holds:
replace, add, max, or min. A layer written fresh is usually
replace; combining two masks into one accumulated layer is add or max.
The written value is a weight in 0..1 — a layer this op writes is what
terrain.mask's name param names, and any other raster kernel op's own
mask param can reference it by that name, multiplied in or subtracted out,
through the generic op_mask/op_common contract every raster kernel op
already carries.