loaders.gl support
| Type | API |
|---|---|
| Loader | BasisLoader |
| Writer | KTX2BasisWriter |
Portable texture delivery
Package once. Choose the GPU target at runtime.
Containers preserve dimensions and mip levels; portable payloads delay the final format choice until the application knows what the current device supports.
Distributed asset
Runtime choice
metadata · levels · capabilities
Renderer receives
The application keeps one asset pipeline while the renderer receives the representation its WebGL or WebGPU device can use efficiently.
The delivery tradeoff
Separate distribution format from device format.
A Basis payload is optimized for transport. At load time, the transcoder selects a compressed or fallback representation that the current rendering device can use.
Input
Raw .basis files or Basis payloads in .ktx2
Runtime choice
Target selected from device texture capabilities
Preserves
Images, mip levels, dimensions, and texture metadata
Output
TextureLevel data ready for the rendering layer
@loaders.gl/images- loaders.gl implementationBasisLoader- decodes Basis Universal textures
Basis Universal is a supercompressed texture format designed to be transcoded efficiently into GPU-native compressed texture formats at load time.
Detailed guide
Basis format and transcoding details
The sections below document containers, runtime selection, returned levels, and loaders.gl compatibility.
Rather than shipping one texture asset per target GPU family, applications can distribute Basis-compressed data and transcode it on the client into a supported runtime format.
Why It Is Used
Basis Universal is useful when an application needs:
- smaller portable texture distribution assets
- one source asset for multiple GPU format families
- runtime selection of the best supported target texture format
Basis data may appear as:
- raw
.basisfiles - Basis payloads stored inside
.ktx2containers
loaders.gl Support
| Format Feature | loaders.gl Support | Notes |
|---|---|---|
Raw .basis input | ✅ Yes | Supported by BasisLoader. |
| Basis payloads in KTX2 | ✅ Yes | Supported by BasisLoader. |
| Runtime transcoding | ✅ Yes | Transcodes into compressed or fallback uncompressed target formats. |
| Automatic format selection | ✅ Yes | basis.format: 'auto' and basis.supportedTextureFormats help select a target format. |
| Preservation of multiple images / mip levels | ✅ Yes | Returned as TextureLevel[][]. |