# Disappearing mesh/material on registerInstancedBuffer and instancedBuffers?

**URL:** <https://forum.babylonjs.com/t/disappearing-mesh-material-on-registerinstancedbuffer-and-instancedbuffers/30868>\
**Category:** Questions\
**Created:** [May 30, 2022, 2:51pm UTC](https://forum.babylonjs.com/t/disappearing-mesh-material-on-registerinstancedbuffer-and-instancedbuffers/30868 "2022-05-30T14:51:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![webgrid](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/webgrid/32/24940_2.png) [@webgrid](https://forum.babylonjs.com/u/webgrid)\
**Post date:** [May 30, 2022, 2:51pm UTC](https://forum.babylonjs.com/t/disappearing-mesh-material-on-registerinstancedbuffer-and-instancedbuffers/30868/1 "2022-05-30T14:51:02Z")

</div>

See the image before and after in my game where I try to change color on a instanced item using registerInstancedBuffer on source mesh and instancedBuffers.color on the instance.

There are no errors, and once I apply the mesh disappears… Any clue why this happens ? I do use some optimization and the engine runs offscreencanvas. And I am unable to reproduce the error on playground.

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/2/72e41411088957f8726296f9e58d78553f667eca.jpeg)

---

<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 30, 2022, 3:11pm UTC](https://forum.babylonjs.com/t/disappearing-mesh-material-on-registerinstancedbuffer-and-instancedbuffers/30868/2 "2022-05-30T15:11:01Z")

</div>

You should use instanceColor instead to not conflict with the “color” attribute used for vertex colors

---

<div class="post-metadata">

**Author:** ![webgrid](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/webgrid/32/24940_2.png) [@webgrid](https://forum.babylonjs.com/u/webgrid)\
**Post date:** [May 30, 2022, 3:55pm UTC](https://forum.babylonjs.com/t/disappearing-mesh-material-on-registerinstancedbuffer-and-instancedbuffers/30868/3 "2022-05-30T15:55:17Z")

</div>

I found out this about instancedBuffers and colors.

1. Create mesh and instances first.
2. Wait one second by using SetTimeout
3. Register instancedBuffers and set instanceColor
4. Meshes disappears.
5. Remove Timeout for one second and it works as expected.

You can see this playground example: [Babylon.js Playground](https://playground.babylonjs.com/#38121D)

Is this normal behavior ?

---

<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 30, 2022, 4:56pm UTC](https://forum.babylonjs.com/t/disappearing-mesh-material-on-registerinstancedbuffer-and-instancedbuffers/30868/4 "2022-05-30T16:56:12Z")

</div>

Seems to be a weird bug, I ll look into it ASAP.

---

<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 30, 2022, 4:56pm UTC](https://forum.babylonjs.com/t/disappearing-mesh-material-on-registerinstancedbuffer-and-instancedbuffers/30868/5 "2022-05-30T16:56:15Z")

</div>



---

<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 30, 2022, 9:29pm UTC](https://forum.babylonjs.com/t/disappearing-mesh-material-on-registerinstancedbuffer-and-instancedbuffers/30868/6 "2022-05-30T21:29:37Z")

</div>

Will be fixed by [Fix registerInstancedBuffer after Mesh creation by sebavan · Pull Request #12609 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/pull/12609)

---

<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 30, 2022, 9:29pm UTC](https://forum.babylonjs.com/t/disappearing-mesh-material-on-registerinstancedbuffer-and-instancedbuffers/30868/7 "2022-05-30T21:29:40Z")

</div>


