Heightmap Amplification
8 nodes
On this page 8
Heightmap Data Usage Token Detail Amplitude
FunctionUsage of a detail amplitude map, in metres of RMS height at the reference scale.
HeightmapDataUsageTokenDetailAmplitude() -> Text
string HeightmapDataUsageTokenDetailAmplitude()
Returns
| result | Text |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Heightmap Amplification
- Package
- Procedural Generation
Add Fractal Detail
FunctionAdds fractal detail below the resolution of the data a heightmap was made from, scaled by the terrain's own roughness and slope.
AddFractalDetail -> Scalar Field
heightmap: Scalar Field
sourceCellMetres: Number
strength: Number
hurst: Number
style: Heightmap Detail Style
warp: Number
steepSlopeDegrees: Number
flatSlopeDegrees: Number
flatAmount: Number
stillWaterSlopeDegrees: Number
finestFeatureMetres: Number
mask: Scalar Field
seed: IntegerScalarField2D AddFractalDetail(
ScalarField2D heightmap,
double sourceCellMetres = 0,
double strength = 0.6,
double hurst = 0.8,
HeightmapDetailStyle style = HeightmapDetailStyle.Eroded,
double warp = 0.1,
double steepSlopeDegrees = 35,
double flatSlopeDegrees = 3,
double flatAmount = 0.3,
double stillWaterSlopeDegrees = 0.5,
double finestFeatureMetres = 0,
ScalarField2D mask,
int seed = 1337)Parameters
| name | type | default | description |
|---|---|---|---|
| heightmap | Scalar Field | — | Heights in metres; PhysicalScale in metres per cell. |
| sourceCellMetres | Number | 0 | Cell size in metres of the data the heightmap came from (10 for a 1/3 arc-second survey); 0 uses the heightmap's own cell size. |
| strength | Number | 0.6 | Multiplier of the detail: 1 restores the relief lidar shows and a 10 m survey lacks, 0 adds nothing; 0.6 reads best in renders. |
| hurst | Number | 0.8 | Hurst exponent, 0..1: how fast the roughness falls with feature size. 0.8 suits most landscapes; lower is rougher at small scales, higher smoother. |
| style | Heightmap Detail Style | Eroded | Fbm (rounded), Ridged (rock ribs) or Eroded (clean faces, rough tops and hollows). |
| warp | Number | 0.1 | Domain warp as a fraction of the coarsest feature size; 0 disables it. |
| steepSlopeDegrees | Number | 35 | Slope at and above which the detail is at full strength. |
| flatSlopeDegrees | Number | 3 | Slope at and below which the detail is reduced to Flat Amount. |
| flatAmount | Number | 0.3 | Fraction of the detail kept on flat ground, 0..1. |
| stillWaterSlopeDegrees | Number | 0.5 | Below this slope (a hydro-flattened lake or river surface) the detail fades to nothing; 0 disables the cut. |
| finestFeatureMetres | Number | 0 | Smallest feature size to add, in metres; 0 uses three output cells. |
| mask | Scalar Field | — | Optional 0..1 mask the same size as the heightmap that scales the detail (e.g. 0 on water, roads or buildings). |
| seed | Integer | 1337 | Noise seed; the same seed gives the same detail. |
Returns
| result | Scalar Field |
Remarks
Octave feature sizes run from four times Source Cell Metres down to Finest Feature Metres (three output cells when 0), each about half the last. The amplitude of each octave is the local envelope (see HeightmapAmplification.CalculateDetailAmplitude) times a calibration constant times (feature size / coarsest size)^Hurst times Strength; at strength 1 the result matches the RMS relief that 1 m lidar has and a 10 m resampling of it lacks. The octaves are evaluated at gently domain-warped world positions and each is rotated, so the detail has no grid direction.
Give the source's true cell size when the heightmap has already been upsampled, otherwise the detail starts at the heightmap's own cell and adds nothing the source lacked.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Heightmap Amplification
- Package
- Procedural Generation
Add Strata
FunctionAdds sedimentary bedding: steep ground breaks into ledges and short cliff bands that follow the contours, the way layered rock weathers, while flat ground keeps its shape.
AddStrata -> Scalar Field
heightmap: Scalar Field
layerThicknessMetres: Number
strength: Number
thinBedFraction: Number
dipDegrees: Number
dipAzimuthDegrees: Number
warpMetres: Number
anchorHeight: Number
mask: Scalar Field
seed: IntegerScalarField2D AddStrata(
ScalarField2D heightmap,
double layerThicknessMetres = 8,
double strength = 0.6,
double thinBedFraction = 0.2,
double dipDegrees = 0,
double dipAzimuthDegrees = 0,
double warpMetres = 2,
double anchorHeight = double.NaN,
ScalarField2D mask,
int seed = 1337)Parameters
| name | type | default | description |
|---|---|---|---|
| heightmap | Scalar Field | — | Heights in metres. |
| layerThicknessMetres | Number | 8 | Mean thickness of a bed in metres. |
| strength | Number | 0.6 | How strongly beds terrace, 0..1: 0 leaves the surface unchanged; above about 0.75 the sharpest beds may fold a contour back on itself. |
| thinBedFraction | Number | 0.2 | Share of the strength given to the thin beds, 0..1. |
| dipDegrees | Number | 0 | Dip of the bedding planes in degrees. |
| dipAzimuthDegrees | Number | 0 | Compass direction the beds dip toward, clockwise from north (up the map). |
| warpMetres | Number | 2 | Vertical waviness of the beds in metres, over a few hundred metres. |
| anchorHeight | Number | NaN | Elevation in metres that the bedding leaves exactly in place (a river or lake level); NaN uses the lowest height on the map, which in a canyon is its river. |
| mask | Scalar Field | — | Optional 0..1 mask the same size as the heightmap that scales the effect; keep its edges soft, since a hard edge becomes a step of up to the largest movement. |
| seed | Integer | 1337 | Seed of the bed sequence. |
Returns
| result | Scalar Field |
Remarks
Heights are remapped through a monotone function of elevation: within each bed, height changes slowly above and below a band where it changes quickly, so a slope breaks into benches and a cliff band per bed. Because only elevation is remapped, the ledges follow the contours exactly and the effect grows with slope by itself: a flat plateau or a lake is one elevation and moves as a whole, keeping its shape. Up to a strength of about 0.75 the remap never reverses the order of two heights, so it creates no pits or spikes. Bed thickness varies along a slow fractal of elevation and each bed has its own hardness (how strongly it terraces) and position of its cliff band; a second set of thin beds about a quarter as thick adds finer banding. The beds are warped and may dip, so they are not perfectly level. A cell moves by at most about a third of the bed thickness times the strength (about 1.5 m for 8 m beds at strength 0.6); on a 60° wall that sets ledges back by about a metre.
The remap is shifted so that ground at Anchor Height does not move at all: give the water level there, so a river or lake stays where the water surface expects it. Gating the bedding off on flat ground instead would turn the offset at the water's edge into a step along every bank.
Apply it to a smooth surface (after HeightmapAmplification.Upsample, before HeightmapAmplification.AddFractalDetail); applied after noise, the noise jitters which bed a cell falls in.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Heightmap Amplification
- Package
- Procedural Generation
Calculate Detail Amplitude
FunctionThe local amplitude HeightmapAmplification.AddFractalDetail uses, as a map: the RMS height in metres of detail at the reference size (twice the source cell), before strength is applied.
CalculateDetailAmplitude -> Scalar Field
heightmap: Scalar Field
sourceCellMetres: Number
steepSlopeDegrees: Number
flatSlopeDegrees: Number
flatAmount: Number
stillWaterSlopeDegrees: NumberScalarField2D CalculateDetailAmplitude(
ScalarField2D heightmap,
double sourceCellMetres = 0,
double steepSlopeDegrees = 35,
double flatSlopeDegrees = 3,
double flatAmount = 0.3,
double stillWaterSlopeDegrees = 0.5)Parameters
| name | type | default | description |
|---|---|---|---|
| heightmap | Scalar Field | — | Heights in metres. |
| sourceCellMetres | Number | 0 | Cell size in metres of the data the heightmap came from; 0 uses the heightmap's own. |
| steepSlopeDegrees | Number | 35 | Slope at and above which the amplitude is not reduced. |
| flatSlopeDegrees | Number | 3 | Slope at and below which the amplitude is reduced to Flat Amount. |
| flatAmount | Number | 0.3 | Fraction kept on flat ground. |
| stillWaterSlopeDegrees | Number | 0.5 | Below this slope the amplitude fades to zero; 0 disables the cut. |
Returns
| result | Scalar Field |
Remarks
It combines two measures in quadrature: the roughness the source shows at its finest scale (the RMS of the source minus a one-cell blur, averaged over two cells), and a slope term, a twentieth of the height a plane of the local slope gains over the reference size, so that a smooth but steep face still roughens a little. On lidar the envelope correlates with the relief a 10 m resampling loses at 0.91 to 0.94. The result is weighted by the slope ramp and still-water cut and capped at half the reference size. Useful as a mask of where the terrain will change, or to tune the slope parameters before running the detail.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Heightmap Amplification
- Package
- Procedural Generation
Refine
FunctionRefines a coarse heightmap for rendering: a smooth upsample to Target Cell Metres and fractal detail below the source's resolution.
Refine -> Scalar Field
source: Scalar Field
targetCellMetres: Number
detailStrength: Number
seed: Integer
hurst: Number
style: Heightmap Detail Style
kernel: Heightmap Upsampling Kernel
mask: Scalar Field
strataThicknessMetres: Number
strataStrength: NumberScalarField2D Refine(
ScalarField2D source,
double targetCellMetres = 1,
double detailStrength = 0.6,
int seed = 1337,
double hurst = 0.8,
HeightmapDetailStyle style = HeightmapDetailStyle.Eroded,
HeightmapUpsamplingKernel kernel = HeightmapUpsamplingKernel.MonotoneCubic,
ScalarField2D mask,
double strataThicknessMetres = 0,
double strataStrength = 0.6)Parameters
| name | type | default | description |
|---|---|---|---|
| source | Scalar Field | — | Heightmap as surveyed, heights and PhysicalScale in metres. |
| targetCellMetres | Number | 1 | Cell size of the result in metres. |
| detailStrength | Number | 0.6 | Multiplier of the added detail: 1 restores the relief lidar shows and a 10 m survey lacks, 0 adds none; 0.6 reads best in renders. |
| seed | Integer | 1337 | Noise seed. |
| hurst | Number | 0.8 | Hurst exponent of the detail, 0..1; 0.8 suits most landscapes. |
| style | Heightmap Detail Style | Eroded | Fbm, Ridged or Eroded detail. |
| kernel | Heightmap Upsampling Kernel | Monotone cubic | Upsampling kernel; MonotoneCubic does not overshoot at cliffs. |
| mask | Scalar Field | — | Optional 0..1 detail mask at the source's resolution (e.g. 0 on water); it is upsampled bilinearly. |
| strataThicknessMetres | Number | 0 | Mean bed thickness for HeightmapAmplification.AddStrata, applied between the upsample and the detail; 0 (the default) adds no bedding. Use it for layered sedimentary rock: canyons, mesas, badlands. |
| strataStrength | Number | 0.6 | Strength of the bedding, 0..1. |
Returns
| result | Scalar Field |
Remarks
The source's cell size is taken as the resolution of its information, so give the heightmap as surveyed (a 10 m model at 10 m cells), not one already upsampled. With Detail Strength 0 this is just HeightmapAmplification.Upsample. For layered rock give a bed thickness (8 to 12 m, with detail strength nearer 0.4); for downslope streaks follow with a short erosion, see the class remarks.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Heightmap Amplification
- Package
- Procedural Generation
Resample
FunctionResamples a heightmap to an exact number of columns and rows over the same ground.
Resample -> Scalar Field
source: Scalar Field
columns: Integer
rows: Integer
kernel: Heightmap Upsampling KernelScalarField2D Resample(
ScalarField2D source,
int columns,
int rows,
HeightmapUpsamplingKernel kernel = HeightmapUpsamplingKernel.MonotoneCubic)Parameters
| name | type | default | description |
|---|---|---|---|
| source | Scalar Field | — | Heightmap to resample. |
| columns | Integer | — | Columns of the result. |
| rows | Integer | — | Rows of the result. |
| kernel | Heightmap Upsampling Kernel | Monotone cubic | Interpolation; see HeightmapAmplification.Upsample. |
Returns
| result | Scalar Field |
Remarks
PhysicalScale becomes the source width in metres divided by Columns; when the aspect ratio changes, the rows are stretched to the same extent and the cells are no longer square, which PhysicalScale cannot describe, so keep the aspect ratio for heightmaps.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Heightmap Amplification
- Package
- Procedural Generation
Upsample
FunctionResamples a heightmap to a finer cell size in metres, keeping its ground extent.
Upsample -> Scalar Field
source: Scalar Field
targetCellMetres: Number
kernel: Heightmap Upsampling KernelScalarField2D Upsample(
ScalarField2D source,
double targetCellMetres = 1,
HeightmapUpsamplingKernel kernel = HeightmapUpsamplingKernel.MonotoneCubic)Parameters
| name | type | default | description |
|---|---|---|---|
| source | Scalar Field | — | Heightmap to resample; its PhysicalScale must be metres per cell. |
| targetCellMetres | Number | 1 | Cell size of the result in metres. |
| kernel | Heightmap Upsampling Kernel | Monotone cubic | Interpolation: MonotoneCubic (smooth, no overshoot; recommended), CatmullRom (smooth, rings at cliffs) or Bilinear (faceted). |
Returns
| result | Scalar Field |
Remarks
The output covers the same ground: its width in cells is the source's width in metres divided by Target Cell Metres, rounded, and its PhysicalScale is adjusted so the extent is exact. Samples sit at cell centres, as ScalarField2D.SampleWorldBilinearClamped assumes. Within half a source cell of the border the cubic kernels continue the edge slope rather than flattening. A coarser target is allowed; the source is then blurred first so it does not alias.
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Heightmap Amplification
- Package
- Procedural Generation
Upsample By Factor
FunctionResamples a heightmap by a factor (2 doubles the cells along each side), keeping its ground extent.
UpsampleByFactor -> Scalar Field
source: Scalar Field
factor: Number
kernel: Heightmap Upsampling KernelScalarField2D UpsampleByFactor(
ScalarField2D source,
double factor = 4,
HeightmapUpsamplingKernel kernel = HeightmapUpsamplingKernel.MonotoneCubic)Parameters
| name | type | default | description |
|---|---|---|---|
| source | Scalar Field | — | Heightmap to resample. |
| factor | Number | 4 | Ratio of the source cell size to the result's; need not be a whole number. |
| kernel | Heightmap Upsampling Kernel | Monotone cubic | Interpolation; see HeightmapAmplification.Upsample. |
Returns
| result | Scalar Field |
- Ships with
- Divooka ExploreDivooka Compute
- Graph kinds
- Flows Function Events Routine Constructs StateMachineState
- Declared by
- Heightmap Amplification
- Package
- Procedural Generation