The answers at stackoverflow are too old. BoxGeometry
is now of type BufferGeometry
. The following post provides some background information about that topic: THREE.Geometry will be removed from core with r125
BufferGeometry
has no concept of faces, only vertex data managed as buffer attributes. The following example shows how you can work with a color buffer attribute in order to add vertex colors.
https://threejs.org/examples/webgl_geometry_colors
Notice that for unique face colors, each face requires its own set of vertices (meaning vertices can’t be shared across faces). This works only with so called “non-indexed” geometries. You can convert any indexed geometry to a non-indexed via BufferGeometry.toNonIndexed(). You definitely need this method in context of BoxGeometry
since this particular geometry is indexed.