[SOLVED] Toggle skybox from Scene


I’m testing the screenshot code in the example, and I want to have it exported with a transparent background. To get to that, I need to disable the skybox before taking the screenshot and then ideally re-enabling it.

I’m trying this code to store it and reset. However, it seems .skybox is null. However _getSkybox() function seems to work for me.

// Store away initial skybox
this.skyboxTexture = this.app.scene.skybox; // null
this.skyboxTexture = this.app.scene._getSkyboxTex(); // works

// Reset code:

Unless your mip level is 0, this is null.

If mip level is not 0, then you need to get the prefiltered textures

var texture = this.app.scene.prefilteredCubemaps[this.app.scene.skyboxMip];

In your case, it might be easier to remove/add the skybox layer from the camera.

… or just set enabled on skybox layer to false

1 Like

Silly me! Thank you both, I missed there was a skybox layer. I’ll just remove that one fromt my screenshotcamera.

Have a nice weekend.

1 Like