Instanced Buffer Attribute Not Working

I might be doing something silly, but could anyone point out why are these cubes colored white sandbox code? They should be a random color.

Change this:

const material = new THREE.MeshBasicMaterial();

to this:

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

and you’ll get this:

1 Like

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