# Instanced Buffer Attribute Not Working

**URL:** <https://discourse.threejs.org/t/instanced-buffer-attribute-not-working/67023>\
**Category:** Questions\
**Tags:** instanced-mesh\
**Created:** [June 19, 2024, 6:42am UTC](https://discourse.threejs.org/t/instanced-buffer-attribute-not-working/67023 "2024-06-19T06:42:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alforofus](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/alforofus/32/45006_2.png) [@Alforofus](https://discourse.threejs.org/u/Alforofus)\
**Post date:** [June 19, 2024, 6:42am UTC](https://discourse.threejs.org/t/instanced-buffer-attribute-not-working/67023/1 "2024-06-19T06:42:40Z")

</div>

I might be doing something silly, but could anyone point out why are these cubes colored white [sandbox code](https://codesandbox.io/p/sandbox/idmaterial-test-forked-55x2nj?file=%2Fsrc%2Findex.ts%3A67%2C44)? They should be a random color.

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [June 19, 2024, 7:32am UTC](https://discourse.threejs.org/t/instanced-buffer-attribute-not-working/67023/2 "2024-06-19T07:32:07Z")

</div>

Change this:

```javascript
const material = new THREE.MeshBasicMaterial();

```

to this:

```javascript
const material = new THREE.ShaderMaterial({
  vertexShader,
  fragmentShader
});

```

and you’ll get this:

 ![изображение](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/1/9/19839021a2c1edf5b5d584761857856265200536.png)

---

<div class="post-metadata">

**Author:** ![Alforofus](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/alforofus/32/45006_2.png) [@Alforofus](https://discourse.threejs.org/u/Alforofus)\
**Post date:** [June 19, 2024, 8:50am UTC](https://discourse.threejs.org/t/instanced-buffer-attribute-not-working/67023/3 "2024-06-19T08:50:16Z")

</div>

Would you happen to know why same example doesn’t work now after modifications. I made separate question for this if you are interested.
