public static class WaterCarveWater bodies cutting their beds into the terrain's reserved Water layer.
Remarks
[35 § D5](../../docs/plan/35-water.md#d5-carving-is-a-reserved-edit-layer-and-the-machinery-exists), and the machinery existed. A third reserved layer alongside Splines and Scatter, on [31 § D4](../../docs/plan/31-terrain-grass-and-trees.md)'s contract and with no change to it — regenerated wholesale whenever a body changes, which is what makes it non-destructive. Unreal's water brush requires opting the landscape into edit layers, five years after Landscape shipped, which is why it is a setup step people miss; here they are the storage model, and water is the third consumer of a contract designed without it in mind.
The bed a body carves is the bed the field rasterises, by construction. Both read Sample — the surface height minus the coverage-weighted bed depth — so the shoreline the terrain is cut to and the shoreline the water is drawn at cannot disagree. That is § D2's argument applied to the ground rather than to the surface, and it is why this takes a WaterBody instead of a TerrainSplineProfile.
⚠ A river's channel is a band about its centreline and a lake's is its own polygon, and both come out of one call because Sample already knows which it is. Deforming a lake through TerrainSpline.Deform would cut a moat: that carves along a curve's width, and a closed curve's width is its shoreline, not its interior.
An island raises instead of lowering — Unreal's Invert Shape promoted to the thing it actually is, and the same sign flip Rasterize makes.
Fields and properties (1)
public const string LayerNameWhat the reserved layer is called.
Methods (3)
public static TerrainEditLayer LayerOf(Terrain terrain, string name = "Water")The layer a terrain reserves for its water, adding it if there is not one.
public static TerrainRect Carve(Terrain terrain, TerrainEditLayer layer, WaterBody body, in WaterCarveProfile profile)Cuts one body's bed into a layer.
public static TerrainRect Regenerate(Terrain terrain, TerrainEditLayer layer, IEnumerable<(WaterBody Body, WaterCarveProfile Profile)> bodies)Empties the layer and lays every body down again.
Used by (2)
- WaterCarveTestsVixen.Water.Tests
- WaterCarveCommandVixen.Editor.Water