# needDepthPrePass creates flickering in 8.6.2

**URL:** <https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421>\
**Category:** Bugs\
**Created:** [May 14, 2025, 12:45pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421 "2025-05-14T12:45:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boye](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boye/32/27574_2.png) [@Boye](https://forum.babylonjs.com/u/Boye)\
**Post date:** [May 14, 2025, 12:45pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/1 "2025-05-14T12:45:17Z")

</div>

There is a lot of flickering on the mesh, whenever “needDepthPrePass” is enabled.

To test, drag [https://test-realtime.lindberg.com/Demo/Flicker.babylon](https://test-realtime.lindberg.com/Demo/Flicker.babylon) into these sandboxes:

8.6.1 - No flicker: [Babylon.js Sandbox - View glTF, glb, obj and babylon files](https://sandbox.babylonjs.com/?version=8.6.1)

8.6.2 - Flickering: [Babylon.js Sandbox - View glTF, glb, obj and babylon files](https://sandbox.babylonjs.com/?version=8.6.2)

I can’t reproduce in playground right now, but I’ll continue trying

---

<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:** [May 14, 2025, 3:00pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/2 "2025-05-14T15:00:11Z")

</div>

I don’t see any flickering in 8.6.2 with this model (tested in Chrome, Edge and Firefox, Windows 11)?

Try closing/restarting your browser, sometimes strange things happen…

---

<div class="post-metadata">

**Author:** ![AlitarSemiramis](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alitarsemiramis/32/49920_2.png) [@AlitarSemiramis](https://forum.babylonjs.com/u/AlitarSemiramis)\
**Post date:** [May 14, 2025, 4:18pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/3 "2025-05-14T16:18:37Z")

</div>

I also tried in Windows 11, with Edge, and no flickering on my end either.

---

<div class="post-metadata">

**Author:** ![Boye](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boye/32/27574_2.png) [@Boye](https://forum.babylonjs.com/u/Boye)\
**Post date:** [May 16, 2025, 6:44am UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/4 "2025-05-16T06:44:32Z")

</div>

Just tested Windows 11 and so there was no flickering for me either, but i can still reproduce in both Safari and Chrome on macOS

---

<div class="post-metadata">

**Author:** ![Boye](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boye/32/27574_2.png) [@Boye](https://forum.babylonjs.com/u/Boye)\
**Post date:** [May 16, 2025, 9:10am UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/5 "2025-05-16T09:10:41Z")

</div>

Finally able to reproduce in a PG:

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

Also confirmed on a co-workers mac

For some wierd reason this only happens:

- on macOS (Safari and Chrome)
- when scene.useRightHandedSystem == true
- when material.needDepthPrePass == true
- when mesh.position != new Vector3(0, 0, 0)

8.6.1 - No flicker: [Babylon.js Playground](https://playground.babylonjs.com/?version=8.6.1#RNWZOX)  
8.6.2 - Flickering: [Babylon.js Playground](https://playground.babylonjs.com/?version=8.6.2#RNWZOX)

---

<div class="post-metadata">

**Author:** ![docEdub](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/docedub/32/14525_2.png) [@docEdub](https://forum.babylonjs.com/u/docEdub)\
**Post date:** [May 16, 2025, 4:49pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/6 "2025-05-16T16:49:11Z")

</div>

I don’t see any flickering on my MacBook Air M3.

macOS 15.4.1  
Safari 18.4  
Chrome 136.0.7103.93 (arm64)

---

<div class="post-metadata">

**Author:** ![Boye](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boye/32/27574_2.png) [@Boye](https://forum.babylonjs.com/u/Boye)\
**Post date:** [May 19, 2025, 9:59am UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/7 "2025-05-19T09:59:31Z")

</div>

Interesting - I’m also on : 15.4.1, 18.4 and 136.0.7103.114

I can also reproduce on iOS 18.4.1

---

<div class="post-metadata">

**Author:** ![Boye](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boye/32/27574_2.png) [@Boye](https://forum.babylonjs.com/u/Boye)\
**Post date:** [May 21, 2025, 7:29am UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/8 "2025-05-21T07:29:16Z")

</div>

Did you try zooming in, like in the videos?

I have reproduced it on my iPhone and 3 different Macs now

---

<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:** [May 21, 2025, 8:41am UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/9 "2025-05-21T08:41:18Z")

</div>

I can repro on M4/Chrome Version 136.0.7103.114 (Official Build) (arm64)/BJS 8.8.5

Only WebGL is affected.

---

<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:** [May 21, 2025, 8:43am UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/10 "2025-05-21T08:43:14Z")

</div>

BJS 7.54.2 works fine.

Safari, like Chrome, has issues as well with the newest BJS version.

---

<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:** [May 21, 2025, 12:24pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/11 "2025-05-21T12:24:15Z")

</div>



---

<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:** [May 21, 2025, 1:34pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/12 "2025-05-21T13:34:35Z")

</div>

Can you check that this PG works for you?

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

It works for me on my iPhone SE, unlike [https://playground.babylonjs.com/#RNWZOX#44](https://playground.babylonjs.com/#RNWZOX#44).

I will create a PR if that is ok.

---

<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:** [May 21, 2025, 1:34pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/13 "2025-05-21T13:34:39Z")

</div>



---

<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:** [May 21, 2025, 1:56pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/14 "2025-05-21T13:56:38Z")

</div>

> [@Evgeni\_Popov](#):
>
> Can you check that this PG works for you?

Works for me 😉 Tested both in Chrome and Safari.

---

<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:** [May 21, 2025, 2:00pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/15 "2025-05-21T14:00:17Z")

</div>

@Evgeni_Popov  
Wait, wait! Something strange just happened. I tried opening the PG a second time, and it started flickering again… What the heck? Let me dig into this.

**EDIT – Summary:**

**Chrome and Brave:**

1. The first run works fine.
2. Refreshing the PG causes flickering to start again.
3. I need to quit the browser(s) and restart them to display the mesh without flickering. Closing the tab doesn’t do the job.

**Safari:**  
Works fine, even with multiple refreshes.

Quite interesting…

---

<div class="post-metadata">

**Author:** ![docEdub](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/docedub/32/14525_2.png) [@docEdub](https://forum.babylonjs.com/u/docEdub)\
**Post date:** [May 21, 2025, 3:29pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/16 "2025-05-21T15:29:54Z")

</div>

Ah! I didn’t realize zooming in would repro this. I see the flickering on my mac now, too, when zooming in.

---

<div class="post-metadata">

**Author:** ![Boye](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boye/32/27574_2.png) [@Boye](https://forum.babylonjs.com/u/Boye)\
**Post date:** [May 26, 2025, 7:54am UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/17 "2025-05-26T07:54:48Z")

</div>

> [@roland](#):
>
> Wait, wait! Something strange just happened. I tried opening the PG a second time, and it started flickering again… What the heck? Let me dig into this.

Same for me - Fixed in Safari and the first time i launch it in Chrome, but it happens afterwards in Chrome

---

<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:** [May 26, 2025, 9:11am UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/18 "2025-05-26T09:11:19Z")

</div>

Very strange…

At least it improves things overall, so here’s the PR:

[https://github.com/BabylonJS/Babylon.js/pull/16668](https://github.com/BabylonJS/Babylon.js/pull/16668)

---

<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:** [May 26, 2025, 10:36am UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/19 "2025-05-26T10:36:00Z")

</div>

shader voodoo 😃

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [May 26, 2025, 9:18pm UTC](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421/20 "2025-05-26T21:18:33Z")

</div>

The fix is scary AF 🙂 Can you open a bug on webkit to be sure it gets handled one day ?

[Next page](https://forum.babylonjs.com/t/needdepthprepass-creates-flickering-in-8-6-2/58421.md?page=2)
