Encountering an issue with the threeJS collada loader. Upon receiving a dae model with all its textures from the backend, I parse the images (textures) and create an array of materials.
let materials = [];
textures.forEach((texture) => {
let loadedTexture = THREE.ImageUtils.loadTexture(texture.url);
let material = new THREE.MeshPhongMaterial({ map: loadedTexture });
});
https://i.sstatic.net/Xm05x.jpg
Subsequently, when loading the dae model, I attempt to update my array with materials:
colladaLoader.load(daeModelFile, (collada) => {
let model = collada.scene;
dae.traverse( ( child ) => {
if ( child instanceof THREE.Mesh ) {
child.material = materials;
}
});
mainScene.add(model);
});
However, instead of achieving this result: https://i.sstatic.net/9fB6n.jpg
I end up with this outcome: https://i.sstatic.net/Oea7A.jpg