When creating geometric objects in my project, I am randomly setting colors on the faces:
// Material used to create the mesh
var material = new THREE.MeshLambertMaterial({ color: 0xffffff, ambient: 0xffffff, vertexColors: THREE.FaceColors})
function addColor(geometry) {
var i = 0,
il = geometry.faces.length,
color,
r, g, b, f, fl;
for (; i < il; i += 12) {
r = Math.random(),
g = Math.random(),
b = Math.random();
f = 0,
fl = 12;
for (; f < fl; f += 1) {
geometry.faces[i + f].color.setRGB(r, g, b);
}
}
}
Although the colors are applied correctly, the new object does not seem to cast or receive shadows. Objects without modified face colors work fine with shadows.
Any suggestions on how I can add face colors while still maintaining shadows in my project?