3D Object file format..

Started by
9 comments, last by elFarto 14 years, 8 months ago
Hey all, im heaving a hard to time to pick the right object format for OpenGL.. X, 3DS, Obj, Milkshape etc. there are soo many.. but i wanna know wich one is the best and got the most support? i aslo would like an a tutorial of a sample of how to load it.. thanks..
Rakion Hacks, Downloads, videos and more!http://gplaces.net/spec/rakion.php
Advertisement
hey.. unfortunately there is no native opengl support for any model format.. so any format you pick will require you to either use a third party library or you need to right your own loader.
Obj is pretty simple and there are a few loaders online, but it only supports basic features. X is not a great format imo, even MS seem to have abandoned it. I also was looking for a good format so that i could use models created in Maya, but I couldn't find anything that pleased me, and eventually ended up making my own format/importer/exporter..
So out of my lack of success, I wish you luck and hope you find things I didn't.
yosh! thanks for the info dude..
i guess i gonna use the milkshape file formats cuz i seen it supported most by some tutorials i found online.. ill just have to get an exported to 3dmax for that format..
good luck to me xD
Rakion Hacks, Downloads, videos and more!http://gplaces.net/spec/rakion.php
What about collada? I went through the spec and it seems to cover just about everything. I plan to use it myself. There are also plugins to import/export to/from Maya and 3D Studio.

http://www.khronos.org/collada/
I started wish the .obj format, It's ridiculously easy to create your own loader for it.
Hello,
of those who's you mentioned, the strongest is MilkShape file format, I personally use it too.
Why? - It supports skinning mesh animations (with vertex weight), mesh groups, material parameters and so on...
Also Milkshape supports many other file formats, which allows you to model and animate your objects in other software (like 3dsmax or Maya).
----My dev blog: http://slypot.com/blog
I also agree, obj is ridicolous simple to write own loader for. For static geometry and simple demos it is just fine. It is also trivial to extend it to support own objects such as cameras for example, there is also built-in support for user objects (with 'o' command), but it isn't difficult to add custom commands too, which seems to be quite common thing to do.

It is done to be written by hand, that is reason why it is so easy to work with it. But for same reason, it is not so usefull in production code since there are no forward specs for number of vertices, faces and so on - also there is overhead in parsing it. Adding more advanced features like skinned meshes is probably quite messy, so .obj format is not used so much for animated objects.

Another great and quite used format is lightwave's .lwo format, which is binary chunk-based format, written for fast loading which also has support for many more features than .obj, inclusive skinned meshes and such. It is alwo well docimented and there are lots of code online you can sue.

I found .X to be really great format. It supports skinned meseshes, curves and kitchen sinks. It commes in both binary and text flavour. It is also created with (user) extensibility in mind, so there is well-thaught and documented support for adding custom funcionality.

One of reasons to its un-popularity in past was its implementation. Microsoft shipped a library to read/write .X files only with DirectX, which is ugly written win32 dependent library. So nobody but directx developers really used this format. However it is open format and it is totally possible to write loader/writer for any API, OpenGL included. I think there was some attempt too, google around, there might be some open source library for .X files too.

Another reason to its impopularity is political, due to microsofts popularity of time, .X like everything else microsofts, enjoyed same bottom level popularity in some people minds.

Reason why microsoft seems to abandon the .X is probably due to it's structure - it is not XML. These days everything should be XML, especially if it is going to work with DNA. I am not sure about this, but I guess this is the reason. This is quite bad decision, but MS tried to kill COM and other stuff in flavour of .NET so I am not surprised it they wish to kill .X in favour of something XML.

You can read more about .X: http://local.wasp.uwa.edu.au/~pbourke/dataformats/directx/ or just use google, there are tons of references about it.

If you are starting out I suggest .obj to start with and move on to something better once you start playing with skinned meshes and animation.

If you prefer XML, Collada, W3D or VRML might be something to look at.
Assimp loads them all.

For simple static meshes, .obj is actually fine. For more complex scenes, Direct3D .x files or Collada .dae files are better. Both support skinning and animation, which you usually need in a game. .3ds is fine for static models, as well - it's not read easily, but there's a lot of programs out there which can output .3ds files.
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.
I would personally either choose the ms3d, .obj, or .blend formats. Making an obj reader is INCREDIBLY simple, since it's a text based file format. the ms3d format is fairly common, and is created from a great 3d editor. Also, nehe.gamedev.net has some ms3d loading code (lesson 31). As others have said, it's a good format. Finally, i choose the .blend format because it's the native file format for the Blender editor, which is almost as good as milkshape (maybe as good), and it's FREE. So, blender is good if you're on a budget. And why waste so much money for an editor when you can get one almost as good for free (it's only a 30 day trial period that's free)?

So, happy coding! the format that I've used is the .obj format because it's simple to use and very widely known.
opengl itself has nothing to do with the file format. you can use anyone or something of yourself.

i'd like to use obj files, for the reason that obj is a text file, so i can open the file to check what's inside for quick debugging.

the difficulty of using an obj file is that the file reader is more complicated than a binary file reader.

This topic is closed to new replies.

Advertisement