Hi,
I’m trying to correct my use of the deprecated method MeshFaceMaterial. But in vain, I know there’s many topics on this post but my tries were all failures!
thx you for your help and time!
So, tried to create a plan and for each face create a colored material to bind on it :
var geometry = new THREE.PlaneGeometry(300, 150, 5, 3);
var materials = [];
var green=0;
var lenght = geometry.faces.length / 2;
for (var y = 0; y < lenght; ++y) {
var j = 2 * y;
var colorname = "rgb(200" + green + " ,40)"
var colorvar = new THREE.Color(colorname);
var material = new THREE.MeshBasicMaterial({ color: colorvar, side: THREE.DoubleSide });
materials.push(material);
geometry.faces[indexvertex].materialIndex = y;
geometry.faces[indexvertex + 1].materialIndex = y;
green += 15;
}
If i do
var multiMaterial = new THREE.MeshFaceMaterial(materials);
var mesh=new THREE.Mesh(geometry, multiMaterial));
It works but i 've got the warning which saying that MeshFaceMaterial is deprecated!
So after few post readings
I’ve tryed
var multiMaterial = new THREE.MeshBasicMaterial(materials);
var mesh=new THREE.Mesh(geometry, multiMaterial));
So i don’t have the warning anymore but now everything is white and i have those warnings…
THREE.MeshBasicMaterial: ‘10’ is not a property of this material. for each faces
any idea
Thank you again