# Mesh flickering after re-render/dispose()

**URL:** <https://forum.babylonjs.com/t/mesh-flickering-after-re-render-dispose/31408>\
**Category:** Questions\
**Tags:** mesh\
**Created:** [June 16, 2022, 5:58am UTC](https://forum.babylonjs.com/t/mesh-flickering-after-re-render-dispose/31408 "2022-06-16T05:58:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vsnikhilvs](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vsnikhilvs/32/22847_2.png) [@vsnikhilvs](https://forum.babylonjs.com/u/vsnikhilvs)\
**Post date:** [June 16, 2022, 5:58am UTC](https://forum.babylonjs.com/t/mesh-flickering-after-re-render-dispose/31408/1 "2022-06-16T05:58:55Z")

</div>

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/0/6/061f54be1afefb1b87c74ce8363dfe582ec52547.jpeg)  
First Image → Normal working  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/1/61f5195d0fc96fd7d25bcb7670db435cff4a1948.jpeg)  
Second Image → When clicking replace chair with image  
Replace function steps:

1. disable the previous mesh
2. dispose the previous mesh
3. import a new mesh and place it at the required position  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/d/bd958c778304a4933149bc94b30bbe8ba814dadc.png)  
Third Image → Replace mesh function  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/c/ccbdcf005ee3a227bdc7d01f60974ba223051f45.jpeg)  
Fourth Image → On moving the surrounding with the mouse control, the room mesh gets flickered. This does not happen that often. But it does.

Question1: Why does the first table flicker like that seen on the second image on replacing another mesh ?  
Question2: Why does the room mesh flicker ?

Any answers or suggestions are welcome.  
Unfortunately, I could not make up a playground because the assets are private.

Thank you

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [June 16, 2022, 10:01am UTC](https://forum.babylonjs.com/t/mesh-flickering-after-re-render-dispose/31408/2 "2022-06-16T10:01:07Z")

</div>

That’s hard to say without a reproduction.

> [@vsnikhilvs](#):
>
> Unfortunately, I could not make up a playground because the assets are private.

If you can reproduce that with any other asset it means that this is something we can help with for sure! If it only happens with this one single model, it might be related to the model itself (though I am pretty sure it is not a model-related issue only).

Could you try making a playground with a publicly-available asset?

---

<div class="post-metadata">

**Author:** ![vsnikhilvs](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vsnikhilvs/32/22847_2.png) [@vsnikhilvs](https://forum.babylonjs.com/u/vsnikhilvs)\
**Post date:** [June 16, 2022, 10:18am UTC](https://forum.babylonjs.com/t/mesh-flickering-after-re-render-dispose/31408/3 "2022-06-16T10:18:19Z")

</div>

I will try and get a playground url @RaananW

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [June 16, 2022, 11:13am UTC](https://forum.babylonjs.com/t/mesh-flickering-after-re-render-dispose/31408/4 "2022-06-16T11:13:19Z")

</div>

> [@RaananW](#):
>
> it might be related to the model itself (though I am pretty sure it is not a model-related issue only).

I agree. Looks more like an issue related to env or reflection coordinates/matrix. May be you have somehow linked these to your mesh or material and next when you move or dispose of the mesh or material, it breaks?

---

<div class="post-metadata">

**Author:** ![vsnikhilvs](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vsnikhilvs/32/22847_2.png) [@vsnikhilvs](https://forum.babylonjs.com/u/vsnikhilvs)\
**Post date:** [July 11, 2022, 10:03am UTC](https://forum.babylonjs.com/t/mesh-flickering-after-re-render-dispose/31408/5 "2022-07-11T10:03:20Z")

</div>

Unfortunately, I could not reproduce it in a playground. But I fixed it using setTimeout().  
Just settimeout the required functions with time=0 for easy loading.
