How to load Environment settings with Scenes?

image.png

by user 300386587278049291

not sure how i missed this before

by user 300386587278049291

I do have the Camera Skybox Data component on the camera

by user 300386587278049291

well…got it working…it seems the root scene that loads other scenes needs a skybox on it or else no other skyboxes will load

by user 300386587278049291

Really? :thinking: that would certainly be a bug

will open an issue internally

cool :+1: now onto fog!

by user 300386587278049291

ok i take that back

by user 300386587278049291

its just keeping the root scene skybox on all other scenes

by user 300386587278049291

but i’m not getting the “Failed to load skybox” error

by user 300386587278049291

When you load a scene with another camera set to “MainCamera” and Clearflags to skybox?

yea

by user 300386587278049291

with debuglightmaps parameter I do see 3 unique “Registering Skybox” messages

by user 300386587278049291

(I have root and 2 external scenes, all with diff skyboxes)

by user 300386587278049291

I’m in URP so it’s called Background Type: Skybox

by user 300386587278049291

Ok that should definitely work

debugcam shows Set Skybox that 'seem’s correct

by user 300386587278049291

you can get access to the loaded skybox with this._skybox = this.context.lightmaps.tryGetSkybox(this._camera.sourceId) as THREE.Texture; the sourceId is basically the relative url where it was loaded from.

its a bit misleading (lightmaps containing the skybox) that needs to change at some point. But maybe as a workaround you can see what’s inside and try to set it yourself

This is the CameraSkybox enable code:

enable() {
        this._skybox = this.context.lightmaps.tryGetSkybox(this._camera.sourceId) as THREE.Texture;
        if (!this._skybox) {
            console.warn("Failed to load/find skybox texture", this);
        }
        else if (this.context.scene.background !== this._skybox) {
            if (debug)
                console.log("Set skybox", this._camera, this._skybox);
            this._skybox.encoding = sRGBEncoding;
            this._skybox.mapping = EquirectangularReflectionMapping;
            this.context.scene.background = this._skybox;
        }
    }