Asset breaks WebGPUEngine

Hi!
I’ve got an asset that when i load it in my app with GPUEngine on, it throws a ton of errors about a texture not being the right size. However when i load the asset in a PG with WebGPU on, i don’t get the same error.

Here, you can see it breaking my app:

And here, running with same build with webgpu turned off:

Here is a PG where it doesn’t break with GPU on. Not sure what the different might be? Maybe with how the engine is configured (see below): https://playground.babylonjs.com/?webgpu#WF3VKZ#532

the code that turns on the engine is this:

  StartBabylon.prototype.createEngine = async function(canvas) {
    console.log('StartBabylon-createEngine')
    this.mlog.log('StartBabylon-createEngine - evaluating GPU', {}, 1);
    this.webGPUSupported = await (BABYLON.WebGPUEngine).IsSupportedAsync;

    //get params from URL to see if webgpu is there.
    let webgpu = getUrlParameter('webgpu');

    let engine;
    if (this.webGPUSupported && webgpu != undefined && webgpu != false) {
        console.log('StartBabylon-createEngine - webGPUSupported and requested in param', {'webgpu':webgpu}, 1);
        engine = new BABYLON.WebGPUEngine(canvas);
        await engine.initAsync();
    } else {
        console.log('StartBabylon-createEngine - NON webGPUSupported', {'webgpu':webgpu}, 1);
        engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true, disableWebGL2Support: false }); // Generate the BABYLON 3D engine
        engine.enableOfflineSupport = false;
        engine.setHardwareScalingLevel(1 / window.devicePixelRatio); //enables crisp text in gui
    }
    return engine;
  }

Interesting: it works on my Pixel phone; but breaks both of my Macs (desktop and laptop).

The texture referenced in the error message (opaque texture) is a texture used to handle the KHR_material_transmission extension. According to the error message, it is passed to a shader which expects a cube texture, whereas this texture is a 2D texture.

I don’t know why that happens…

I tested in WebGL, it seems it’s the windshield of the car which uses a transmissive material, but the refraction texture is not the one created by the transmission extension, it is a cube texture instead (probably the scene.environmentTexture).

It’s a bit strange that the opaque texture is not used by any material of the scene…

Your PG seems more accurate, since there’s a material (“windows”) that uses the opaque texture as a refraction texture…

1 Like