0
votes

I have a mesh that and have set the vertex colors as shown:

var vertColors = MyPolygonProto.polygons[iBorderCounter].polyMesh.geometry.colors;
vertColors[vertCount] = new THREE.Color(finalColor.r, finalColor.g, finalColor.b);

Where polyMesh is a mesh. I'd like to change the colors of the faces based on the geometries.

I was able to implement the technique shown here: How to change face color in Three.js

But it seems like inefficient to have to go over the same vertex multiple times when they are shared by multiple faces. A technique in which each face automatically interpolated it's color based on the color of its vertices as listed in the mesh.geometry.colors array would seem more efficient.

Does this capability exist in Three.js?

1

1 Answers

0
votes

According to the three.js documentation vertex colors can't be used this way. You have to use per-face vertex colors.

Documentation for vertex colors:

Array of vertex colors, matching number and order of vertices. Used in PointCloud and Line. Meshes use per-face-use-of-vertex colors embedded directly in faces. To signal an update in this array, Geometry.colorsNeedUpdate needs to be set to true.