.TMM in IGI 2 -- Terrain Material Physics Tables

1. Architectural Role & Engine Purpose

The TMM (Terrain Multi-Texture Material Splatting Table) format controls procedural multi-texture blending and surface layer transitions (rock cliff faces, lush grass, packed dirt roads, snow) in I.G.I. 2: Covert Strike.

TMM files define alpha blend weight distributions across 4 simultaneous material layers, enabling organic photorealistic outdoor ground blending without harsh texture seams.

2. Binary File Layout & Memory Map Diagram

A TMM file contains layer count headers, material definitions, and alpha weight splat distributions:

IGI 2 TMM — MULTI-TEXTURE MATERIAL SPLATTING LAYOUT 0x00: Material Table Header (16 Bytes) 16 BYTES Magic "TMM " | Version | Layer Count (typically 4) | Alpha Splat Resolution (e.g. 512) magic[4], version, layer_count, splat_res Material Layer Descriptors (32 Bytes per Layer) 4 LAYERS Diffuse Texture ID (.TEX) | Detail Micro-Texture ID | UV Tiling Scale (float[2]) | Slope Min/Max | Elevation Min/Max Layer 0: Lush Grass | Layer 1: Steep Rock Face | Layer 2: Packed Dirt Road | Layer 3: Snow/Mud 4-Channel Alpha Blend Weight Splat Map WEIGHT MAP SplatRes * SplatRes * 4 Bytes: RGBA alpha blend weights governing seamless procedural ground transitions Seamless organic ground blending without tiling repetition artifacts

3. Multi-Pass Terrain Splatting Pipeline Diagram

The terrain engine executes multi-pass texture splatting using hardware alpha blending:

IGI 2 TMM — 4-PASS TERRAIN SPLATTING PIPELINE 1. PASS 1: GRASS • Base Green Plane • Flat Terrain Valleys • Diffuse Texture Layer 0 2. PASS 2: ROCK • Splat on Steep Slopes • Normal Y Angle Threshold • Alpha Weight Splatting 3. PASS 3: ROAD • Dirt Road Waypoints • Alpha Blended Track • Smooth Edge Transition 4. DETAIL NOISE • High-Frequency Gravel • Up-Close Surface Depth • Direct3D 8 Shader

4. C++ Struct Definitions

#pragma pack(push, 1)
struct TmmHeader {
    char     magic[4];       // "TMM "
    uint32_t version;        // 2
    uint32_t layer_count;    // Number of material layers (typically 4)
    uint32_t splat_res;      // Splat resolution (e.g. 512)
};

struct TmmLayerDesc {
    uint32_t tex_id;         // Diffuse texture index
    uint32_t detail_tex_id;  // High-frequency detail texture
    float    uv_scale[2];    // World mapping frequency
    float    min_slope;      // Minimum slope angle
    float    max_slope;      // Maximum slope angle
    float    min_elevation;  // Altitude range minimum
    float    max_elevation;  // Altitude range maximum
};
static_assert(sizeof(TmmHeader) == 16, "TmmHeader must be 16 bytes");
#pragma pack(pop)