Log inGet started
Package

terrainSystem.package

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

terrain

Ground as nodes. terrain.source opens a rect of ground as a tiled raster with a height layer; every other node takes that raster, changes it and hands it on.

PartNodes
the groundsource, from_texture; a landscape asset comes in through io.import
landformsflatten, cone, ridge, ramp, terrace, strata, coast, layer, stamp, project, fbm
rulesmask writes a soft band over height, slope, curvature, noise, a curve, the drainage area (flow) or any layer of the raster (layer, such as deposit) into a named layer; any node's mask input names it
waterlake (floods the seed's basin until it is dry), sea, river
weathererode: stream-power erosion over a drainage network (stream, the default), scree shed by steep faces and settled at the repose (talus), droplets walked on the device with integer sums, or thermal relaxation
standing on itscatter, drape
out of the graphlandscape (one element standing as the ground, the Terrain component on it), write (the same landscape saved as a named .terrainData), to_texture

The landforms are one pattern: a coverage weight (footprint), a profile of the distance (dome) or a value, and core.raster.blend. Parts the nodes share: footprint, dome, mask_weight, nearest (the nearest point of a curve), surface (height, normal and slope under a position), bilinear (a grid of samples read between the four around a point), texel and image (a layer read per texel of an image, and the image's texels), dimensions, wet (water into a region), control (normalized surface weights packed as 8-bit words).

The raster holds more ground than its rect: the tiles store the cells of a border tile past the rect and a ring of cells around the tiles, and every landform and every blend writes them at their own world positions, as the tiles of the ops did. A node that reads at an offset (cell with dx, dz, the slope and curvature of mask, thermal erode, the walk of a droplet) reads those cells, so ground beside the edge slumps, drains and washes into them. The water floods (lake fill) stay inside the rect.

A call answers a node's output directly when it has one (g.terrain.cone({ ... }) is the raster) and a record when it has several (g.terrain.footprint({ ... }).weight).

nearest holds the module that reads a curve's polyline. landscape and write name the landscape record kind (records/terrain.procRecord of this package), whose module declares the surfaces and writes the container.

The noise terrain's relief and masks are made of is the noise prelude of kernels/ (zero_angle_fbm_damped2 and zero_angle_warped2 for fbm, zero_angle_gradient2 for terrace and the noise mask), called through field.call. Erosion droplets are a step Field handed to the walk kernel, their changes summed with the scatter kernel.

Landforms from large to small

A landscape reads as ground when it is built from its largest form down: the design (ramps, ridges and cones along the map's high ground and valleys), one fbm a third of the map across, erode with model = "stream" for the drainage, a damped fbm of at most a tenth of the relief on the gentler ground, strata for the rock bands of the faces, erode with model = "talus" for the scree below them, and surfaces from mask bands over slope, height, flow and the deposit the scree left. "Crafted ground, large to small" in the terrain guide (guides { path = "systems/terrainSystem/documentation/terrain" }) states each step with its scale.

  • fbm sums its layers down to features 8 cells wide when octaves is 0, warps its position by a quarter of featureSize when warp is left out, and divides each layer's height by 1 + detailDamping * s^2, s the slope of the layers below it, so slopes keep to the large forms and the flats keep their fine relief (detailDamping 0 sums every layer at full height).
  • erode model = "stream" finds where water gathers over the whole ground and cuts a branching network of valleys into it. The terrain is averaged down to a working grid of at most workResolution cells a side, eroded by the terrain_erode_stream kernel (drainage area by Jacobi passes over the ground with its depressions filled, an implicit stream-power step toward the steepest lower neighbour, the talus limit and creep), and what changed is added back to the raster by bilinear reads. It writes the drainage area, in square metres, to the layer named by writeFlow (flow); uplift names a layer the ground rises by over the run. A seed gives the same ground on every run. droplet and thermal work as they did. With keepShape (the default) the step never raises a cell, the talus limit lays back only the slope the cutting made steeper and creep evens out only what the run changed, so a cirque, valley or lake hollow carved before the erosion keeps its depth and its faces: carve the landform, then erode it. keepShape = false fills every closed basin to the level it spills at and lays every face back to talus; there, when a cell rises past fillNotice metres (3 by default), the log names the node, how many cells rose and the deepest rise.
  • erode model = "talus" lets steep faces shed rock that runs down and settles at the angle of repose (talus, 34 degrees by default) into fans at their foot and on their ledges. It runs on the same working grid as stream (the terrain_erode_talus kernel: rock under a layer of debris, each pass a face turns a share of shed metres to debris and the debris moves toward the lower neighbours past the repose, exactly conserved), adds what changed back to the raster and writes the debris depth, in metres, to writeDeposit (deposit). cliff is the slope a face sheds all of shed at; fans and fanSize make some stretches of face shed more than others, so the debris gathers into separate fans instead of one even apron.
  • strata steps steep ground into rock bands: a near-vertical riser, then a narrow ledge sloping out from its foot (keeping ledge of the face's slope), band after band step metres apart. The bands lie at irregular heights (irregularity), wander up and down across the face (jitter, jitterSize), tilt with the beds (dip, dipDirection) and break off in patches (breakup, breakupSize). They engage from minSlope to full at fullSlope, so flats keep their shape, and a riser spans at least riserCells cells; a band too thin to hold a riser and a ledge on a face that steep fades back to the face, so lay faces at 45 to 70 degrees and give a steeper face thicker bands. The profile stays at or below the face, so a band cuts into the ground and never stands proud of it.
  • mask input = "flow" bands the base-10 logarithm of that drainage area (2 is a hundred square metres of catchment, 4 a hectare) read from the layer named by source. altitude bands the height as a share of the raster's relief, aspect the angle between the way the ground falls and the compass axis, shore the metres above the nearest water within reach and convexity the ridge-or-gully measure at radius metres; they are measured by modules/terrainMeasure, which terrain.occlusion and terrain.landscape share.
  • occlusion writes the sky visibility of each cell: four azimuth slices (eight directions) of horizon over six distances doubling out to reach, integrated against the ground's normal.
  • terrace takes sharpness (1 puts each rise within two cells, below 1 the last share of each step is an eased rise) and jitter (metres the levels wander by, over features of jitterSize metres); mask confines it. It quantizes the height inside a disc, flats included: paddies, quarry benches, a stepped mesa. Bedded rock on steep faces is strata.