Dispose of lighting effects from a DDS skybox?

Hi all.
I’m wondering how to properly dispose of lighting effects from a DDS skybox. It seems that skybox.dispose() will get rid of the box itself, but that lighting remains on any object that was loaded in.

https://www.babylonjs-playground.com/#BH23ZD#35

Is there a trick to remove lighting from loaded objects?

thx.

Screenshot shows scene after disposal of DDS skybox.
Sphere that was created has lighting removed at center.
Other objects loaded in from GLB still have DDS lighting effects.

Hi bigrig!

The reason for the black sphere in the middle seems to be that it has no material.
I added a PBRMaterial and it went full mirror mode :smiley:

The reason is that you dispose only the skybox. This means the background from your scene is gone.
When you created the skybox you implicitly set the environmentTexture of the scene which is used for PBR lighting.
When you set the scene.environmentTexture to null the whole lighting is gone :slight_smile:

https://www.babylonjs-playground.com/#BH23ZD#36

1 Like

Brilliant. Thx!!

Have been playing around with this - but it seems that setting scene.environmentTexture=null doesn’t completely deactivate the environment texture. A couple of textures still exist from the skybox (which change the colortone/lighting of the scene):

I tried a loop to remove all textures as part of a “destroyAll()” sequence, but nothing shows up after that. Any ideas for how to completely remove the skybox/textures?

PG here (click the buttons at top 1-4)
https://www.babylonjs-playground.com/#DQF3UA#22

  1. destroys the loaded GLB+skybox
  2. loads a 2nd GLB+default environment skybox
  3. destroys what was loaded
  4. loads up the 1st GLB again (notice colors different than 1st load and the following textures still present)

Hm, hold on. I just loaded that PG again and now it’s working…!? Those textures are still there… but they seem to be having no impact now. Hm, not sure what’s going on.

How do you just say:

  • Clear the slate and start over Babylon!

I suppose i could just scene.dispose() and rebuild it…