Skip to main content



The module contains loaders for compressed textures. More specifically it contains loaders and writers for compressed texture container formats, including KTX, DDS and PVR. It also supports supercompressed Basis textures.

Note that a texture is more complex than an image. A texture typically has many subimages. A texture can represent a single logical image but can also be a texture cube, a texture array etc representing many logical images. In addition, each "image" typically has many mipmap levels.

In addition, in compressed textures each mipmap image is compressed opaquely into a format that can only be understood by certain GPUs.

Basis encoded textures are super compressed. A more recent addition, they can be efficiently transcoded on the client into actual compressed texture formats appropriate for each device and are therefore quite convenient to use.


npm install
npm install



Return Types

The BasisLoader returns Array of Array of ArrayBuffer

See BasisLoader for more details on options etc.

Texture APIs

The textures API offers functions to load "composite" images for WebGL textures, cube textures and image mip levels.

These functions take a getUrl parameter that enables the app to supply the url for each "sub-image", and return a single promise enabling applications to for instance load all the faces of a cube texture, with one image for each mip level for each face in a single async operation.

loadImageLoad a single image
loadImageArrayLoad an array of images, e.g. for a Texture2DArray or Texture3D
loadImageCubeLoad a map of 6 images for the faces of a cube map, or a map of 6 arrays of images for the mip levels of the 6 faces.

As with all functions, while these functions are intended for use in WebGL applications, they do not call any WebGL functions, and do not actually create any WebGL textures..


  • The CompressedTextureLoader was forked from PicoGL, Copyright (c) 2017 Tarek Sherif, The MIT License (MIT)
  • The CompressedTextureWriter is a wrapper around @TimvanScherpenzeel's texture-compressor utility (MIT licensed).