Black background, sometimes

I’m building a basic configurator: show a model, change colors and textures. I’m having an issue with setting up the background color. I’m using the clearcolor to set the background color to white.

My client reports that he sees the background color flicker between white and black when orbiting the camera. He has tried in several browsers and they all have this issue in different degrees. I’m unable to reproduce this on my PC though, so I’m unable to create a playground with this issue.

Here’s a video of the issue:

Does anyone have an idea where I can look to start solving this?

So the background is plain color? Seems like a backgroundMaterial to me

How do you setup the environment?

I have a backgroundMaterial on the square plane underneath the shirt. The rest of the background uses a clearcolor. Besides that I use a DefaultRenderingPipeline and a SSAO2RenderingPipeline.

This is what I use for the clearcolor

scene.clearColor = new Color4(1, 1, 1, 1);
scene.autoClear = true

yeah but the problem here seems to be that we are losing the background right?

Exactly. Somehow it seems the clearcolor alternates between its regular color (white) and black, or completely transparent. And it depends on the angle of the camera.

Klaas Nienhuis

projects of the third kind

1 Like

But what I mean is that the background (which is a box rendered on top of the clearcolor) should not disappear like that at all.

We need to repro somewhere to see what is going wrong. Is there any error in the console?

@klaasnienhuis, Dude nice to see you on the forums!

How are you making your cubemap? Are you using the default environment?

Could you mock up the setup as a playground without your model, but the same camera and approximate environment setup?

Hi Andy, nice to see you around!
I’ve tried to reproduce how I setup my scene: Babylon.js Playground

I use a custom hdr file which I process with HDRCubeTexture. but I only use it for reflections on my materials.

Do you know if your customer have any error in the console?

@klaasnienhuis could you try increasing the maxZ of your camera ???

It looks like the background skybox cube is culled from the scene here depending on the view angle.

1 Like

I will ask about the error reports. I do have reports from the browsers where this issue occurs:

This all happens on a mac

I was thinking that you are clipping out of your environment box from what I am seeing, but after thinking about where it disappears though @sebavan might be spot on because those would be the longest continuous lines to the edge from those positions.

So did you try changing the maxZ?

I’ll change the maxZ and make a new release for the client.
I could also add an inverted box around my scene. Perhaps it will help.
The client reports no errors in the console by the way.

1 Like

Increasing the maxZ didn’t help. I added an inverted white cube around the scene which does help.
So, I couldn’t find out the original issue. I couldn’t reproduce it myself either. But I’ve worked around it with the inverted cube.
In any case, thanks everyone for the very fast responses.

1 Like