# How to fix flickering

**URL:** <https://discourse.threejs.org/t/how-to-fix-flickering/44643>\
**Category:** Questions\
**Tags:** flicker\
**Created:** [November 13, 2022, 4:50pm UTC](https://discourse.threejs.org/t/how-to-fix-flickering/44643 "2022-11-13T16:50:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SirJoeth3rd](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@SirJoeth3rd](https://discourse.threejs.org/u/SirJoeth3rd)\
**Post date:** [November 13, 2022, 4:50pm UTC](https://discourse.threejs.org/t/how-to-fix-flickering/44643/1 "2022-11-13T16:50:42Z")

</div>

Hey, I’m new to both threejs and this community so I apologize in advance for any stupidity. I’m trying to make a 3d gravity simulator that moves these “stars” around. It worked fine but then I wanted to put all my code in a container class to be able to manipulate it with buttons and what not in my html. However when I did so every texture of every star was suddenly of a lot lower quality additionally the stars now have this tendency to flicker in and out of existence for different distances from the camera.

[https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/5/d/5d106d93ae109d42e8cb1a389e13132eea71269c.webm](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/5/d/5d106d93ae109d42e8cb1a389e13132eea71269c.webm)

---

<div class="post-metadata">

**Author:** ![abernier](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/abernier/32/23939_2.png) [@abernier](https://discourse.threejs.org/u/abernier)\
**Post date:** [November 13, 2022, 5:18pm UTC](https://discourse.threejs.org/t/how-to-fix-flickering/44643/2 "2022-11-13T17:18:27Z")

</div>

I’m not sure because I can’t load the video but it makes me think of “z-fighting” issue

> <https://stackoverflow.com/questions/40328722/how-can-i-solve-z-fighting-using-three-js/56792475#56792475>

Try adding `logarithmicDepthBuffer: true` when intanciating your renderer like in the SO answer?

---

<div class="post-metadata">

**Author:** ![SirJoeth3rd](https://avatars.discourse-cdn.com/v4/letter/s/b3f665/32.png) [@SirJoeth3rd](https://discourse.threejs.org/u/SirJoeth3rd)\
**Post date:** [November 14, 2022, 4:50am UTC](https://discourse.threejs.org/t/how-to-fix-flickering/44643/3 "2022-11-14T04:50:15Z")

</div>

Hey thanks for the answer, unfortunately I don’t think that is the issue i tried your fix as well and no dice. Previously I also found the z-fighting issue. In my case it’s not two objects fighting for the same pixel (which is what z-fighting refers to) , rather the object itself disappears against the black background.

---

<div class="post-metadata">

**Author:** ![tfoller](https://avatars.discourse-cdn.com/v4/letter/t/3e96dc/32.png) [@tfoller](https://discourse.threejs.org/u/tfoller)\
**Post date:** [November 14, 2022, 4:55am UTC](https://discourse.threejs.org/t/how-to-fix-flickering/44643/4 "2022-11-14T04:55:15Z")

</div>

It’ll help if you provide a minimum live example of your problem with (one) flickering star on jsfiddle or codepen.  
It’s hard to guess judging by the video.
