Handmade Network»Forums
Pete
22 posts
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
Michael Fairley
2 posts
None
Looking for a nudge in the right direction (3D meshes and fileformats)
OBJ is fairly simple to parse and is supported by almost all 3d tools.
Pete
22 posts
Looking for a nudge in the right direction (3D meshes and fileformats)
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.
Bill Strong
50 posts
Looking for a nudge in the right direction (3D meshes and fileformats)
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.
498 posts
Looking for a nudge in the right direction (3D meshes and fileformats)
There is also the interquake model format: http://sauerbraten.org/iqm/

Andrew Bromage
183 posts / 1 project
Research engineer, resident maths nerd (Erdős number 3).
Looking for a nudge in the right direction (3D meshes and fileformats)
As a non-answer: Do not try to parse COLLADA yourself. In fact, don't use COLLADA unless you have to.
Pete
22 posts
Looking for a nudge in the right direction (3D meshes and fileformats)
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?
Mārtiņš Možeiko
2237 posts / 1 project
Looking for a nudge in the right direction (3D meshes and fileformats)
Edited by Mārtiņš Možeiko on
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.
Ben Visness
91 posts / 2 projects
HMN admin, Handmade Math contributor, high school robotics mentor/enthusiast, web developer, etc.
Looking for a nudge in the right direction (3D meshes and fileformats)
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. :)
Pete
22 posts
Looking for a nudge in the right direction (3D meshes and fileformats)
Thanks, Wavefront .OBJ and PLY formats looks like the easiest ones to get started with.