Skip to main content

Texture API / Crunch loader

Keep an existing compressed texture pipeline moving.

CrunchLoader reads CRN assets and returns mip levels with compressed texture metadata. It is a compatibility path for older BC/DXT-oriented content; new cross-device pipelines generally prefer Basis Universal in KTX2.

Compatibility loader

Decode the legacy container, keep the GPU decision explicit.

The loader preserves compressed levels and their format metadata. The consuming runtime decides whether those blocks can be uploaded directly or need a migration/transcode path.

Input

Crunch `.crn` compressed texture files.

Decode

Read compressed mip levels through the worker path.

Describe

Expose dimensions, level shapes, and texture formats.

Migrate

Use KTX2/Basis for new portable asset pipelines.

Detailed guide

CrunchLoader reference

The detailed reference covers CRN input, worker loading, mip-level output, format metadata, and compatibility considerations.

From-v3.0

Loader for compressed textures in the Crunch file format

CrunchLoader
File FormatCRN
File Extension.crn
File TypeBinary
Data FormatTextureLevel[]
Supported APIsload, parse

Usage​

import {CrunchLoader} from '@loaders.gl/images/crunch';
import {load} from '@loaders.gl/core';

const mipLevels = await load(url, CrunchLoader);
for (const level of mipLevels) {
console.log(level.shape, level.format, level.textureFormat);
}

Data Format​

Returns TextureLevel[], one entry per mip level.

Each level includes:

  • shape: 'texture-level' From-v4.4
  • compressed
  • format From-v4.4
  • textureFormat From-v4.4
  • width
  • height
  • data
  • levelSize when available

Options​

OptionTypeDefaultDescription
N/A

Module Overrides​

Use options.modules to override the Crunch runtime used by CrunchLoader.

  • modules.crunch: supply a preloaded Crunch decoder factory.
  • 'crunch.js': override the URL used for the Crunch decoder script.