SkyBox Mipmap value change by code

image
I’ve set up scene level skybox and its mipmap value to 1.

image

So, the skybox reflection is vey clear.
BTW, the skybox texture resolution is 512.

Then, I’ve changed the scene level skybox to a different one.
image

Somehow, the reflection quality isn’t as good as before once after I change skybox via script.
image

Below is the code snipper to change environment (skybox) dynamically.

    this.app.scene.setSkybox(currentEnvSkyBox.resources);
    this.app.scene.skyboxIntensity = curr.intensity;
    this.app.scene.skyboxMip = 1;
    this.app.scene.exposure = curr.exposure;    

It seems like the mipmap is fixed while an asset is loaded. Is anyway to fix my problem?

You may need to load the cubemap faces manually as well.

Try

    // Load the high quality faces
    this.skyboxAsset.loadFaces = true;
    this.skyboxAsset.ready((asset) => {
        this.app.scene.setSkybox(asset.resources);
        this.app.scene.skyboxMip = 0;
    });

    this.app.assets.load(this.skyboxAsset);

If this doesn’t work, can you post simple repro project for us to look at please?

1 Like

What is ‘loadFaces’ set for? I didn’t search for this in the API documentation.I encountered some problems while setting up the Sky Box. I accidentally saw this method, which is very helpful for me to set up the Sky Box. I want to know what this is for

It’s a bit of legacy code in the engine. The cubemap asset itself, only contains the mipmap levels and the preflighted data.

So, it that is only loaded, the reflections only would show the mipmap levels. Having this flag and loading the cubemap again, will load the 6 face textures into the cubemap so they are used for reflections.