Divooka Reference

Terrain Layering

28 nodes

On this page 28

Add Terrain Layers

Function

A stack with more layers laid over the top of it: a natural stack with a layer of one's own, a saved stack with another.

Signature
AddLayers -> Terrain Layer Stack
    stack: Terrain Layer Stack
    layers: Terrain Layer Array
TerrainLayerStack AddLayers(
    TerrainLayerStack stack,
    TerrainLayer[] layers)

Parameters

nametypedefaultdescription
stackTerrain Layer Stack—The stack.
layersTerrain Layer Array—The layers to add, bottom first.

Returns

StackTerrain Layer Stack
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Aspect Mask

Function

Slopes facing a compass direction: the shaded northern faces snow lingers on, or the sunny southern ones that dry first.

Signature
AspectMask -> Terrain Mask
    headingDegrees: Number
    spreadDegrees: Number
    falloffDegrees: Number
TerrainMask AspectMask(
    double headingDegrees = 0,
    double spreadDegrees = 70,
    double falloffDegrees = 50)

Parameters

nametypedefaultdescription
headingDegreesNumber0The direction faced, degrees clockwise from north.
spreadDegreesNumber70How far either side of it a slope still counts, degrees.
falloffDegreesNumber50How many degrees the mask fades over beyond that.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Bake Layer Stack

Function

Bakes a layer stack into colour, normal, roughness and height maps, as Bake Terrain Surface does a palette.

Signature
BakeLayerStack -> Baked Terrain Surface
    stack: Terrain Layer Stack
    bakeSize: Integer
    water: Scalar Field
BakedTerrainSurface BakeLayerStack(
    TerrainLayerStack stack,
    int bakeSize = 2048,
    ScalarField2D water)

Parameters

nametypedefaultdescription
stackTerrain Layer Stack—The stack.
bakeSizeInteger2048Pixels across the result; the depth follows the terrain's shape.
waterScalar Field—The water surface in metres, NaN on dry ground, as Terrain Water's Fill gives it: the images show the water over the ground, and the stack's masks can read it as water.

Returns

SurfaceBaked Terrain Surface
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Blur Mask

Function

Softens a mask's edges.

Signature
BlurMask -> Terrain Mask
    mask: Terrain Mask
    radiusCells: Number
TerrainMask BlurMask(TerrainMask mask, double radiusCells = 2)

Parameters

nametypedefaultdescription
maskTerrain Mask—The mask.
radiusCellsNumber2How far, in baked cells.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Combine Masks

Function

Two masks as one: where both are, either, one less the other, or the greater or lesser of them.

Signature
CombineMasks -> Terrain Mask
    first: Terrain Mask
    second: Terrain Mask
    mode: Terrain Mask Combine
TerrainMask CombineMasks(
    TerrainMask first,
    TerrainMask second,
    TerrainMaskCombine mode = TerrainMaskCombine.Multiply)

Parameters

nametypedefaultdescription
firstTerrain Mask—The first mask.
secondTerrain Mask—The second mask.
modeTerrain Mask CombineMultiplyHow they are put together.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Convexity Mask

Function

Convex ground - ridge and mesa tops, spurs - or concave ground - hollows, valley floors, the feet of walls - at a feature size.

Signature
ConvexityMask -> Terrain Mask
    radiusMetres: Number
    polarity: Heightmap Selector Polarity
    landformMetres: Number
TerrainMask ConvexityMask(
    double radiusMetres = 50,
    HeightmapSelectorPolarity polarity = HeightmapSelectorPolarity.Convex,
    double landformMetres = 4)

Parameters

nametypedefaultdescription
radiusMetresNumber50The size of the rises or hollows, metres: broad for a plateau, narrow for a rim.
polarityHeightmap Selector PolarityConvexConvex for rises, Concave for hollows, Signed for both about 0.5.
landformMetresNumber4The terrain is smoothed over this first, metres.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Curvature Mask

Function

The terrain's curvature at a feature size: 0.5 flat, toward 1 on ridges and rims, toward 0 in gullies and at the feet of slopes.

Signature
CurvatureMask -> Terrain Mask
    radiusMetres: Number
    metresForFull: Number
TerrainMask CurvatureMask(
    double radiusMetres = 10,
    double metresForFull = 1)

Parameters

nametypedefaultdescription
radiusMetresNumber10The size of the features measured, metres.
metresForFullNumber1How far above or below its surroundings ground must stand to reach 1 or 0, metres.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Field Mask

Function

A field as a mask, stretched over the terrain: a painted mask, an erosion's map, any heightmap-shaped data. A name lets a saved stack ask for the field again by it when it is loaded.

Signature
FieldMask -> Terrain Mask
    field: Scalar Field
    normalize: Truth
    name: Text
TerrainMask FieldMask(
    ScalarField2D field,
    bool normalize = true,
    string name = "")

Parameters

nametypedefaultdescription
fieldScalar Field—The field.
normalizeTruthTrueStretch the field's range to 0..1; leave it off for a field already in 0..1.
nameText—A name to save the stack with; the field is not saved, and is asked for by this name when the stack is loaded.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Full Mask

Function

Everywhere.

Signature
FullMask() -> Terrain Mask
TerrainMask FullMask()

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Height Mask

Function

Ground between two elevations, fading in and out over a distance on either side.

Signature
HeightMask -> Terrain Mask
    minMetres: Number
    maxMetres: Number
    falloffMetres: Number
TerrainMask HeightMask(
    double minMetres = 0,
    double maxMetres = 100,
    double falloffMetres = 5)

Parameters

nametypedefaultdescription
minMetresNumber0The lowest elevation, metres.
maxMetresNumber100The highest elevation, metres.
falloffMetresNumber5How far the mask fades on either side, metres.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Input Mask

Function

A map the stack is baked with, by name: debris, deposition, wear, water or wetBanks from Terrain Analysis Maps, or a name a Field Mask was given.

Signature
InputMask(name: Text, normalize: Truth) -> Terrain Mask
TerrainMask InputMask(
    string name = "debris",
    bool normalize = false)

Parameters

nametypedefaultdescription
nameTextdebrisThe map's name.
normalizeTruthFalseStretch the map's range to 0..1.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Invert Mask

Function

One less the mask: where it was, now where it was not.

Signature
InvertMask(mask: Terrain Mask) -> Terrain Mask
TerrainMask InvertMask(TerrainMask mask)

Parameters

nametypedefaultdescription
maskTerrain Mask—The mask.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Terrain Layer

Function

One layer of a terrain's surface: a material, where it goes, and how it meets the layers below.

Signature
Layer -> Terrain Layer
    material: Terrain Surface Material
    mask: Terrain Mask
    blend: Terrain Layer Blend
    tileMetres: Number
    projection: Terrain Layer Projection
    tint: Optional Color
    brightness: Number
    saturation: Number
    opacity: Number
    threshold: Number
    softness: Number
    normalStrength: Number
    roughnessOffset: Number
    leaveToRenderer: Truth
    name: Text
TerrainLayer Layer(
    TerrainSurfaceMaterial material,
    TerrainMask mask,
    TerrainLayerBlend blend = TerrainLayerBlend.HeightOver,
    double tileMetres = 0,
    TerrainLayerProjection projection = TerrainLayerProjection.Planar,
    ColorElement? tint,
    double brightness = 1,
    double saturation = 1,
    double opacity = 1,
    double threshold = 0,
    double softness = 0.08,
    double normalStrength = 1,
    double roughnessOffset = 0,
    bool leaveToRenderer = false,
    string name = "Layer")

Parameters

nametypedefaultdescription
materialTerrain Surface Material—The material, from Library Material, Load Texture Set or Terrain Material.
maskTerrain Mask—Where it goes; everywhere when left out.
blendTerrain Layer BlendHeight overHow it meets what is under it: Normal by the mask alone; HeightOver by the material's own height, so its stones break through first; HeightFill into the low places of what is under it; Liquid as standing water.
tileMetresNumber0The width in metres of the ground one copy of the material covers; the material's own size when left at 0.
projectionTerrain Layer ProjectionPlanarPlanar from above, or Triplanar from three sides so that it does not stretch down steep faces.
tintOptional Color—Multiplies the material's colour: white leaves it.
brightnessNumber1Multiplies the tint, so that a material can be made paler than its photograph.
saturationNumber10 grey, 1 as photographed, above 1 more vivid.
opacityNumber1How strongly the layer covers what is under it.
thresholdNumber0For the height blends: positive shows more of the layer, negative less.
softnessNumber0.08For the height blends: how soft the edge between the layer and what is under it is.
normalStrengthNumber1How strongly the material's relief shows: 0 flat, 1 as authored.
roughnessOffsetNumber0Added to the material's roughness: negative is shinier.
leaveToRendererTruthFalseLeave the material to a renderer that samples it at full detail from three sides, as Render Terrain does for cliffs; the images show it baked in.
nameTextLayerThe layer's name.

Returns

LayerTerrain Layer
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Terrain Layer Stack

Function

Layers over a terrain, the first at the bottom: a surface ready to bake.

Signature
LayerStack -> Terrain Layer Stack
    terrain: Scalar Field
    layers: Terrain Layer Array
    baseColour: Optional Color
    fewestTilePixels: Integer
TerrainLayerStack LayerStack(
    ScalarField2D terrain,
    TerrainLayer[] layers,
    ColorElement? baseColour,
    int fewestTilePixels = 256)

Parameters

nametypedefaultdescription
terrainScalar Field—Heights in metres, with their metres per cell.
layersTerrain Layer Array—The layers, bottom first.
baseColourOptional Color—The colour under every layer.
fewestTilePixelsInteger256The fewest baked pixels one copy of a material may span, so that a terrain seen whole is not wallpaper; 0 lays every material at its true size.

Returns

StackTerrain Layer Stack
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Load Layer Stack

Function

Lays a saved layer stack over a terrain. The stack names the maps its masks read, which must be given; a material that was made from images in a graph is asked for by its name.

Signature
LoadLayerStack -> Terrain Layer Stack
    path: Text
    terrain: Scalar Field
    analysis: Terrain Analysis Maps
    materials: Terrain Surface Material Array
    fields: Scalar Field Array
    fieldNames: Text Array
TerrainLayerStack LoadLayerStack(
    string path,
    ScalarField2D terrain,
    TerrainAnalysisMaps analysis,
    TerrainSurfaceMaterial[] materials,
    ScalarField2D[] fields,
    string[] fieldNames)

Parameters

nametypedefaultdescription
pathText—The saved stack.
terrainScalar Field—The terrain to lay it over.
analysisTerrain Analysis Maps—The maps its masks read: an erosion's debris, deposition and wear, the water.
materialsTerrain Surface Material Array—Materials the stack could not save, by their names.
fieldsScalar Field Array—Fields its Field Masks were saved by name, matched to the names of their masks in the order given.
fieldNamesText Array—The names of those fields.

Returns

StackTerrain Layer Stack
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Mask Brightness Contrast

Function

Brightens a mask and sets its contrast about its middle.

Signature
MaskBrightnessContrast -> Terrain Mask
    mask: Terrain Mask
    brightness: Number
    contrast: Number
TerrainMask MaskBrightnessContrast(
    TerrainMask mask,
    double brightness = 0,
    double contrast = 1)

Parameters

nametypedefaultdescription
maskTerrain Mask—The mask.
brightnessNumber0Added to every value.
contrastNumber1How far values are pushed from 0.5: 1 leaves them.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Mask Levels

Function

Stretches a mask so that a low value becomes 0 and a high one 1, holding the rest to 0..1: the Levels of every mask stack.

Signature
MaskLevels -> Terrain Mask
    mask: Terrain Mask
    low: Number
    high: Number
TerrainMask MaskLevels(
    TerrainMask mask,
    double low = 0.25,
    double high = 0.75)

Parameters

nametypedefaultdescription
maskTerrain Mask—The mask.
lowNumber0.25The value that becomes 0.
highNumber0.75The value that becomes 1.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Mask Power

Function

Raises a mask to a power: above 1 narrows it to its strongest parts, below 1 spreads it.

Signature
MaskPower(mask: Terrain Mask, exponent: Number) -> Terrain Mask
TerrainMask MaskPower(TerrainMask mask, double exponent = 2)

Parameters

nametypedefaultdescription
maskTerrain Mask—The mask.
exponentNumber2The power.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Mask Threshold

Function

A soft cut-off: 0 below one value, 1 above another, smooth between.

Signature
MaskThreshold -> Terrain Mask
    mask: Terrain Mask
    from: Number
    to: Number
TerrainMask MaskThreshold(
    TerrainMask mask,
    double from = 0.4,
    double to = 0.6)

Parameters

nametypedefaultdescription
maskTerrain Mask—The mask.
fromNumber0.4Below this, 0.
toNumber0.6Above this, 1.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Natural Terrain Stack

Function

The layer stack Bake Terrain Surface lays a palette with in its natural style - ground, its variation, exposed tops, sediment, fallen rock, cliffs, wet banks, the shore and snow, each by the land's shape - for layers of one's own to be added to before it is baked.

Signature
NaturalStack -> Terrain Layer Stack
    terrain: Scalar Field
    palette: Terrain Palette
    analysis: Terrain Analysis Maps
    settings: Natural Terrain Settings
TerrainLayerStack NaturalStack(
    ScalarField2D terrain,
    TerrainPalette palette,
    TerrainAnalysisMaps analysis,
    NaturalTerrainSettings settings)

Parameters

nametypedefaultdescription
terrainScalar Field—Heights in metres, with their metres per cell.
paletteTerrain Palette—The materials by role; the default palette when left out.
analysisTerrain Analysis Maps—An erosion's maps and the water, which the stack lays fallen rock, sediment and wet ground by.
settingsNatural Terrain Settings—Where each role goes.

Returns

StackTerrain Layer Stack
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Near Input Mask

Function

Ground within a distance of where a map the stack is baked with is set: a beach along the water, a bank beside it.

Signature
NearInputMask -> Terrain Mask
    name: Text
    nearMetres: Number
    farMetres: Number
    fadeMetres: Number
TerrainMask NearInputMask(
    string name = "water",
    double nearMetres = 0,
    double farMetres = 10,
    double fadeMetres = 5)

Parameters

nametypedefaultdescription
nameTextwaterThe map's name; water for the water the bake is given.
nearMetresNumber0The nearest ground in the band, metres.
farMetresNumber10The farthest ground in the band, metres.
fadeMetresNumber5How far the band fades at its edges, metres.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Near Slope Mask

Function

Ground within a distance of where the slope lies between two angles: the foot of a cliff, the reach of rock fallen from it.

Signature
NearSlopeMask -> Terrain Mask
    minDegrees: Number
    maxDegrees: Number
    falloffDegrees: Number
    nearMetres: Number
    farMetres: Number
    fadeMetres: Number
    landformMetres: Number
TerrainMask NearSlopeMask(
    double minDegrees = 44,
    double maxDegrees = 90,
    double falloffDegrees = 6,
    double nearMetres = 0,
    double farMetres = 60,
    double fadeMetres = 30,
    double landformMetres = 4)

Parameters

nametypedefaultdescription
minDegreesNumber44The gentlest slope measured from, degrees.
maxDegreesNumber90The steepest slope measured from, degrees.
falloffDegreesNumber6How many degrees the slope fades over.
nearMetresNumber0The nearest ground in the band, metres.
farMetresNumber60The farthest ground in the band, metres.
fadeMetresNumber30How far the band fades at its edges, metres.
landformMetresNumber4The terrain is smoothed over this first, metres.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Noise Mask

Function

Fractal noise laid over the ground in metres, 0..1: the large patches that keep one material from reading as one colour across a kilometre.

Signature
NoiseMask -> Terrain Mask
    featureMetres: Number
    seed: Integer
    octaves: Integer
TerrainMask NoiseMask(
    double featureMetres = 200,
    int seed = 1337,
    int octaves = 4)

Parameters

nametypedefaultdescription
featureMetresNumber200The size of its largest patches, metres.
seedInteger1337Which pattern.
octavesInteger4How many finer scales of detail are added to the largest.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Save Layer Stack

Function

Saves a layer stack as a small JSON document - every layer, its mask and settings, and each material by its library id or folder - to lay over any terrain later with Load Layer Stack. The terrain and the maps its masks read are not saved.

Signature
SaveLayerStack(stack: Terrain Layer Stack, path: Text) -> Text
string SaveLayerStack(TerrainLayerStack stack, string path)

Parameters

nametypedefaultdescription
stackTerrain Layer Stack—The stack.
pathText—Where to save it; .json is usual.

Returns

PathText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Slope Mask

Function

Ground whose slope lies between two angles, fading over a few degrees on either side: flats, gentle slopes, cliffs.

Signature
SlopeMask -> Terrain Mask
    minDegrees: Number
    maxDegrees: Number
    falloffDegrees: Number
    landformMetres: Number
TerrainMask SlopeMask(
    double minDegrees = 35,
    double maxDegrees = 90,
    double falloffDegrees = 5,
    double landformMetres = 4)

Parameters

nametypedefaultdescription
minDegreesNumber35The gentlest slope, degrees.
maxDegreesNumber90The steepest slope, degrees; 90 is a wall.
falloffDegreesNumber5How many degrees the mask fades over on either side.
landformMetresNumber4Slope is measured on the terrain smoothed over this, so the mask follows landforms rather than every boulder; 0 measures it cell by cell.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Underlying Curvature Mask

Function

The curvature of the materials laid by the layers below this one, 0.5 flat: the edges of stones, the cracks between them.

Signature
UnderlyingCurvatureMask -> Terrain Mask
    radiusCells: Number
    unitsForFull: Number
TerrainMask UnderlyingCurvatureMask(
    double radiusCells = 2,
    double unitsForFull = 0.1)

Parameters

nametypedefaultdescription
radiusCellsNumber2The size of the features measured, in baked cells.
unitsForFullNumber0.1How far in material height a point must stand above or below its surroundings to reach 1 or 0.

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Underlying Height Mask

Function

The height of the materials laid by the layers below this one, 0..1: Mixer's underlying mix, for a layer that fills the gaps between stones or sits on their tops.

Signature
UnderlyingHeightMask() -> Terrain Mask
TerrainMask UnderlyingHeightMask()

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation

Wetness Mask

Function

Where water draining over the terrain would gather: the topographic wetness index, high along valley floors and in hollows.

Signature
WetnessMask() -> Terrain Mask
TerrainMask WetnessMask()

Returns

MaskTerrain Mask
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Terrain Layering
Package
Procedural Generation