2

I'm working on a project using three.js. I have a simple model (the standard teapot) with a simple material I exported from 3DS Max with the obj exporter.

I can load the model just fine with OBJLoader, it shows up without any issue, but when I try to load the relative MTL file to get the material and the textures, I just get a white color.

I pretty much copy-pasted the code from the OBJ-MTL import example (the one with the textured man), and I also tried other approaches (traversing the Object3D to get to the mesh to manually apply the material for example).

This is the setup:

 var mtlLoader = new THREE.MTLLoader();
    mtlLoader.setMaterialOptions( {side: THREE.DoubleSide} );
    mtlLoader.load('moonpot.mtl', function (materials) {
        materials.preload();
        console.log(materials.materialsInfo);
        var objLoader = new THREE.OBJLoader();
        objLoader.setMaterials(materials);
        objLoader.load('moonpot.obj', function (object) {
            scene.add(object);
        });

enter image description here

I did not set the path to the resources because they're in the root folder (and setting it didn't change anything anyway). I am am exporting from 3DS Max, could it be an incompatibility? I set the material to Phong from the material editor, because I know that three.js has a Phong material, but I also tried the default option (Blinn) and it doesn't work. I logged the content of materials, and it seems to be filled correclty with the data from the file.

gman
  • 100,619
  • 31
  • 269
  • 393
Paul
  • 473
  • 6
  • 19

0 Answers0