Table of Contents

Class TerrainBlendMapGenerator

Namespace
Map.Rendering.Terrain
Assembly
MapAssembly.dll

ENGINE: Generates terrain blend maps for Imperator Rome-style 4-channel blending Pre-computes DetailIndexTexture + DetailMaskTexture at load time (~50-100ms)

Algorithm:

  • Sample ProvinceIDTexture in 5x5 radius per pixel
  • Count terrain types via ProvinceTerrainBuffer lookup
  • Take top 4 terrain types by frequency
  • Normalize to weights (0-1 range)
  • Write indices to DetailIndexTexture, weights to DetailMaskTexture

Output:

  • DetailIndexTexture (RGBA8): 4 material indices per pixel
  • DetailMaskTexture (RGBA8): 4 blend weights per pixel

Usage: MapDataLoader calls Generate() after province terrain analysis complete

public class TerrainBlendMapGenerator : MonoBehaviour
Inheritance
object
TerrainBlendMapGenerator

Methods

Generate(RenderTexture, ComputeBuffer, int, int)

Generate terrain blend maps (DetailIndexTexture + DetailMaskTexture) Call this after ProvinceTerrainAnalyzer completes

public (RenderTexture detailIndex, RenderTexture detailMask) Generate(RenderTexture provinceIDTexture, ComputeBuffer provinceTerrainBuffer, int width, int height)

Parameters

provinceIDTexture RenderTexture

Province ID texture (5632x2048 RG16)

provinceTerrainBuffer ComputeBuffer

Province terrain buffer (65536 entries, uint per province)

width int

Map width (5632)

height int

Map height (2048)

Returns

(RenderTexture detailIndex, RenderTexture detailMask)

Tuple of (DetailIndexTexture, DetailMaskTexture)

GetActiveTerrainRenderer(string)

Get the active terrain renderer from registry.

public ITerrainRenderer GetActiveTerrainRenderer(string rendererId = null)

Parameters

rendererId string

Returns

ITerrainRenderer

Initialize(MapTextureManager)

Initialize and register default terrain renderer with MapRendererRegistry. Call this during map initialization.

public void Initialize(MapTextureManager textureManager)

Parameters

textureManager MapTextureManager

InitializeKernels()

Initialize compute shader kernels. Called by ArchonEngine.

public void InitializeKernels()