Set imported .obj as mesh and not linesegments.

I am importing a obj + mtl file (exported from blender) in my three.js project. The problem is that i get a linesegments object (buffergeometry+linesegment material) instead of a mesh. How can i solve this?

This is my code:

```
var mtlLoader= new THREE.MTLLoader();
mtlLoader.load( 
'http://localhost/planegeometryeditor/meshes/map/firstterrain.mtl', 
 function(materials) {
    materials.preload();
var objLoader= new THREE.OBJLoader();
objLoader.setMaterials(materials);
objLoader.load(
       'http://localhost/planegeometryeditor/meshes/map/firstterrain.obj', 
   function(object) { scene.add(object); }
   null, 
   null
);
 }
 );
```

Have you considered to export your model as glTF and then use GLTFLoader? glTF is in several ways a better choice than OBJ. Have a look a the following guide to learn more about the format and the respective importer/exporter for Blender.

https://threejs.org/docs/index.html#manual/en/introduction/Loading-3D-models

If you want to stick with OBJ for some reasons, ensure that no lines are defined in your file. You can recognize them like so:

v 0.000000 2.000000 0.000000
v 0.000000 0.000000 0.000000
v 2.000000 0.000000 0.000000
v 2.000000 2.000000 0.000000
# line segment 1
l 1 2
# line segment 2
l 2 3
# line segment 3
l 3 4

Hi Mugen, thank you for your reply.
I would use obj because, exporting my model from blender, i can obtain a unique mesh with differents materials instead of a group of meshes that is the behavior i prefer.
I checked my file and i discover that the last line was a linesegment as you indicated me, i deleted it and now the model is correctly rendered as mesh.
But the material assigned to this mesh is a meshpongmaterial, so the model looks a little different from that blender.

Yeah, unfortunately this is something you can’t avoid. I think you will get more predictable results by using the latest Blender version, the Principled BSDF material node and a glTF based workflow.