How KHR_texture_basisu Works in glTF

The KHR_texture_basisu extension enables glTF 2.0 assets to utilize Basis Universal compressed textures stored in KTX v2 (.ktx2) containers. By replacing standard PNG and JPEG formats, this extension dramatically reduces both download sizes over the network and VRAM consumption on target hardware. It achieves this by packaging textures into intermediate, universal formats that the client engine transcodes at runtime directly into the native compression formats supported by the host GPU.

The Problem with Traditional glTF Textures

Standard glTF 2.0 relies primarily on PNG and JPEG files. While these formats provide reasonable compression for file transfers over the web, GPUs cannot render them directly. The device must decompress a PNG or JPEG entirely into raw RGBA data in system memory before uploading it to the GPU. A standard 2048x2048 PNG image might only take a few megabytes on disk, but it expands to roughly 16 megabytes of uncompressed VRAM. In complex 3D scenes with multiple PBR material textures, this quickly leads to high memory overhead, frame drops, and mobile browser crashes.

The Basis Universal Solution

Basis Universal, developed by Binomial, solves this problem by using an intermediate texture representation that can be quickly transcoded into native GPU compression formats—such as BC1–BC7 on desktop, ASTC on modern mobile devices, and ETC2 on Android—without decompressing to raw RGBA.

Basis Universal supports two modes:

  • ETC1S: Offers extremely high compression ratios, making it ideal for base color maps, diffuse textures, and bandwidth-constrained web applications.
  • UASTC: Focuses on high visual fidelity, making it suitable for normal maps, metallic-roughness maps, and high-frequency details where compression artifacts must be minimized.

glTF Integration Mechanism

The KHR_texture_basisu extension integrates this technology into the glTF document structure by extending the standard textures array.

  1. The Extension Declaration: The glTF root declares the extension in the extensionsUsed array. If the model strictly relies on these textures to render, it is also added to extensionsRequired.
  2. KTX2 Image Reference: The .ktx2 file containing the Basis Universal data is listed in the top-level images array, referenced either by a URI or as a bufferView.
  3. Texture Object Mapping: In the standard glTF textures object, the extensions dictionary specifies KHR_texture_basisu, which points directly to the index of the KTX2 image via a local source property.
{
  "extensionsUsed": [
    "KHR_texture_basisu"
  ],
  "images": [
    {
      "uri": "texture_compressed.ktx2"
    },
    {
      "uri": "fallback.png"
    }
  ],
  "textures": [
    {
      "source": 1,
      "extensions": {
        "KHR_texture_basisu": {
          "source": 0
        }
      }
    }
  ]
}

Runtime Transcoding and Fallbacks

When a 3D engine loads a glTF file using KHR_texture_basisu, the runtime engine reads the KTX2 container and queries the local graphics API (WebGL, WebGPU, Vulkan, Metal, or DirectX) for available texture formats. A small WebAssembly (Wasm) or native transcoder converts the ETC1S or UASTC data directly into the best available hardware-supported format.

If the extension is declared in extensionsUsed rather than extensionsRequired, engines that do not support the extension can ignore the KHR_texture_basisu block and fall back to the standard source property pointing to a regular PNG or JPEG image. This ensures backward compatibility while providing optimized performance for modern runtimes.