Export to .obj loses colours

Hi all,

I am evaluating three.js and its ability to export data. It appears that the demo application: https://threejs.org/editor/ loses color information completely.
What can be done about the problem? How easy it would be to fix the export to .obj format bearing in mind that I have no previous experience with 3D stuff but vast programming experience in other areas? Is there any description of the export functionality. E.g. aspects like color it doesn’t implement?
Any help would be appreciated.

Thanks,
Alex

I’d have a look at the THREE.OBJExporter source. Notably it exports an OBJ without an accompanying MTL file, so colors are not going to be there.

You could try to implement that, or use one of the other export options:

Unfortunately export to glTF also seems losing colors. At least 3D Builder opens the exported scene without them.
So, the only option which remains is to try the scene.toJSON()
Thanks for the help.

As I see scene.toJSON() produces some internal format which is incompatible with other applications. How can I import it to Blender or 3D Builder? We will need to pass the scene to 3D designers and we need to have it in some common format.

Ah, I didn’t realize you were trying to import the result into DCC tools… that’s harder. :expressionless:

  1. THREE.OBJExporter doesn’t write MTL files. It might not be too hard to implement that, i’m not sure.
  2. THREE.GLTFExporter could likely be fixed to support materials. Can you share your source scene (JSON format is fine)? But unfortunately support for importing glTF in Blender is quite limited. I’m not sure if 3D Builder can import glTF.
  3. JSON format is just for loading back into three.js, so that’s no use here unfortunately.

Those are the only three.js export options I’m aware of. I think (1) is probably the easiest, because once you have valid OBJ/MTL it can be imported almost anywhere.

1 Like