BabylonJS/Babylon.js · error

${extensionContext}: Texture type not supported

Error message

${extensionContext}: Texture type not supported

What it means

KHR_texture_transform adjusts uScale/vScale/uOffset/vOffset, which only exist on Babylon's Texture (2D) class, not on e.g. loadable cubemaps or other BaseTexture subclasses. After the base loader creates the texture, the extension checks the concrete type and throws if it isn't a Texture, because transform values could not be applied.

Source

Thrown at packages/dev/loaders/src/glTF/2.0/Extensions/KHR_texture_transform.pure.ts:51

    constructor(loader: GLTFLoader) {
        this._loader = loader;
        this.enabled = this._loader.isExtensionUsed(NAME);
    }

    /** @internal */
    public dispose() {
        (this._loader as any) = null;
    }

    /**
     * @internal
     */
    // eslint-disable-next-line no-restricted-syntax
    public loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {
        return GLTFLoader.LoadExtensionAsync<IKHRTextureTransform, BaseTexture>(context, textureInfo, this.name, async (extensionContext, extension) => {
            return await this._loader.loadTextureInfoAsync(context, textureInfo, (babylonTexture) => {
                if (!(babylonTexture instanceof Texture)) {
                    throw new Error(`${extensionContext}: Texture type not supported`);
                }

                if (extension.offset) {
                    babylonTexture.uOffset = extension.offset[0];
                    babylonTexture.vOffset = extension.offset[1];
                }

                // Always rotate around the origin.
                babylonTexture.uRotationCenter = 0;
                babylonTexture.vRotationCenter = 0;

                if (extension.rotation) {
                    babylonTexture.wAng = -extension.rotation;
                }

                if (extension.scale) {
                    babylonTexture.uScale = extension.scale[0];
                    babylonTexture.vScale = extension.scale[1];

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Ensure the referenced texture is a standard 2D image texture (PNG/JPEG uri) that the loader creates as Texture.
  2. Remove KHR_texture_transform from texture extensions that resolve to non-2D textures.
  3. Provide a custom extension handler that applies the transform to your custom texture type.

Example fix

// before: cubemap texture used with textureTransform
"extensions": { "KHR_texture_transform": { "offset": [0.5, 0] } }
// after: move the transform to a standard baseColorTexture
Defensive patterns

Strategy: type-guard

Validate before calling

// in a custom extension wrapper
if (!(babylonTexture instanceof Texture)) {
  throw new Error('KHR_texture_transform requires a 2D Texture');
}

Type guard

function isTransformableTexture(t: BaseTexture): t is Texture {
  return t instanceof Texture;
}

Try / catch

try { await loader.loadAsync(url); } catch (e) {
  if (e.message.includes('Texture type not supported')) {
    // reload with texture transform extension disabled or swap the texture
  } else throw e;
}

Prevention

When it happens

Trigger: Loading a glTF texture that references KHR_texture_transform but resolves to a non-Texture BaseTexture (e.g. a texture loaded by another extension/custom loader returning a different texture type).

Common situations: Custom texture loaders plugged into GLTFLoader returning cube/raw textures; KHR_texture_basisu or external loader paths producing a texture type the transform extension cannot mutate.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/3a4a89cd4a77dd88. Report an issue: GitHub.