Three.js: Where is convert_obj_three.py ?

Created on 28 Oct 2017  路  7Comments  路  Source: mrdoob/three.js

I need to convert an obj to .bin , I can't seem to find the convert_obj_three.py anywhere in the repository.. What are my options?

Question

Most helpful comment

I'd like to suggest an alternative workflow because BinaryLoader is from my point of view somewhat deprecated (it still outputs Geometry) and limited in its features.

If you don't want to load OBJ directly, try to convert your file to the standardized glTF format with this converter: https://github.com/AnalyticalGraphicsInc/obj2gltf

You can then load your file with GLTFLoader which is a much more up-to-date solution for your problem.

BTW: I think it was okay to remove the python code since the JavaScript solution is way easier to maintain. Even if this means to drop binary support. There are better alternatives like the glTF one.

All 7 comments

see 89cb329fec39cd7c570752b09352b70188cac89b

This is a converter to JSON. I need .bin, there was a specific python script that converted the obj to a .bin file..

The convert_obj_three.py that was removed in 89cb329 can produce .bin as well, via command line switch:
-t ascii|binary export ascii or binary format (ascii has more features, binary just supports vertices, faces, normals, uvs and materials)
and
- binary conversion will create two files: outfile.js (materials) outfile.bin (binary buffers)
Maybe it still runs without having to mod it? Just tested it, still works fine it seems.

What steps / commands do i need to run to convert the file?

Convert with python convert_obj_three.py -i input.obj -o output.js -t binary (or the python3 version if you don't have python2 anymore) and you should get two files output.js and output.bin.

Thank you, worked perfectly

I'd like to suggest an alternative workflow because BinaryLoader is from my point of view somewhat deprecated (it still outputs Geometry) and limited in its features.

If you don't want to load OBJ directly, try to convert your file to the standardized glTF format with this converter: https://github.com/AnalyticalGraphicsInc/obj2gltf

You can then load your file with GLTFLoader which is a much more up-to-date solution for your problem.

BTW: I think it was okay to remove the python code since the JavaScript solution is way easier to maintain. Even if this means to drop binary support. There are better alternatives like the glTF one.

Was this page helpful?
0 / 5 - 0 ratings