BabylonJS/Babylon.js · error

Loading textures from IInternalTextureLoader not yet impleme

Error message

Loading textures from IInternalTextureLoader not yet implemented.

What it means

ThinNativeEngine.createTexture does not support loading textures through an IInternalTextureLoader promise-based loader (used for non-image formats like .dds/.ktx2/etc. that need async transcoding). The Babylon Native/bgfx engine only implements the raw-data loading path, so when the loader selection produces a loaderPromise instead of a buffer-based load, it throws immediately.

Source

Thrown at packages/dev/core/src/Engines/thinNativeEngine.pure.ts:2035

                }

                if (EngineStore.UseFallbackTexture) {
                    this.createTexture(EngineStore.FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture);
                }

                if (onError) {
                    onError((message || "Unknown error") + (EngineStore.UseFallbackTexture ? " - Fallback texture was used" : ""), exception);
                }
            } else {
                // fall back to the original url if the transformed url fails to load
                Logger.Warn(`Failed to load ${url}, falling back to ${originalUrl}`);
                this.createTexture(originalUrl, noMipmap, texture.invertY, scene, samplingMode, onLoad, onError, buffer, texture, format, forcedExtension, mimeType, loaderOptions);
            }
        };

        // processing for non-image formats
        if (loaderPromise) {
            throw new Error("Loading textures from IInternalTextureLoader not yet implemented.");
        } else {
            const onload = (data: ArrayBufferView) => {
                if (!texture._hardwareTexture) {
                    if (scene) {
                        scene.removePendingData(texture);
                    }

                    return;
                }

                const underlyingResource = texture._hardwareTexture.underlyingResource;

                this._engine.loadTexture(
                    underlyingResource,
                    data,
                    !noMipmap,
                    invertY,
                    texture._useSRGBBuffer,

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Convert the asset to a raw image format supported by the native path (e.g. .png/.jpg) and load that instead.
  2. Pre-decode the texture yourself (CPU-side) and pass the raw ArrayBuffer/Uint8Array data via createTexture's buffer parameter or use createRawTexture.
  3. If you own the pipeline, implement the missing loaderPromise branch in thinNativeEngine.pure.ts (the error is an explicit not-yet-implemented marker).

Example fix

// before
const tex = new BABYLON.Texture("env.ktx2", scene);

// after
const tex = new BABYLON.Texture("env.png", scene); // or pass decoded raw data to createRawTexture
Defensive patterns

Strategy: validation

Validate before calling

const loaderExts = [".dds", ".ktx", ".ktx2", ".basis"];
const ext = url.split("?")[0].slice(url.lastIndexOf(".")).toLowerCase();
if (engine instanceof BABYLON.ThinNativeEngine && loaderExts.includes(ext)) {
  throw new Error(`Native engine cannot load ${ext}; use a raw image or pre-decoded data.`);
}

Type guard

const isNativeSafeTextureUrl = (url: string): boolean =>
  ![".dds", ".ktx", ".ktx2", ".basis"].some(e => url.toLowerCase().includes(e));

Try / catch

try {
  const tex = engine.createTexture(url, false, false, scene);
} catch (e) {
  if (e.message.includes("not yet implemented")) {
    console.warn("Falling back to PNG texture for", url);
    tex = engine.createTexture(toRawImageUrl(url), false, false, scene);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling engine.createTexture (or loading a scene/texture) with a URL whose extension maps to an IInternalTextureLoader-based format (.dds, .basis, .ktx2, .ktx, etc.) when using ThinNativeEngine/NativeEngine.

Common situations: Porting a WebGL Babylon.js project to Babylon Native and reusing compressed-texture assets (.dds/.ktx2) or forceExtension-based loader plugins; materials referencing those textures fail at creation time.

Related errors


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