# OpenGL 3D Object file format..

## Recommended Posts

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..

##### Share on other sites
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.

##### Share on other sites
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

##### Share on other sites
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.

##### Share on other sites
I started wish the .obj format, It's ridiculously easy to create your own loader for it.

##### Share on other sites
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).

##### Share on other sites
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.

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.

##### Share on other sites

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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
I've just written a .obj loader, and I have to say that it's more complicated than it looks, thanks to the .obj's multi-indexed format (separate indexes for verticies, normals and texture co-ordinates).

Regards
elFarto

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627654
• Total Posts
2978443
• ### Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 10
• 12
• 22
• 13
• 33