The 2024 Wheel Reinvention Jam is in 16 days. September 23-29, 2024. More info

Looking for a nudge in the right direction (3D meshes and fileformats)

Hello everyone!

I have started reading the OpenGL SuperBible and I am playing around a little bit with shader examples etc, I know 3d is a huge subject but right now I am wondering if anyone has any experience with loading models from let's say blender 3d?

What fileformats are easiest to parse for someone who have never parsed a model file at all? Also are there any good, easy to understand resources for this?

// Pete
OBJ is fairly simple to parse and is supported by almost all 3d tools.
Thanks! It actually looks easier than I first expected it to be.

It looks pretty verbose though so I guess people usually parse the .obj files and generate more compact versions to use in their apps if they are using .obj files at all?

I am thinking that I would like to convert them myself to have the beginning of the file saying "Hey, ### vertices will follow this header" and then just spam out the raw x, y, z[, w] data.
You might try Open Game Exchange Format. Read more about it at http://opengex.org/.

It can handle animation which obj lacks. It is meant to be human readable, and both the spec and source code are released under the Creative Commons 3.0 Share Alike Unported License. It has blender, maya, 3dsmax and an import template available in source code form.
There is also the interquake model format: http://sauerbraten.org/iqm/

As a non-answer: Do not try to parse COLLADA yourself. In fact, don't use COLLADA unless you have to.
Pseudonym
As a non-answer: Do not try to parse COLLADA yourself. In fact, don't use COLLADA unless you have to.


Why is it that COLLADA is such a bad format? From what I can see it is XML-based which is enough for me to stay away from it but are there other reasons?
There's glTF format from Khronos:
https://github.com/KhronosGroup/glTF
https://github.com/KhronosGroup/glTF/tree/master/specification
https://raw.githubusercontent.com...on/figures/gltfOverview-0.2.0.png

It's not intended as runtime format, but more as transmission / tool-to-tool format. It seems it is more oriented to WebGL (because of json), but for simple stuff or when experimenting you might as well load it at runtime for regular desktop GL/d3d.

Edited by Mārtiņš Možeiko on
Well, if you're looking for something *really* easy to get started, the Stanford PLY format is dead-simple to parse. Not particularly full-featured or practical for real use, but it's easy and Blender can export to it. :)
Thanks, Wavefront .OBJ and PLY formats looks like the easiest ones to get started with.