I have successfully imported a model of a soccer ball (truncated icosahedron) from Blender using the JSON loader. My goal is to change the colors of individual faces upon clicking, but I'm struggling to do so. While I can change the color of the entire model, I am unable to target specific faces. Upon further investigation, I discovered that the colors are correctly assigned to soccerball.geometry.faces[i], but the new face colors are not being displayed.
Despite exploring various solutions proposed in similar threads such as using different materials, dirtyColors, dynamic, colorsNeedUpdate, etc., none of them have resolved my issue.
This is how I import the model:
var loader = new THREE.JSONLoader();
var onGeometry = function(geom) {
soccer = new THREE.Mesh(geom, new THREE.MeshLambertMaterial());
soccer.position.set(0, 0, 0);
soccer.scale.set(2, 2, 2);
soccer.geometry.dynamic = true;
soccer.geometry.dirty = true;
soccer.overdraw = true;
objects.push(soccer);
scene.add(soccer);
};
loader.load("models/model.js", onGeometry);
Any assistance would be greatly appreciated. Thank you in advance.