I have .obj file and .mtl file and I'm trying to render those file using THREE.JS
But obj was loaded but colors and other textures from .mlt files are not loaded.
So does anyone know what I'm doing wrong here?
Is there a chance that my material (.mtl) file is broken?
Thanks in advance.
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setPath('files/');
mtlLoader.load('interior.mtl', function(materials) {
materials.preload();
var objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materials);
objLoader.setPath('files/');
objLoader.load('interior.obj', function(object) {
object.position.y = -95;
// object.castShadow = true;
// object.receiveShadow = true;
object.traverse( function( node ) { if ( node instanceof THREE.Mesh ) { node.castShadow = true; } } );
scene.add(object);
}, onProgress, onError);
});