0

I'm new to ThreeJS, still learning. I have like an earth globe 3d object that I load into my scene, and I also have a mtl file which I load according to the documentation, but after I render the scene the globe still looks without texture. I think it only shows the geometry.

Tried loading the globe in Blender and the texture looks good in there, but in browser things aren't the same.

var mtlLoader = new THREE.MTLLoader();
mtlLoader.load('/models/Glob.mtl', function(materials) {
materials.preload();

var objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materials);
objLoader.load('/models/Glob.obj', function(object){

    scene.add(object);
    console.log(object);
});

});

I'd like to find a way to show the texture of the globe so I could move on with my project.

Chriss
  • 323
  • 1
  • 2
  • 10
  • The error is probably from your material file. Are you using any image? – hexangel616 Oct 11 '19 at 06:38
  • No, this is the content of the mtl file: newmtl wire_204204204 Ns 32 d 1 Tr 0 Tf 1 1 1 illum 2 Ka 0.8000 0.8000 0.8000 Kd 0.8000 0.8000 0.8000 Ks 0.3500 0.3500 0.3500 newmtl wire_088144225 Ns 32 d 1 Tr 0 Tf 1 1 1 illum 2 Ka 0.3451 0.5647 0.8824 Kd 0.3451 0.5647 0.8824 Ks 0.3500 0.3500 0.3500 – Chriss Oct 11 '19 at 08:03
  • The thing is that in Blender looks okay... – Chriss Oct 11 '19 at 08:04
  • yes, but Blender isn't Three.js ;) When you export your files, are all the following elements checked (see image file here https://threejsfundamentals.org/threejs/lessons/resources/images/windmill-export-options.jpg) ? – hexangel616 Oct 11 '19 at 08:06

0 Answers0