Divooka Reference

Heightmap Files

5 nodes

On this page 5

Export Obj

Function

Exports the heightmap to an OBJ 3D file.

Signature
ExportObj
    heightmap: Scalar Field
    filePath: Text
    useQuads: Truth
    includeNormals: Truth
    includeTextureCoords: Truth
    vertexMode: Truth
void ExportObj(
    ScalarField2D heightmap,
    string filePath,
    bool useQuads = false,
    bool includeNormals = false,
    bool includeTextureCoords = false,
    bool vertexMode = false)

Parameters

nametypedefaultdescription
heightmapScalar Field—
filePathText—The path to the OBJ file to be created.
useQuadsTruthFalseIf true, exports using quads; otherwise, uses triangles.
includeNormalsTruthFalse
includeTextureCoordsTruthFalse
vertexModeTruthFalseIf true, consider each vertex in the data array as center of each pixel, we need to create new vertices based on the center.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Files
Package
Procedural Generation

Load Heightmap

Function

A heightmap from a file, in metres: a GeoTIFF elevation raster with its cell size, a 16-bit or 8-bit image, or a raw 16-bit grid (.r16, .raw) as engines write them.

Signature
LoadHeightmap -> Scalar Field
    path: Text
    cellSizeMetres: Number
    lowestMetres: Number
    highestMetres: Number
ScalarField2D LoadHeightmap(
    string path,
    double cellSizeMetres = 0,
    double lowestMetres = 0,
    double highestMetres = 0)

Parameters

nametypedefaultdescription
pathText—The file.
cellSizeMetresNumber0Ground metres one cell covers. A GeoTIFF says this itself and 0 takes its word; an image or raw grid needs it, and is laid at a metre a cell when it is 0.
lowestMetresNumber0For an image or raw grid, the elevation its darkest value stands for. A TIFF's values are already metres.
highestMetresNumber0For an image or raw grid, the elevation its brightest value stands for; no higher than the lowest leaves its values 0..1.

Returns

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

Save As Obj Mesh

Function

Save the terrrain into .obj 3D grid mesh format.

Signature
SaveAsObjMesh
    terrain: Scalar Field
    outputPath: Text
    optimized: Truth
void SaveAsObjMesh(
    ScalarField2D terrain,
    string outputPath,
    bool optimized = false)

Parameters

nametypedefaultdescription
terrainScalar Field—
outputPathText—
optimizedTruthFalse
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Heightmap Files
Package
Procedural Generation

Save Heightmap

Function

Saves a heightmap. A .tif keeps its metres and its cell size, readable by GDAL, QGIS, World Machine and Gaea: with a precision, as 16-bit steps of that size, half the size of 32-bit floats; with none, as 32-bit floats. A .png is a 16-bit grey image and a .r16 a raw 16-bit grid, as game engines import terrain, each stretched over the heightmap's own range, which the node's result reports.

Signature
SaveHeightmap -> Text
    heightmap: Scalar Field
    path: Text
    precisionMetres: Number
string SaveHeightmap(
    ScalarField2D heightmap,
    string path,
    double precisionMetres = 0.01)

Parameters

nametypedefaultdescription
heightmapScalar Field—Heights in metres.
pathText—Where to save it: .tif, .png or .r16.
precisionMetresNumber0.01For a .tif, the step heights are stored to, metres: 0.01 keeps them to a centimetre. 0 stores 32-bit floats.

Returns

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

Set Cell Size

Function

The same heights laid over more or less ground: a generated heightmap, which knows nothing of metres, given the size it is meant to be. A 1024-cell terrain at 2 metres a cell is two kilometres across; every texturing, erosion and water node reads this.

Signature
SetCellSize -> Scalar Field
    heightmap: Scalar Field
    cellSizeMetres: Number
ScalarField2D SetCellSize(
    ScalarField2D heightmap,
    double cellSizeMetres = 2)

Parameters

nametypedefaultdescription
heightmapScalar Field—Heights in metres.
cellSizeMetresNumber2Ground metres one cell covers.

Returns

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