Handmade Network»Forums
12 posts
Why isn't there a decent 3D flat file format?
Edited by novus1044 on Reason: Initial post
I wrote a parser for gltf files this weekend and found it extremely cumbersome to extract the information I needed to build the binary asset files. Instead of keeping the structure simple, aka flat, gltf creates a bunch of containers (scenes, nodes, accessors, buffer views, buffer, etc) with arrays of objects which contain references to other objects belonging to different containers. This makes it incredibly cumbersome to find out what buffer a mesh references because you need to traverse the nodes->mesh->accessor->buffer_view->buffer.

It got me wondering if there should be a simple flat file format that keeps all the information COLLADA and gltf scatter all over god's green earth into simple data records. The file would be a simple list of these records that loop for the number of meshes contained in the scene.

I know the above is very simplistic because you would need to account for much more data, animations for example, but if you have a simple layout then adding and more importantly parsing that data should be trivial.

There is also the issue of size but I would rather have a large file that is easy to manipulate than a tiny file that is a nightmare to code against.

Just a passing thought. Open to criticism/critiques.


Mārtiņš Možeiko
2562 posts / 2 projects
Why isn't there a decent 3D flat file format?
Edited by Mārtiņš Možeiko on
https://xkcd.com/927/

Each use case is different. Different software have different requirements. Sure some are more terrible, some are more reasonable. But at the end any serious 3d game/engine converts input formats to their internal optimized formats, which is optimal for them, but maybe not for others. You want input formats (3d, textures, audio) to be in easy to make/distribute/modify file formats. Runtime format can be different (and they are). So it actually does not matter what input format is.
70 posts
Professional programmer, working in the video games industry since 2012
Why isn't there a decent 3D flat file format?
I don't see how the xkcd strip is relatable here, gltf being the only standard format that claims to be a runtime format and not an interchange format; at the same time it is still bloated for most needs.

I made a gltf parser and I actually found that it is one of the most simple 3D scene formats to parse, even though it contains enough info to be imported into any 3D software without losing almost any information. But in the end, I still convert it to a flat format for a more straightforward loading process, with only the data I need.

For a simple yet complete runtime 3D file format, you could look into id's md5: http://tfc.duke.free.fr/coding/md5-specs-en.html You can probably find other simple formats in the repository of other open-source engines, each one probably having its own special needs.
Mārtiņš Možeiko
2562 posts / 2 projects
Why isn't there a decent 3D flat file format?
Edited by Mārtiņš Možeiko on
xkcd was kind of answer to your "if there should be a simple flat file format that keeps all the information COLLADA and gltf scatter all over god's green earth into simple data records" text.

Sure, there is nothing wrong wanting something simpler that works for you and implementing it. But pretty much there always will be some extra feature/thing that does not work for somebody else. And then it won't be simpler for them to use this new format.

I'm not aware of any serious game engine that uses gltf as runtime format. I don't know exact history but afaik it is just a claim from khronos (about usability as runtime format). Who for some reason decided to push into web space and decided to create json-like text/binary format for loading into webgl. I guess xml-based collada was not good for them. So now we have json based format. What's next? Yaml? Protobuf?

I am aware of md5 format. I have written mdl/md2/md3/md5 loaders for fun. Those are real runtime formats for idTech engine. But again, what works for them won't work for everybody. Thus the xkcd comic strip.

Have you seen OpenGEX from Eric Lengyel? Not a binary/runtime format, but should be very usable as intermediate import format from 3d software. Here's an comparison with collada and gltf: https://opengex.org/comparison.html