Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Which Import Format/Exporter is Most Supported? #580

Closed
zz85 opened this Issue Sep 25, 2011 · 13 comments

Comments

5 participants
Contributor

zz85 commented Sep 25, 2011

It seems like Three.js now has several exporters/import formats like obj, blender, collada, utf8. Right now I only have blender installed, but I not sure which I should use.

May I know which format current is the most recommended/supported (with perhaps the most features) for using with three.js?

Thanks again!

Contributor

alteredq commented Sep 25, 2011

Most used and up to date are Blender exporter and OBJ converter (almost all models in examples passed through one of these).

Collada is big hairy format, loader is very new, not sure how many features are implemented so far, or how robust the code is (there is only single example using it).

UTF8 is very experimental, compression is very good, but converter is currently quite fragile: models need to be just right for converter to work at all (single material, not more than 64K vertices, normals and UVs must be defined for every vertex, UVs must be from 0 to 1, scale and offset must be copied manually). Some things are already fixed in original repo, but need to be ported to three.js.

Max exporter should work, but it has less features than Blender / OBJ pipeline and produces somehow larger files.

FBX converter produces obsolete JSON format and anyways has only very small part of features implemented (FBX is almost as big hairy mess as Collada).

In summary: OBJ is probably best bet if you just need to quickly get in existing static geometry / morphs (almost everything can export to OBJ), Blender if you mess up with stuff yourself and want to have direct pipeline from 3d editor to three.js, UTF8 if you need to squeeze a size for large static meshes (and are willing to clean them before), Collada if you need skinning (currently it'll be baked into morphs).

Contributor

zz85 commented Sep 26, 2011

thanks for detailed reply as usual (and probably a good write up for FAQ) @alteredq!

let's say if i were to model a piano with 88 keys in blender, would the blender or obj exporter keeps its object graph, so individual keys can be animated procedurally in javascript?

Contributor

alteredq commented Sep 26, 2011

Hmmm, there is no support for hierarchies in OBJ format or Blender exporter.

Blender can export scene format, but exported scene has just one level deep hierarchy (and problems with some rotations if they are not "baked" into objects).

You can try to export piano as scene from Blender to see if it would work (probably would mess with pivots, unless you create key geometry with center of rotation already at proper place).

Here are examples loading scenes:

http://mrdoob.github.com/three.js/examples/webgl_scene_test.html

http://mrdoob.github.com/three.js/examples/webgl_scene_test_blender.html

Collada loader does skeletal animations, so I think it may support also visible hierarchies. Again, you'll need to try with your model to see if it works.

If these fail, you would need to wire up proper hierarchy yourself from separate models manually in the application (maybe you could still use at least something from Blender exported scene).

Contributor

zz85 commented Sep 27, 2011

Thanks, I guess I need to start modelling in Blender and start messing around with the exports :)

@zz85 zz85 closed this Sep 27, 2011

I tried to use convert_obj_three.py with binary option but it only produce .js file without bin file. I read that it shud produce two file bin and .js. Can somebody tell me what happen?

Contributor

alteredq commented Mar 22, 2012

Any error dumps in the console?

This code wasn't touched in quite a while. I just tested it and it still seems to work ok.

Maybe some trouble with your Python installation or your model?

Python should be version 2.X (not 3.X).

The console doesn't show any error.

I use python v2.7.2 and blender 2.57.

Yeah, maybe the trouble from my model. Would you send me the model that you just tested?

Contributor

alteredq commented Mar 22, 2012

You can try some model from the examples, for example this one:

https://github.com/mrdoob/three.js/tree/master/examples/obj/female02

I already try with the model from the examples. but still it wouldn't produce .bin file. Here is my terminal output.

shaiful$ python convert_obj_three.py -i female02.obj -o femalebin.js [-t binary] [-b] [-e]
Converting [female02.obj] into [femalebin.js] ...
3274 vertices, 6233 faces, 6 materials
shaiful$ 

Is it something to do with my command line?

Contributor

alteredq commented Mar 23, 2012

Should be like this:

python convert_obj_three.py -i female02.obj -o Female02_bin.js -t binary

Square brackets are just convention to show parameter is optional, they shouldn't go into the command line.

Oh! okay, its working now. Silly me. Sorry to waste you guys time. Thank you so much. :)

Hi i am new to python, can anyone please help me in how to use convert_obj_three.py file for converting objects to bin files.
I have already installed python 3.4.1, going through many tutorials about python but couldn't find what i looking for.

Collaborator

WestLangley commented Aug 7, 2014

As stated in the guidelines, help requests should be directed to stackoverflow. This board is for bugs and feature requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment