Hi I am trying to apply different textures with different colors to different areas in my 3D model(OBJ).
I am doing this with a material list:
materialList = [
//back
new THREE.MeshPhongMaterial({
color: 0x000000,
shininess: 5,
reflectivity: true,
side: THREE.BackSide,
normalMap: body_texture,
}),
//base
new THREE.MeshPhongMaterial({
color: 0x242323,
shininess: 5,
reflectivity: true,
normalMap: body_texture,
}),
//sleeves
new THREE.MeshPhongMaterial({
color: 0x575757,
shininess: 5,
reflectivity: true,
transparent: true,
opacity: 1,
normalMap: repeat_texture,
alphaMap: texture_loader.load('texture url'),
}),
And the assigning it to the object with the traverse function in the objLoader:
objLoader.load(
'obj url',
(object) => {
object.traverse(child => {
if (child instanceof THREE.Mesh && child.name != "Cubo") {
let geometry = child.geometry;
geometry.clearGroups();
for (let i = 0; i < materialList.length; i++) {
geometry.addGroup(0, Infinity, i);
}
child.material = materialList;
}
});
scene.add(object);
},
The problem comes when i try to use repeat on a texture to make it smaller. The alpha map on the same material shares the repeat property.
Can someone suggest me an alternative to reach my objetive?
Thank you in advance!