class

FTerrainIO

Module
Game
Header
#include "Terrain/TerrainIO.h"
Namespace
Mowo

Public functions

ReturnsNameDescription
boolImportHeights
boolImportHeightsFromMemory
boolImportHeightTileCuts tile (tileX, tileZ) out of an already-decoded source.
FTerrainTileLayoutSuggestTileLayoutLargest square tiling of sourceSamples whose tiles stay at or under maxTileSamples and still line up on the one-texel overlap.
voidSolveTileChunksChunk grid for one tile: the coarsest split whose chunk resolution stays inside the component's 4-128 range and still divides the tile's span exactly.
voidTileCenterTerrain-local centre of tile (tileX, tileZ) for a grid laid out around the origin.
boolExportHeightsRaw16Headerless little-endian 16-bit — the .r16 World Machine, Gaea and UE landscape all speak.
boolExportHeightsPng16
boolEncodeHeightsPng1616-bit grayscale PNG bytes.
boolEncodeGrayPng8
boolExportWeightmapLayerPngOne layer of a 4- or 8-layer weightmap as 8-bit grayscale (mapB null selects the 4-layer form) — UE5's per-layer weightmap export shape.
boolImportWeightmapLayerReads a grayscale image into one layer channel and rescales the other channels to fill what is left, so the texel still sums to 255.
boolWriteFile

Function details

ImportHeights

C++
static bool ImportHeights(const std::string& path, float heightScale, FEditableHeightfield& out)

ImportHeightsFromMemory

C++
static bool ImportHeightsFromMemory(const void* data, size_t size, bool raw16, float heightScale, FEditableHeightfield& out)

ImportHeightTile

C++
static bool ImportHeightTile(const FDecodedHeightfield& source, const FTerrainTileLayout& layout, uint32_t tileX, uint32_t tileZ, float heightScale, FEditableHeightfield& out)

Cuts tile (tileX, tileZ) out of an already-decoded source. Returns false when the tile falls outside the layout or the source is too small.

SuggestTileLayout

C++
static FTerrainTileLayout SuggestTileLayout(uint32_t sourceSamples, uint32_t maxTileSamples)

Largest square tiling of sourceSamples whose tiles stay at or under maxTileSamples and still line up on the one-texel overlap.

SolveTileChunks

C++
static void SolveTileChunks(uint32_t tileSamples, int32_t& outChunksPerSide, int32_t& outChunkResolution)

Chunk grid for one tile: the coarsest split whose chunk resolution stays inside the component's 4-128 range and still divides the tile's span exactly. An inexact split leaves the last chunk row short, which shows up as a crack along every tile's far edge.

TileCenter

C++
static void TileCenter(const FTerrainTileLayout& layout, uint32_t tileX, uint32_t tileZ, float tileWorldSize, float& outX, float& outZ)

Terrain-local centre of tile (tileX, tileZ) for a grid laid out around the origin. Tiles share an edge texel, so their centres sit exactly tileWorldSize apart — anything else double-counts the overlap and leaves a seam the stitcher cannot close.

ExportHeightsRaw16

C++
static bool ExportHeightsRaw16(const FEditableHeightfield& field, const std::string& absPath, float heightScale)

Headerless little-endian 16-bit — the .r16 World Machine, Gaea and UE landscape all speak. Square-only, like the decoder that reads it back.

ExportHeightsPng16

C++
static bool ExportHeightsPng16(const FEditableHeightfield& field, const std::string& absPath, float heightScale)

EncodeHeightsPng16

C++
static bool EncodeHeightsPng16(const FEditableHeightfield& field, float heightScale, std::vector<uint8_t>& out)

16-bit grayscale PNG bytes. The deflate stream uses stored blocks: the engine links no zlib, and an export that any tool can open matters more than the file being small.

EncodeGrayPng8

C++
static bool EncodeGrayPng8(const uint8_t* gray, uint32_t width, uint32_t height, std::vector<uint8_t>& out)

ExportWeightmapLayerPng

C++
static bool ExportWeightmapLayerPng(const uint8_t* mapA, const uint8_t* mapB, uint32_t width, uint32_t height, int32_t layer, const std::string& absPath)

One layer of a 4- or 8-layer weightmap as 8-bit grayscale (mapB null selects the 4-layer form) — UE5's per-layer weightmap export shape.

ImportWeightmapLayer

C++
static bool ImportWeightmapLayer(const void* data, size_t size, uint8_t* mapA, uint8_t* mapB, uint32_t width, uint32_t height, int32_t layer)

Reads a grayscale image into one layer channel and rescales the other channels to fill what is left, so the texel still sums to 255.

WriteFile

C++
static bool WriteFile(const std::string& absPath, const void* data, size_t size)
Generated from Terrain/TerrainIO.h via game.json · Nov 5, 2026Version 1.0.0