I actually found this question, but it says material.color
doesn't exist. I need to know how to change the colors of the various faces of a cube I'm drawing:
var newCube = new THREE.Mesh(new three.CubeGeometry(size, size, size), new three.MeshNormalMaterial({ vertexColors: three.FaceColors }));
Here is how you set and change the colors of a cube's faces:
If
geometry.faces[i].color
is changed after the geometry has been rendered, you must setgeometry.colorsNeedUpdate = true
. ( This is not required forcanvasRenderer
. )three.js r.84
Here is a fiddle for people who end up here and want to see this code working.
I made a box and tied 3 colors to the faces:
The face colors are changed in the
animate
loop.