How to easily set some vertices(faces) color on geometry with texture set?

How to easily set some vertices(faces) color on geometry with texture already set? I have tried set both map: texture and vertexColors: THREE.FaceColors for MeshBasicMaterial. but after that the texture seems not display anymore, all mesh turn to black. Is it possible to modify shader code to check if vetex color is set uv values should be ignore?

Have a look at the following fiddle which combines a diffuse map with face colors:

https://jsfiddle.net/h3a0mt5z/

1 Like

Thank! but the example’s color is add to texture’s colors. how to make some face use texture uv but other face just set by color? BTW, It seems BufferGeometry’s .faces always be “undefined”, that’s correct?

You can use multiple materials applied to a single geometry to achieve this. I’ve extended the example to show the approach: https://jsfiddle.net/2suycwez/

BufferGeometry works different than Geometry. I suggest you read the docs and study the basic examples in order to get familiar with this class.

https://threejs.org/docs/index.html#api/core/BufferGeometry
https://threejs.org/examples/?q=buffergeometry

2 Likes