{"record":{"id":"3a4a89cd4a77dd88","repo":"BabylonJS/Babylon.js","slug":"extensioncontext-texture-type-not-supported","errorCode":null,"errorMessage":"${extensionContext}: Texture type not supported","messagePattern":"(.+?): Texture type not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/glTF/2.0/Extensions/KHR_texture_transform.pure.ts","lineNumber":51,"sourceCode":"    constructor(loader: GLTFLoader) {\r\n        this._loader = loader;\r\n        this.enabled = this._loader.isExtensionUsed(NAME);\r\n    }\r\n\r\n    /** @internal */\r\n    public dispose() {\r\n        (this._loader as any) = null;\r\n    }\r\n\r\n    /**\r\n     * @internal\r\n     */\r\n    // eslint-disable-next-line no-restricted-syntax\r\n    public loadTextureInfoAsync(context: string, textureInfo: ITextureInfo, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n        return GLTFLoader.LoadExtensionAsync<IKHRTextureTransform, BaseTexture>(context, textureInfo, this.name, async (extensionContext, extension) => {\r\n            return await this._loader.loadTextureInfoAsync(context, textureInfo, (babylonTexture) => {\r\n                if (!(babylonTexture instanceof Texture)) {\r\n                    throw new Error(`${extensionContext}: Texture type not supported`);\r\n                }\r\n\r\n                if (extension.offset) {\r\n                    babylonTexture.uOffset = extension.offset[0];\r\n                    babylonTexture.vOffset = extension.offset[1];\r\n                }\r\n\r\n                // Always rotate around the origin.\r\n                babylonTexture.uRotationCenter = 0;\r\n                babylonTexture.vRotationCenter = 0;\r\n\r\n                if (extension.rotation) {\r\n                    babylonTexture.wAng = -extension.rotation;\r\n                }\r\n\r\n                if (extension.scale) {\r\n                    babylonTexture.uScale = extension.scale[0];\r\n                    babylonTexture.vScale = extension.scale[1];\r","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/glTF/2.0/Extensions/KHR_texture_transform.pure.ts#L33-L69","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Ensure the referenced texture is a standard 2D image texture (PNG/JPEG uri) that the loader creates as Texture.","Remove KHR_texture_transform from texture extensions that resolve to non-2D textures.","Provide a custom extension handler that applies the transform to your custom texture type."],"exampleFix":"// before: cubemap texture used with textureTransform\n\"extensions\": { \"KHR_texture_transform\": { \"offset\": [0.5, 0] } }\n// after: move the transform to a standard baseColorTexture","handlingStrategy":"type-guard","validationCode":"// in a custom extension wrapper\nif (!(babylonTexture instanceof Texture)) {\n  throw new Error('KHR_texture_transform requires a 2D Texture');\n}","typeGuard":"function isTransformableTexture(t: BaseTexture): t is Texture {\n  return t instanceof Texture;\n}","tryCatchPattern":"try { await loader.loadAsync(url); } catch (e) {\n  if (e.message.includes('Texture type not supported')) {\n    // reload with texture transform extension disabled or swap the texture\n  } else throw e;\n}","preventionTips":["Only apply KHR_texture_transform to standard 2D image textures.","Check that custom texture loaders return Texture instances for textures carrying the extension.","Validate texture extension combinations (e.g. basis/cubemap + transform) at authoring time."],"tags":["gltf","textures","type-mismatch","extensions"],"backgroundTag":"unsupported-texture-type","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}