No materials after converting OBJ to JSON with obj2three.js

I have a .obj file and mtl.file. And I converted them to json format with obj2three.js (The file is three.js provided,three.js-master\utils\converters\obj2three.js).
After execute obj2three.js with node, the json file is created.
I load the json file with ObjectLoader , but , the material can’t be displayed ,why?

My js code:

var jsonLoader = new THREE.ObjectLoader();
jsonLoader.load( "/public/img/server3D/obj_mtl/_server.json", function( geometry ) {
    scene.add( geometry );

Actual Result: It has no color , , ,

Can you please share the JSON file and the OBJ/MTL files in this thread?

BTW: Have you added any lights to your scene?

@ Mugen87
Yes , I added lights.
but when load Json file and obj/mtl files, I didn’t modify the lights, and the display results are different.

Json file:serverbox.json (905.5 KB)
ObjectLoad Result:

Obj/Mtl File:serverbox.mtl (205 Bytes)
serverbox.obj (350.0 KB)

THREE.MTLLoader+THREE.OBJLoader Result:

Why can’t display the material with loading Json File

Okay, the problem is that obj2three does not support MTL files. Hence, I suggest the following workaround:

  • Rename the OBJ-File to model.obj.
  • Rename the MTL-File to materials.mtl.
  • Create a zip file containing both files.
  • Load the archive with the editor (via Drag’n’Drop).
  • Select the loaded object and then click on File -> Export Object.
1 Like

Thank you very much~ :grinning:, The materials can be displayed now .
And I have an another question.
My obj and mtl also have png file to display on the 3d model,and I created a zip file containing obj, mtl, png format files.
But png can’t be displayed, there will be some errors in the browser.

Do you have a good solution?

Can you please share the PNG?

OK , there are 2 png files

<a class="

It seems this use case is currently not supported by the editor. I suggest the following workaround:

Try to export your assets directly to glTF or convert them via obj2gltf. glTF is the recommended 3D format of three.js. You might want to use it directly instead to convert to JSON.


Thanks for your advice,
But after I converted obj to gltf, I still can’t display it in the browser…:sob:

Does it work if you display the glTF with one of the following viewers?

Yes,the gltf can be displayed in

Please refer my code and the error in browser:
var gltfLoader = new THREE.GLTFLoader();
gltfLoader.load(’/public/img/server3D/obj_mtl/server5.gltf’, (geometry) => {

I refered Troubleshooting Loading JSON Model - #5 by calebcarithers , and modified my code:
scene.add(geometry); → scene.add(geometry.scene);
And the issue was resolved.
Now the gltf file can be displayed well.
Thanks for your help~~~!!:hugs::hugs:

1 Like


I was curious if you see a way to do this operation without the editor when you have multiple files?

I have one obj file and it has 3 mtl files
And also mtl file content is JSON format
Mtl file has texture file but it is not displayed
“texture” “http://localhost/assets/textures/my.mtl
What am I gonna do?

This link does not work.

I don’t think that’s true. MTL files are not in JSON format.

Can you please share the entire file?

I am going to display that object in my website
So I built html, but it doesn’t work

Just for reference, a MTL file has to look like so:

JSON content is definitely incorrect and probably indicates a buggy MTL exporter.