I use same code on each model. chair model material working good but on another model texture not appear, it is return solid color. How can i fix it?
let txt = new THREE.TextureLoader().load(e.texture);
txt.repeat.set( e.size[0], e.size[1], e.size[2]);
txt.wrapS = THREE.RepeatWrapping;
txt.wrapT = THREE.RepeatWrapping;
new_mtl = new THREE.MeshPhongMaterial({
map: txt,
shininess: e.shininess ? e.shininess : 10
});
setMaterial(theModel, activeOption, new_mtl);
function setMaterial(parent, type, mtl) {
parent.traverse((o) => {
if (o.isMesh && o.nameID != null) {
if (o.nameID == type) {
o.material = mtl;
}
}
});
}