I load a model of tree through Object Loader in THREE.js but there is not any texture loaded with it it just a simple tree having white light on it. code is
var loader = new THREE.OBJMTLLoader();
loader.addEventListener('load', function (event) {
var object = event.content;
object.position.y = 0;
object.position.x = 500;
object.position.z = 500;
object.rotation.x = -(Math.PI / 2);
object.scale.set(5, 5, 2);
scene.add(object);
});
loader.load('obj/Palm_Tree.obj', 'obj/Palm_Tree.mtl');
What should i do load the tree texture.
The default behavior assigns the Three js material’s ‘map’ parameter as being based on the ‘map_kd’ value in the MTL file. Make sure it’s specified there.
It uses ‘loadTexture()’ rather than ‘loadCompressedTexture()’ so be aware that the default behavior doesn’t handle, say, DDS files.