Error in Basis CubeTexture

Since there are no basis skyboxes on the playground I have to place the code here anyway checking it is pretty straightforward:

var texture = new BABYLON.CubeTexture(
    url,
    scene,
    null,
    true,
    null,
    function () {
        resolve(texture);
        console.log("OK", url)
    },
    function (message) {
        console.log("MSG:", message);
        reject(message);
        console.log("FAIL", url)
    }
);

it triggers

MSG: Textures type does not support cascades.
(index):91 FAIL ./textures/cubeb.basis

The error seems to be that even sending null as “files parameter” it seems that it considers that we are trying to use several images to create the cubemap (that is not supported in basis format), and set that parameter is required to setup the loading callbacks.

Btw I’ve tried with square brackets without nothing inside it (I cannot write them here since the forum parses it to a checkbox) instead of null without luck.

Thank you!

I do not know if we support basis cube texture at the moment, @bghgary might know ?

Also ktx2 might be a more recommended approach for this ???

It loads ok if I only set the first two params, the problem is that I cannot use the loading callbacks.

Unfortunately, I don’t think Basis or KTX2 in Babylon has cube texture support. :frowning:

It actually works if you only set the two first parameters! the problem is that setting the “Textures” parameter to null triggers an error so you cannot use the callbacks.

I don’t understand what you mean. :confused: Are you saying it works or doesn’t work? Can you create a playground? You can reference external assets using this instructions: Using External Assets In the Playground | Babylon.js Documentation (babylonjs.com)

I think that this could be easier to be understood,

Regards

I see this in the console:

Uncaught (in promise) Textures type does not support cascades.

Is that what you mean?

EDIT: Sorry, I need to read your playground comments. :slight_smile: Let me look at it.

also you can have the same callbacks by passing undefined in the files param: https://playground.babylonjs.com/#T55LFE#2

Basically only env or dds can be loaded as a single cube texture file.

    //THIS METHOD WORKS: unfortunately it cannot trigger any callback    
    var cubetexture2 = new BABYLON.CubeTexture(
                    mUrl,
                    scene
                );

    console.log("cubetexture2", cubetexture2);

I’m not sure what you mean by it works. Yes, there is a texture object, but the texture object has no content as far as I can tell.

Right now, yes. It should be theoretically possible to do it with a Basis or KTX2 file, but we don’t support it in the code.

Babylon.js sample code it seems to work here :sweat_smile:

To be honest it seems to work randomly

And another simplier playground using CreateFromPrefilteredData https://playground.babylonjs.com/#T55LFE#3

The problem is that it doesn’t trigger error callbacks to debug it properly

1 Like

Is this what you want?
PG: https://playground.babylonjs.com/#T55LFE#6

That’s black magic what was the principal difference?

prefiltered = true makes it work but only by pure luck… let me fix the default way…

1 Like

For future readers two methods for async loading of basic cubemaps

1 Like

This will correctly work after the PR: https://playground.babylonjs.com/#T55LFE#10

The pr is available here: Fix Loading Cube Texture from basis file by sebavan · Pull Request #12924 · BabylonJS/Babylon.js · GitHub

Thanks a lot @Escobar I discovered a new feature in the engine today :slight_smile:

2 Likes

@sebavan unfortunately I’ve found more issues, here is the self-explicative playground (it triggers an alert that explains the problem)

Let me have a look