handmade.network » Forums » Looking for a nudge in the right direction (3D meshes and fileformats)
SuPete
Pete
15 posts
#7737 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 10 months ago

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

{;};
m12y
Michael Fairley
2 posts

None

#7738 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 10 months ago

OBJ is fairly simple to parse and is supported by almost all 3d tools.

None
SuPete
Pete
15 posts
#7739 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 10 months ago

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.

{;};
BillDStrong
Bill Strong
51 posts
#7750 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 10 months ago

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.
ratchetfreak
446 posts
#7751 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 10 months ago

There is also the interquake model format: http://sauerbraten.org/iqm/

Pseudonym
Andrew Bromage
184 posts / 1 project

Research engineer, resident maths nerd (Erdős number 3).

#7752 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 10 months ago

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

sub f{($f)[email protected]_;print"$f(q{$f});";}f(q{sub f{($f)[email protected]_;print"$f(q{$f});";}f});
SuPete
Pete
15 posts
#7760 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 9 months ago

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?

{;};
mmozeiko
Mārtiņš Možeiko
1923 posts / 1 project
#7761 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 9 months ago Edited by Mārtiņš Možeiko on July 27, 2016, 10:47 p.m.

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.
[email protected]
Ben Visness
28 posts

HMN technical staff, Handmade Math contributor, web developer, etc.

#7764 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 9 months ago

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. :)
SuPete
Pete
15 posts
#7789 Looking for a nudge in the right direction (3D meshes and fileformats)
2 years, 9 months ago

Thanks, Wavefront .OBJ and PLY formats looks like the easiest ones to get started with.

{;};