Divooka Reference

Heightmap Selectors

14 nodes

On this page 14

Heightmap Data Usage Token Ambient Occlusion

Function

Usage of an ambient occlusion (sky visibility) field.

Signature
HeightmapDataUsageTokenAmbientOcclusion() -> Text
string HeightmapDataUsageTokenAmbientOcclusion()

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Heightmap Data Usage Token Aspect Degrees

Function

Usage of an aspect field, in compass degrees.

Signature
HeightmapDataUsageTokenAspectDegrees() -> Text
string HeightmapDataUsageTokenAspectDegrees()

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Heightmap Data Usage Token Convexity

Function

Usage of a raw convexity field, in metres above the local mean.

Signature
HeightmapDataUsageTokenConvexity() -> Text
string HeightmapDataUsageTokenConvexity()

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Heightmap Data Usage Token Curvature

Function

Usage of a raw curvature field, in 1/metre.

Signature
HeightmapDataUsageTokenCurvature() -> Text
string HeightmapDataUsageTokenCurvature()

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Heightmap Data Usage Token Distance

Function

Usage of a distance field, in metres.

Signature
HeightmapDataUsageTokenDistance() -> Text
string HeightmapDataUsageTokenDistance()

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Calculate Ambient Occlusion

Function

Measures how much of the sky each cell sees, by marching the horizon in several directions: 1 in the open, darker in valleys, gorges and at the foot of cliffs.

Signature
CalculateAmbientOcclusion -> Scalar Field
    source: Scalar Field
    radiusMetres: Number
    directions: Integer
    steps: Integer
    strength: Number
ScalarField2D CalculateAmbientOcclusion(
    ScalarField2D source,
    double radiusMetres = 300,
    int directions = 16,
    int steps = 16,
    double strength = 1)

Parameters

nametypedefaultdescription
sourceScalar Field—Heightmap in metres.
radiusMetresNumber300How far in metres to look for occluders; larger lets whole mountains shade a valley.
directionsInteger16Number of horizon directions (8 to 32).
stepsInteger16Samples per direction (8 to 32), spaced geometrically so near ground is sampled densely.
strengthNumber1Scales the darkening: 1 is physical, above 1 deepens it.

Returns

resultScalar Field

Remarks

For each direction, samples at geometrically spaced distances (from one cell out to Radius Metres) find the highest elevation angle θ of the horizon; the visibility is 1 − mean(sin θ). The result drives dirt, moss and darkening; invert it for a cavity mask. Beyond the map border the edge cells are taken to continue outward. Cost grows with directions × steps.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Calculate Aspect Degrees

Function

Gives the compass direction each slope faces (its downhill direction), in degrees clockwise from north.

Signature
CalculateAspectDegrees -> Scalar Field
    source: Scalar Field
    heightmapYPointsNorth: Truth
ScalarField2D CalculateAspectDegrees(
    ScalarField2D source,
    bool heightmapYPointsNorth = true)

Parameters

nametypedefaultdescription
sourceScalar Field—Heightmap in metres.
heightmapYPointsNorthTruthTrueTrue when increasing row index points north; false for north-up images.

Returns

resultScalar Field

Remarks

0 faces north, 90 east, 180 south, 270 west; flat cells, which face nowhere, read -1. East is +X (increasing column). By default north is +Y (increasing row), the convention ToHillshade and BakeShadowMap use, so a slope whose aspect equals a hillshade's azimuth is the one that hillshade lights; for an ordinary north-up raster image, where row 0 is the northern edge, set Heightmap Y Points North to false.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Calculate Convexity

Function

Measures how far each cell stands above (positive) or below (negative) the Gaussian-weighted mean height around it, in metres.

Signature
CalculateConvexity -> Scalar Field
    source: Scalar Field
    radiusMetres: Number
ScalarField2D CalculateConvexity(
    ScalarField2D source,
    double radiusMetres = 50)

Parameters

nametypedefaultdescription
sourceScalar Field—Heightmap in metres.
radiusMetresNumber50Standard deviation in metres of the neighbourhood the height is compared with; it sets the size of feature selected.

Returns

resultScalar Field

Remarks

This is the difference between the height and a blur of it, the classic convexity selector: crests, ridges and knobs come out positive, gullies, channels and valley floors negative. Unlike curvature it needs no differentiation, so it is robust on quantised imports.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Calculate Curvature

Function

Measures the surface curvature of a heightmap in 1/metre, positive on convex ground and negative on concave ground.

Signature
CalculateCurvature -> Scalar Field
    source: Scalar Field
    type: Terrain Curvature Type
    scaleMetres: Number
ScalarField2D CalculateCurvature(
    ScalarField2D source,
    TerrainCurvatureType type = TerrainCurvatureType.Mean,
    double scaleMetres = 20)

Parameters

nametypedefaultdescription
sourceScalar Field—Heightmap in metres.
typeTerrain Curvature TypeMeanProfile (down the slope), Plan (across it) or Mean.
scaleMetresNumber20Standard deviation in metres of a Gaussian applied before differentiating; 0 uses the raw cells.

Returns

resultScalar Field

Remarks

Second derivatives come from the 3×3 neighbourhood (Evans–Young / Zevenbergen–Thorne) with the cell size in metres. Imported heightmaps are quantised (a 16-bit file over 2.6 km of relief steps in 4 cm), and second derivatives amplify that into noise, so smooth first: Scale Metres sets the size of landform the curvature describes, from rocks (a few metres) to whole ridges (hundreds). Profile and plan curvature are undefined on perfectly flat ground and read 0 there.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Calculate Distance

Function

Measures the exact straight-line distance in metres from every cell to the nearest cell of a mask.

Signature
CalculateDistance -> Scalar Field
    mask: Scalar Field
    threshold: Number
    signed: Truth
ScalarField2D CalculateDistance(
    ScalarField2D mask,
    double threshold = 0.5,
    bool signed = false)

Parameters

nametypedefaultdescription
maskScalar Field—Mask to measure from, such as water, roads or rock.
thresholdNumber0.5Value at or above which a cell belongs to the mask.
signedTruthFalseIf true, distances inside the mask are negative distances to its edge.

Returns

resultScalar Field

Remarks

Cells at or above Threshold belong to the mask. The transform is exact Euclidean (Felzenszwalb–Huttenlocher), so distances grow in circles, not diamonds or octagons. Unsigned, mask cells read 0 and the cells beside them one cell width (distances run between cell centres). Signed, the mask's inside is negative and both sides are measured from the boundary halfway between cells, so the field is continuous across it. With no mask cells at all, every cell reads the map's diagonal.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Select Aspect

Function

Selects slopes facing a compass direction: a 0..1 mask, for north-facing snow, sun-facing dry grass, moss on shaded sides.

Signature
SelectAspect -> Scalar Field
    source: Scalar Field
    headingDegrees: Number
    spreadDegrees: Number
    falloffDegrees: Number
    minSlopeDegrees: Number
    slopeFalloffDegrees: Number
    heightmapYPointsNorth: Truth
ScalarField2D SelectAspect(
    ScalarField2D source,
    double headingDegrees = 0,
    double spreadDegrees = 45,
    double falloffDegrees = 30,
    double minSlopeDegrees = 3,
    double slopeFalloffDegrees = 5,
    bool heightmapYPointsNorth = true)

Parameters

nametypedefaultdescription
sourceScalar Field—Heightmap in metres.
headingDegreesNumber0Direction the selected slopes face, degrees clockwise from north.
spreadDegreesNumber45Half-width in degrees of the fully selected sector.
falloffDegreesNumber30Degrees beyond the spread over which the mask fades to 0.
minSlopeDegreesNumber3Steepness in degrees below which ground counts as flat and is not selected.
slopeFalloffDegreesNumber5Degrees above the minimum slope over which the selection fades in.
heightmapYPointsNorthTruthTrueTrue when increasing row index points north; false for north-up images.

Returns

resultScalar Field

Remarks

A slope scores 1 when its aspect is within Spread Degrees of the heading, fading to 0 over a further Falloff Degrees. Flat ground has no meaningful aspect, so the score is also faded in with steepness, from Min Slope Degrees over Slope Falloff Degrees. See HeightmapSelectors.CalculateAspectDegrees for the axis convention.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Select Convexity

Function

Selects ridges or gullies by convexity: a 0..1 mask that lights crests and darkens channels (Signed), or keeps one side only.

Signature
SelectConvexity -> Scalar Field
    source: Scalar Field
    radiusMetres: Number
    polarity: Heightmap Selector Polarity
    contrast: Number
    referenceMetres: Number
ScalarField2D SelectConvexity(
    ScalarField2D source,
    double radiusMetres = 50,
    HeightmapSelectorPolarity polarity = HeightmapSelectorPolarity.Signed,
    double contrast = 1,
    double referenceMetres = 0)

Parameters

nametypedefaultdescription
sourceScalar Field—Heightmap in metres.
radiusMetresNumber50Size of feature to respond to: standard deviation in metres of the neighbourhood.
polarityHeightmap Selector PolaritySignedConvex, Concave, or Signed (0.5 is neither).
contrastNumber1Multiplier before saturation; higher makes the mask harder.
referenceMetresNumber0Height above the local mean that maps to tanh(1) ≈ 0.76; 0 picks it from the field.

Returns

resultScalar Field

Remarks

The convexity (metres above the local mean) is divided by a reference height and passed through tanh. With the reference left at 0 it is the field's own 90th percentile of |convexity|; give it in metres (e.g. 5) when separate tiles must agree.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Select Curvature

Function

Selects convex or concave ground by its curvature: a 0..1 mask.

Signature
SelectCurvature -> Scalar Field
    source: Scalar Field
    type: Terrain Curvature Type
    scaleMetres: Number
    polarity: Heightmap Selector Polarity
    contrast: Number
    referenceCurvature: Number
ScalarField2D SelectCurvature(
    ScalarField2D source,
    TerrainCurvatureType type = TerrainCurvatureType.Mean,
    double scaleMetres = 20,
    HeightmapSelectorPolarity polarity = HeightmapSelectorPolarity.Convex,
    double contrast = 1,
    double referenceCurvature = 0)

Parameters

nametypedefaultdescription
sourceScalar Field—Heightmap in metres.
typeTerrain Curvature TypeMeanProfile, Plan or Mean curvature.
scaleMetresNumber20Size of landform to respond to: standard deviation in metres of the smoothing applied first.
polarityHeightmap Selector PolarityConvexConvex, Concave, or Signed (0.5 is flat).
contrastNumber1Multiplier before saturation; higher makes the mask harder and wider.
referenceCurvatureNumber0Curvature in 1/metre that maps to tanh(1) ≈ 0.76 (Convex/Concave); 0 picks it from the field.

Returns

resultScalar Field

Remarks

The curvature is divided by a reference curvature and passed through tanh, so the mask saturates smoothly instead of clipping. With the reference left at 0 it is the field's own 90th percentile of |curvature|, which adapts to any terrain but differs between tiles; give an explicit reference (in 1/metre, e.g. 0.002 for a 500 m bending radius) when tiles must match.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation

Select Distance Band

Function

Selects a band of ground at a distance range from a mask: shore strips beside water, riverbank sediment, verges along roads, scree aprons below rock.

Signature
SelectDistanceBand -> Scalar Field
    mask: Scalar Field
    minMetres: Number
    maxMetres: Number
    falloffMetres: Number
    threshold: Number
ScalarField2D SelectDistanceBand(
    ScalarField2D mask,
    double minMetres = 0,
    double maxMetres = 30,
    double falloffMetres = 10,
    double threshold = 0.5)

Parameters

nametypedefaultdescription
maskScalar Field—Mask to measure from.
minMetresNumber0Inner edge of the band, metres from the mask.
maxMetresNumber30Outer edge of the band, metres from the mask.
falloffMetresNumber10Width in metres of the fade on each side.
thresholdNumber0.5Value at or above which a cell belongs to the mask.

Returns

resultScalar Field

Remarks

Built on HeightmapSelectors.CalculateDistance. The band is fully selected between Min Metres and Max Metres from the mask and fades over Falloff Metres on each side; with a minimum of 0 the mask itself is included and only the outer edge fades.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Selectors
Package
Procedural Generation