Skybox default color/texture

It is possible somehow to get the skybox to load a default color/texture if the skybox is not loaded yet? I have tried a bunch of color things from the docs now but doesn’t really appear to do aynthing for me.

Can’t I just set the material color only instead of using a texture?
Also not sure how to catch the skybox not loaded error.

What you can do is setting a diffuse color at start and no reflection texture.

Then load the sky texture, and when loaded update the material to use this texture:

https://www.babylonjs-playground.com/#UU7RQ#894

You can even get rid of the transition between both materials where one or two frames could be black because the effect is not ready yet by forcing the compilation of the new material and switching materials in the oncomplete event:

https://www.babylonjs-playground.com/#UU7RQ#895

1 Like