Scene.clearColor not working in Multiple Canvases?

https://codepen.io/dmystk/pen/jOMZxeo

I added the code to that codes.

scene.clearColor = new BABYLON.Color4(0, 0, 0, 0)

Scene.clearColor doesn’t seem to work with Color4
But Color3 works well.

What am I missing?

The 4th parameter is the alpha value, so i would expect this to be 100% transparent. If you want to create black, you have to use alpha = 1:

scene.clearColor = new BABYLON.Color4(0, 0, 0, 1)
2 Likes

Thanks for replying.
Actually, what I wanted was a transparent background.
Is there a reason for clearing the scene like this when using new BABYLON.Color4(0, 0, 0, 0)?

You need to additionally set canvas background color to transparent:

You may also set background color to transparent of renderCanvas0 and renderCanvas1 if you wish.

5 Likes

Thank you!!!