How b3dm Wraps glTF for Geospatial Mapping

Batched 3D Models (.b3dm) wrap standard glTF (GL Transmission Format) containers to adapt high-performance 3D graphics for large-scale geospatial visualization. Defined as part of the OGC 3D Tiles 1.0 specification, the b3dm format combines raw 3D mesh data with geospatial coordinates and per-feature metadata. By injecting custom binary headers and structured metadata tables directly in front of a standard glTF payload, b3dm enables web clients to render thousands of distinct geographic structures in a single draw call while retaining the ability to pick, query, and style each object individually.

The Binary Structure of a b3dm Tile

A .b3dm file is a single binary payload organized into four sequential parts:

  1. Header: A 28-byte header that identifies the file using the magic string b3dm, specifies the version number, tracks the total byte length, and defines the byte offsets for the subsequent tables.
  2. Feature Table: A structured section (JSON and binary) describing the spatial layout of the models, such as global geographic positioning (RTC_CENTER or coordinate reference origins) and the total number of distinct features (BATCH_LENGTH) included in the tile.
  3. Batch Table: A metadata repository (JSON and binary) containing attribute data for each feature, such as building heights, addresses, parcel identifiers, or construction years.
  4. Binary glTF Payload: A complete, embedded glTF 2.0 binary asset (.glb) containing the geometry, materials, textures, and scene hierarchy.

Linking glTF Geometry to Geospatial Metadata

The core challenge b3dm solves is linking individual visual components inside an aggregated 3D mesh to corresponding geographic records without fragmenting the model into multiple network requests or graphics draw calls.

It achieves this through a custom glTF vertex attribute:

  • The _BATCHID Attribute: Within the embedded glTF asset, every vertex includes a custom attribute named _BATCHID. This attribute acts as a foreign key that references an index in the b3dm Batch Table.
  • Component Indexing: If an entire city block consisting of 500 distinct buildings is combined into a single glTF primitive, every vertex belonging to building zero has a _BATCHID of 0, building one has a _BATCHID of 1, and so on up to 499.
  • Metadata Resolution: When a rendering engine parses the tile, it matches _BATCHID values with row entries in the b3dm Batch Table. This gives the application access to specific attributes for every vertex in the mesh.

Runtime Execution in Web Engines

When a mapping client such as CesiumJS loads a b3dm file, it reads the header, extracts the feature and batch tables, and passes the glTF payload to the WebGL/WebGPU graphics pipeline.

  • Single Draw Call Performance: The client renders the embedded glTF as an aggregated mesh. Rather than issuing individual draw calls for every building, tree, or structural component, the entire tile is drawn at once, minimizing CPU overhead and GPU state changes.
  • Interactive Picking: When a user clicks on the 3D map, the engine reads the pixel's _BATCHID from an off-screen render buffer or raycasts against the geometry. The engine instantly queries the Batch Table using that ID to populate UI panels with feature-specific data.
  • Dynamic Styling: Shader pipelines use the _BATCHID to look up visual styling rules on the GPU. Properties such as color, transparency, and visibility can be altered dynamically based on metadata values (for example, coloring buildings by their construction year or height) without modifying the underlying glTF geometry.

Evolution Toward 3D Tiles 1.1

While b3dm was fundamental to the adoption of 3D Tiles 1.0, the geospatial community has steadily evolved its approach. In 3D Tiles 1.1, the wrapping container is deprecated in favor of direct glTF integration using official Khronos extensions—specifically EXT_mesh_features and EXT_structural_metadata. However, b3dm remains widely deployed in legacy and modern production pipelines alike as the architecture that first bridged web-native 3D geometry with spatial database integration.