0

I have a problem with loading an object that I have created in 3d studio max! I export it like an .obj (and it gives me two files, .obj and .mtl). I have used OBJMTLLOADET() didn't worked, I used MTLLOADER() and OBJLOADER() and none of them worked. I used other object and they worked, I think the problem is when I export the object in 3d max.

here are the codes I used to in webgl for loading object:

var loader = new THREE.OBJLoader();
    loader.addEventListener ('load', function(event)
    {
        objModel = event.content;
        objModel.traverse(function(child)
        {
            if (child instanceof THREE.Mesh)
            {
                child.material = new THREE.MeshBasicMaterial
                ({
                    color:0xffffff, wireframe: true
                });
            }
        }); 
        objModel.position.y -80;
        scene.add(objModel);
    });
    loader.load('asteroid.obj');

Next code:

 var loader = new THREE.OBJMTLLoader();
    loader.addEventListener ('load', function(event){
        objModel = event.content;
        objModel.position.x = 80;
        objModel.position.y = -80;
        objModel.position.z = 0;
        objModel.scale.y = 1;
        objModel.scale.x = 1;
        objModel.scale.z = 1;
        scene.add(objModel);
    });
    loader.load('asteroid.obj','asteroid.mtl');

When I use other objets these codes work perfectly, but when I use my object It doesn't work!! Can someone tell me how to export an object from 3d max studio to use it in THree.js ??

NEW EDITED: Here is the download link for the object: Download .obj file

1 Answers1

1

Yes the problem is that your export file is comprised of polygons while the current implementation of OBJMTLLoader requires triangles. As a workaround, create triangles when you export using a triangulation flag that I am sure 3dsmax has.

gaitat
  • 12,449
  • 4
  • 52
  • 76