.BIT -- Terrain 1-Bit Collision Masks

1. Architectural Role & Engine Purpose

The BIT (Billboard Impostor Table) format manages distance-based billboard transitions and 2D sprite impostors for dense forests, utility poles, distant guard towers, and distant foliage in Project I.G.I. 1.

To maintain 60 FPS across kilometers of outdoor landscape, the engine transitions high-polygon 3D meshes into single-quad billboard impostors at distances greater than 150 meters. Impostor records are stored as compact 12-byte structs (bit_item_s).

2. Binary File Layout & Memory Map Diagram

A BIT registry file contains a descriptor header followed by an array of 12-byte billboard definitions:

BIT BILLBOARDS — 12-BYTE DISTANCE IMPOSTOR LAYOUT 0x00: Billboard Header (16 Bytes) 16 BYTES Magic "BIT " | Version | Impostor Count | Switch Distance Threshold (e.g. 150.0 meters) magic[4], version, count, switch_dist Impostor Descriptor Array: 12 Bytes per Impostor (bit_item_s) 12B IMPOSTOR Sprite ID (uint32 index into .SPR asset) | World Width (float meters) | World Height (float meters) struct bit_item_s { uint32_t sprite_id; float world_width, world_height; } Cylindrical View-Orientation Matrices CYLINDRICAL Trees rotate strictly around vertical Y-axis to stay firmly planted on terrain slopes Reduces 800-poly pine trees to single 2-triangle quads at distance

3. LOD Transition & Spherical Billboard Pipeline Diagram

During the rendering pass, the LOD coordinator determines whether to submit full 3D geometry or a 2D impostor:

BIT IMPOSTORS — DISTANCE LOD TRANSITION PIPELINE 1. DISTANCE TEST • Dist = |Tree - Camera| • Check Switch Threshold • Threshold = 150 meters 2. LOD SELECTION • Near: 3D Mesh (.MEF) • Far: 2D Impostor (.BIT) • Switch to 12B Record 3. Y-AXIS BILLBOARD • Cylindrical Alignment • Face Camera Eye Angle • Generate Quad Vertices 4. ALPHA TEST DRAW • D3D Alpha Test Blit • Zero Sorting Needed • 99.7% Poly Reduction

4. Architectural Mechanics & Engine Implementation Details

The BIT impostor system enabled IGI 1's signature outdoor vistas:

  • Cylindrical vs Spherical: Trees rotate strictly around the vertical Y-axis (cylindrical billboarding) to stay anchored firmly in the ground, while clouds and debris particles rotate around all three axes (spherical billboarding).
  • Massive Triangle Reductions: A 3D pine tree model consisting of 800 triangles is reduced to a single 2-triangle quad when viewed from distance, decreasing GPU triangle load by 99.7%.

5. C++ Struct Definitions

#pragma pack(push, 1)
struct BitHeader {
    char     magic[4];       // "BIT "
    uint32_t version;        // Format version
    uint32_t count;          // Total registered impostors
    float    switch_dist;    // Distance threshold for transition (meters)
};

// IGI 1 12-Byte Billboard Descriptor
struct bit_item_s {
    uint32_t sprite_id;      // Index of 2D sprite in resource system
    float    world_width;    // Physical width in world meters
    float    world_height;   // Physical height in world meters
};
static_assert(sizeof(bit_item_s) == 12, "bit_item_s must be 12 bytes");
#pragma pack(pop)