Making background black when using createDefaultEnvironment

when using
scene.createDefaultEnvironment();
the background is this blue tone. How can I make the background be black
instead of that blue?
thank you :slight_smile:

The createDefaultEnvironment helper takes optional IEnvironmentHelperOptions. Setting skyboxColor likely gives you what you want. Example:

More info:

@kaliatech thank you, yes that works with this

var envHelperOpts:Partial = {
enableGroundMirror: false,
skyboxColor: new Color3(0.03, 0.03, 0.03),
}

const env = scene.createDefaultEnvironment(envHelperOpts);

however when I tilt the scene downwards, I can see light below the texture with a bluish tone, where is that bluish tone coming from?

thank you

@kaliatech actually and an extra problem, when I do this:

var envHelperOpts:Partial = {

enableGroundMirror: false,

skyboxColor: new Color3(0.005, 0.005, 0.005),

}

const env = scene.createDefaultEnvironment(envHelperOpts);

const xr = await scene.createDefaultXRExperienceAsync({

floorMeshes: [env.ground]

});

the background becomes black when I am not in inmersive mode, but when I click on the goggles and I go into inmersive mode then the background is that blue color again!

That is the default ground color. To change:

    var envHelperOpts:Partial<BABYLON.IEnvironmentHelperOptions> = {
        skyboxColor: new BABYLON.Color3(0, 0, 0),
        groundColor:  new BABYLON.Color3(0., 0, 0),
    }

Although if you don’t want any ground:

    var envHelperOpts:Partial<BABYLON.IEnvironmentHelperOptions> = {
        skyboxColor: new BABYLON.Color3(0, 0, 0),
        createGround: false
    }

Although if you don’t any ground or sky, then probably easier to not use the EnvironmentHelpers.

I don’t follow your last point about entering WebXR. It’s possible a camera position issue as when you enter XR your camera resets to your real world relative space. I would suggest you review the environment options, and then post Playground examples if you continue to have problems.

1 Like

Hello @javismiles just checking in, was your question answered?