Draco glTF Decoding Time vs Triangle Density

Draco compression significantly reduces the file size of glTF 3D models, but requires client-side decompression before rendering. The decoding time of Draco-compressed meshes scales primarily linearly with triangle density and mesh complexity, governed by the \(O(V + F)\) algorithmic complexity of its connectivity and attribute decoders. However, real-world execution often reveals non-linear bottlenecks at extremely high densities due to memory allocation overhead, single-threaded CPU limits, and WebAssembly execution constraints.

Algorithmic Complexity of Draco Decompression

At its core, Draco relies on the Edgebreaker algorithm for topology (connectivity) decompression and predictive schemes (such as the parallelogram predictor) for geometric attribute decompression.

  • Topology Decoding: Traversing and reconstructing the triangle mesh connectivity scales linearly, \(O(F)\), where \(F\) is the number of faces (triangles).
  • Attribute Decoding: Quantized positions, normals, texture coordinates, and colors scale linearly with the number of unique vertices, \(O(V)\).

Because a standard manifold mesh generally maintains a fixed ratio of roughly two triangles per vertex (Euler-Poincaré characteristic), an increase in triangle density leads to a directly proportional increase in both vertices and faces. Consequently, the theoretical baseline for decoding time scales linearly: doubling the triangle density doubles the core decoding instructions.

Factors That Disrupt Linear Scaling

While the theoretical decoding complexity is linear, hardware and runtime constraints introduce variations in performance as triangle density grows significantly.

1. Attribute Multipliers

Triangle density alone does not dictate the full decompression load. Each additional vertex attribute (e.g., standard positions vs. positions + normals + tangents + UV sets) adds a separate decoding pass. High-density meshes with extensive vertex data multiply the linear slope significantly, making dense surfaces with rich material attributes take substantially longer to decode than purely geometric dense surfaces.

2. Memory Allocation and Heap Growth

In web environments, Draco runs via a WebAssembly (WASM) module. As triangle density escalates into hundreds of thousands or millions of triangles, the WASM memory buffer must expand dynamically if not pre-allocated. Repeated memory allocations and copying decoded TypedArrays across the WebAssembly-to-JavaScript boundary introduce sudden non-linear latency spikes.

3. Topology Regularity and Manifold Structure

Draco encodes connectivity using structured traversal paths. Highly regular, contiguous, and manifold high-density meshes compress and decompress efficiently because the prediction trees remain stable. Conversely, meshes with high triangle density featuring fragmented shells, non-manifold edges, or high valence vertices disrupt predictive paths, leading to increased cache misses and higher per-triangle decoding cycles.

Threading and Main-Thread Blocking

Draco decoding is fundamentally single-threaded per mesh. On client devices:

  • Main-Thread Execution: As triangle density increases, the linear growth in decode time directly correlates to frame drops and interface freezes if executed on the main thread.
  • Web Workers: Offloading decompression to Web Workers parallelizes the task across multiple meshes. However, individual dense meshes still face the single-threaded CPU execution limit, meaning an individual dense model cannot decode across multiple cores.

The Compression-to-Decode Trade-Off

At low-to-medium triangle densities (under 100,000 triangles), Draco decoding is practically instantaneous on modern hardware, often taking less than 15–30 milliseconds. At high triangle densities (exceeding 1,000,000 triangles), decoding time can climb into hundreds of milliseconds or even seconds per asset.

For dense geometries, the bandwidth savings achieved over the network may eventually be offset by client-side decompression time, making alternative transmission formats like uncompressed binary glTF or EXT_meshopt_compression—which prioritizes ultra-fast SIMD decoding over maximum compression ratio—more suitable at extreme densities.