Function: generateTerrainPalette()
function generateTerrainPalette(
levelCount,
radius?,
coreRadiusRatio?,
lowColor?,
highColor?,
atmosphereThickness?): TerrainLevel[];Generate a rocky terrain palette as a linear gradient from lowColor at the shortest band (i = 0, prism collapsed) to highColor at the tallest band (i = N - 1, silhouette at radius). Caller-side classifications (biomes, climate zones…) are handled by a later pass; this palette is intentionally monochromatic so the hex mesh communicates altitude alone.
Emits exactly levelCount bands. Band i caps at world height i * unit above the core, so the staircase is strictly uniform: height[0] = 0 (collapsed to the core), height[N - 1] = shell (at radius), and every adjacent pair is separated by exactly unit. Thresholds are band indices ([1, 2, ..., N-1, Infinity]), so getTileLevel(elevation, palette) with integer elevation ∈ [0, N-1] returns palette[elevation] exactly.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
levelCount | number | undefined | Desired total level count (≥ MIN_TERRAIN_LEVEL_COUNT). Typically resolved via resolveTerrainLevelCount so each band stays proportionate to the tile size. |
radius | number | 1 | Planet visual radius — combined with coreRadiusRatio to derive the world-space step unit = shell / (N - 1). |
coreRadiusRatio | number | 0 | Fraction of radius occupied by the inner core. |
lowColor | ColorRepresentation | DEFAULT_TERRAIN_LOW_COLOR | Low anchor (band 0). Defaults to DEFAULT_TERRAIN_LOW_COLOR. |
highColor | ColorRepresentation | DEFAULT_TERRAIN_HIGH_COLOR | High anchor (band N - 1). Defaults to DEFAULT_TERRAIN_HIGH_COLOR. |
atmosphereThickness | number | 0 | - |