Expand description
Unity terrains as stored: TerrainData (the heightmap, holes, splat layers and their alphamaps, tree prototypes
and instances) and TerrainLayer.
The heightmap is resolution x resolution samples, row z then column x, each 0..=32766 for 0..1 of the
terrain’s height (scale.y metres; TerrainData.GetHeight is h / 32766 * size.y); samples are scale.x and
scale.z metres apart from the terrain’s position, so the terrain is (resolution - 1) * scale wide. Holes are
one byte per cell, 0 a hole (none stored: no holes). Alphamaps hold four layer weights per texel (RGBA), texel
row 0 at z = 0 as Unity stores rows.
Structs§
- Terrain
Data - A
TerrainDataas stored. - Terrain
Layer Data - A
TerrainLayeras stored. - Tree
Instance - A tree placed on a terrain: position as 0..1 of the terrain’s size, scales, rotation about y (radians), colour, and its prototype’s index.
Enums§
- Heightmap
Error - Why
check_heightmaprefuses a heightmap.
Constants§
- MAX_
HEIGHT - The highest stored height sample: 0..=32766 is 0..1 of the terrain’s height (
TerrainData.GetHeight).
Functions§
- check_
heightmap - What a heightmap must be to be read:
resolutionxresolutionsamples (at least 2 x 2: one cell), each 0..=MAX_HEIGHT, and, where it has holes, one per cell ((resolution - 1)^2).