Why Basis Universal Transcodes at Runtime in glTF
Basis Universal textures are transcoded at runtime within glTF engines to solve the fundamental incompatibility between lightweight file transmission and GPU hardware architecture. By serving as an intermediate universal texture format, Basis Universal allows a single 3D asset to be downloaded at a minimal file size and then instantly converted into whichever platform-specific, block-compressed texture format the host GPU requires. This runtime step ensures optimal rendering performance and reduced VRAM consumption across disparate mobile, desktop, and console hardware without requiring developers to author and distribute multiple platform-specific asset packages.
The Problem: GPU Format Fragmentation
Graphics processors do not natively read standard web image formats like PNG or JPEG during real-time rendering. Instead, they require specialized, hardware-level block-compressed formats that can remain compressed in video memory (VRAM) and decompress random texels on the fly.
The primary challenge is that hardware-native texture formats are heavily fragmented across platforms:
- Desktop (DirectX, Windows, macOS): BC1 through BC7 (Block Compression).
- Modern Mobile (Android, iOS): ASTC (Adaptive Scalable Texture Compression).
- Legacy Mobile (Android): ETC2 / ETC1 (Ericsson Texture Compression).
- Legacy Apple Devices: PVRTC (PowerVR Texture Compression).
Before universal formats, delivering optimal glTF assets meant either distributing massive uncompressed images, shipping distinct glTF files for every target hardware architecture, or relying on server-side format negotiation.
The Role of Basis Universal (ETC1S and UASTC)
Basis Universal, integrated into glTF via the
KHR_texture_basisu extension, introduces an intermediate
representation designed explicitly for distribution. It supports two
main compression modes:
- ETC1S: Highly compact, lower-fidelity compression ideal for UI, non-critical assets, and bandwidth-constrained web applications.
- UASTC: High-quality texture compression tailored for normal maps, PBR materials, and high-fidelity rendering, providing visual parity with BC7 or ASTC.
Neither of these formats is executed directly by the GPU. Instead, they are designed with mathematical properties that make them trivial to convert into any native block-compressed format.
Why Engines Transcode at Runtime
1. Minimal VRAM Footprint
If an engine decodes a standard PNG or JPEG, the image expands into uncompressed 32-bit RGBA data inside GPU memory. A 2048x2048 texture consumes roughly 16 MB of VRAM.
When a glTF engine transcodes Basis Universal directly into a native format like BC7 or ASTC, the texture remains compressed in VRAM, consuming only 2 MB to 4 MB (a 75% to 87.5% reduction). This lowers memory pressure, reduces memory bandwidth bottlenecks, and prevents out-of-memory crashes on mobile devices.
2. High-Speed, Lightweight Processing
Traditional texture encoding can take seconds or even minutes per texture. In contrast, the Basis Universal transcoder is not a full encoder; it merely unpacks and repackages data into the target hardware format.
Implemented typically in WebAssembly, C++, or Rust, the transcoder operates at rates of dozens to hundreds of megabytes per second. This makes the runtime conversion practically imperceptible to the user during asset loading.
3. "Write Once, Run Anywhere" Portability
The core philosophy of the glTF format is to be the "JPEG of 3D."
Relying on runtime transcoding allows a single .gltf or
.glb file to be completely platform-agnostic.
At startup, the rendering engine inspects the host system’s graphics capabilities via WebGL, WebGPU, Vulkan, Metal, or DirectX. Once the supported hardware formats are detected, the engine instructs the transcoder to target the best available format (for instance, choosing ASTC on a modern smartphone and falling back to BC3/BC7 on a desktop PC).
Summary
glTF engines transcode Basis Universal at runtime because it decouples storage and transmission efficiency from hardware execution requirements. It allows developers to ship a single, highly compressed file that yields optimal rendering speeds and low VRAM usage across any client device.