# Something About ClearColor

**URL:** <https://forum.babylonjs.com/t/something-about-clearcolor/57327>\
**Category:** Questions\
**Created:** [March 21, 2025, 9:46am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327 "2025-03-21T09:46:59Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [March 21, 2025, 9:46am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/1 "2025-03-21T09:46:59Z")

</div>

Hi everyone~  
I used to make Babylon to render transparent by scene.clearColor.set(0, 0, 0, 0);  
It work well in PG 7.54.0 ([Babylon.js Playground](https://playground.babylonjs.com/#D49IEC))  
I always think that engine set clearcolor to all pixel before render, but when I update bbl in my projection from 7.8.0 to 7.54.0, clearcolor works like motion blur. I don’t know what cause this trouble.  
scene.clearColor = new Color4(1, 0, 0, 0.1):

  
scene.clearColor = new Color4(1, 0, 0, 0.001);

---

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [March 21, 2025, 10:36am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/2 "2025-03-21T10:36:19Z")

</div>

I debug the clear progress:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/c/5c98f7f0cc63b2ada41a0a9af3369aec79acd86e.png)  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/9/e94ecdb7ea72a78e2fd8dcb55598350bb9c9c629.png)

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [March 21, 2025, 2:34pm UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/3 "2025-03-21T14:34:08Z")

</div>

Could you try `scene.autoClear = true;` ?

---

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [March 24, 2025, 2:13am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/4 "2025-03-24T02:13:12Z")

</div>

Autoclear is true, I think I should generate scene from zero to checkout how this bug triggled

---

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [March 24, 2025, 3:54am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/5 "2025-03-24T03:54:47Z")

</div>

I find it is a multicanvas bug, when we need to create a multiCanvas engine, we create a canvas element as input param. In this case, clearcolor is not working well.

```auto
 if (this.multiCanvas) {
            const canvas = document.createElement("canvas");
            this.engine = new Engine(canvas, true, {}, true);
            this.engine.runRenderLoop(() => {
                this.renderLoopMultiCanvas();
            })
        }

```

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [March 24, 2025, 5:44am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/6 "2025-03-24T05:44:55Z")

</div>

Seems to be the same issue:

> **[Babylon.js Playground](https://playground.babylonjs.com/#Z9SXV4%2319)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

Try to move the camera in the second canvas. Changing the `clearColor.a` to `>0` removes the issue.

It affects both canvases:

> **[Babylon.js Playground](https://playground.babylonjs.com/#Z9SXV4%2327)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

Adding `{ alpha: true }` to the `Engine` constructor options doesn’t make a difference.

@Evgeni_Popov Since it’s your PG, I think you are the right person who can help to solve the issue. Thanks a lot!

---

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [March 24, 2025, 7:48am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/7 "2025-03-24T07:48:50Z")

</div>

Yes! They are looking the same!  
In my project, each canvas means a scene, each scene has a loader to import meshes  
I find another trouble that, meshes/materials/etc can imported into 2nd 3rd .., but nothing is render in the scene.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/3/53d051330f9093d1c8e51ab52c9222e8503f6a88.jpeg)  
Could resources like meshes/textures/materials be shared with different canvas of same Engine in multi-canvas mode?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 24, 2025, 3:08pm UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/8 "2025-03-24T15:08:50Z")

</div>

See if this helps:

> [@Multi view canvases not cleared properly if clearColor transparent?](https://forum.babylonjs.com/t/multi-view-canvases-not-cleared-properly-if-clearcolor-transparent/22359/4):
>
> @Deltakosh Thanks but Color4(0, 0, 0, 0.001) didn’t work. @Evgeni_Popov I expect the clearBeforeCopy param will work but I notice it only appeared in 5 alpha and I’m using 4.2.0 for the time being. But I’ll mark this as solved. Thanks.

---

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [March 25, 2025, 10:04am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/9 "2025-03-25T10:04:59Z")

</div>

Ohhh, clearcolor work again, thank you for your helper !!!

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/a/ea290de7ef54627f6efe82dcd7b11a7e048cd1b9.jpeg)  
Do you know the second trouble, I use same code to load model for each canvas, only the first canvas renders models. I check my code and finally find that environmentBRDFTexture cause it. I don’t know how to fix it, do you have any idea?  
This is PG about this trouble: [https://playground.babylonjs.com/#E6I6PX#3](https://playground.babylonjs.com/#E6I6PX#3)  
Case environmentBRDFTexture is not set, model can be renderred:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/e/3/e3ef5e14e80fd00a86a7f352f45417e810647c6a.png)  
Case environmentBRDFTexture is set, model can not be renderred:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/3/73778507f4f4263336965d3b914c838dd186caae.png)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 25, 2025, 10:35am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/10 "2025-03-25T10:35:50Z")

</div>

It’s `environmentTexture` you want to set, not `environmentBRDFTexture` (the BRDF texture is an internal texture, that you probably never want to change as it’s quite particular). Also, you should use “/” in the url of the environment texture, not “\” (line 33):

> **[Babylon.js Playground](https://playground.babylonjs.com/#E6I6PX%235)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

---

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [March 25, 2025, 11:46am UTC](https://forum.babylonjs.com/t/something-about-clearcolor/57327/11 "2025-03-25T11:46:41Z")

</div>

Sorry, it is my missspelling, I find the env file is missing in my project which cause this trouble, like this: [https://playground.babylonjs.com/#E6I6PX#7](https://playground.babylonjs.com/#E6I6PX#7) Thank you for helping me! 😁
