I am faced with a challenge involving a Three.Geometry object that contains multiple vertices and faces forming a grid. My goal is to dynamically alter the color or material of a selected face.
geometry.colorsNeedUpdate = true;
geometry.faces[1].color.setHex(0xcccccc); //this doesn't work
The above code results in an unusual opacity for the new color. It seems like it's not replacing the old color entirely, but rather blending the two together. This makes it impossible to overwrite a darker color with a lighter one. How can this be fixed? I have already applied my materials:
mat = new THREE.MeshBasicMaterial({color:"white",shading: THREE.FlatShading,side: THREE.DoubleSide,vertexColors: THREE.FaceColors, needsUpdate : true});
Another approach I considered was changing the reference to another material:
geometry.faces[0].materialIndex = 1; // works only when disabled OpenGL in browser
I have also set
material.needsUpdate flag to true
and consulted the resources at https://github.com/mrdoob/three.js/wiki/Updates
However, despite these efforts, no changes are observed.