WANTED: 3d file formats specs

Community Forums/General Help/WANTED: 3d file formats specs

AdamStrange(Posted 2014) [#1]
I'm getting a bit narked trying to find specs for 3d formats.

specifically I would like to write a convertor to read the following:
.obj
.fbx
.mb

I found a few online that touch on the basic structure - node based, etc. But not any good ones that give clear information.

I'm ignoring things like "just run Maya and write a MEL script", as I want to be able to parse and extract what I want (not use MEL) :)

Anyone have any resources?


Yasha(Posted 2014) [#2]
I don't know anything about the other two, but .obj is a very simple file format, and Wikipedia's rundown is essentially complete (the first external link formalises it). It's literally just a text file with the values listed on each line; some of the lines work to change a state rather than add a feature, but that's all. There is no node structure, no block beginning or end lines, etc. (You could view it as the equivalent of defining a model in terms of the commands needed to build it, rather than as structured data.)


AdamStrange(Posted 2014) [#3]
Thanks Yasha. I'll let you know how I get on :)


Matty(Posted 2014) [#4]
Funny thing is even though obj is pretty simple a lot of the software I use cant seem to get it right for some models when exporting from one into another in an inconsistent fashion. There must be a few gotchas I'd imagine then.


Kryzon(Posted 2014) [#5]
Take a look at this library:
http://assimp.sourceforge.net

You can learn the formats with the source code for that or you can use it in your program directly (recommended), as it has a BlitzMax module by Peter Scheutz:
https://code.google.com/p/blitzmax-assimp/

For the FBX format in particular, the most efficient\secure way is to use the Autodesk FBX SDK:
http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775847
It does not have any bindings for BlitzMax. It has a C++ API, so you'll have to write a simple C++ wrapper file with a C style extern that you can make a module from.
Perhaps write the module as an extension to the BMax Assimp module (or at least with the same interface -- in BlitzMax, this is done with the Abstract keyword in user type methods) so that it's treated the same way back in your program without any branching.

At first you should avoid having to learn about each format since your goal is just the import\export. This will save you a lot of time and patience.


AdamStrange(Posted 2014) [#6]
assimp is a great link. I'm looking into the source as I type - Thanks for that one :)

The FBX SDK I already have, but was not of much use :(

I'll keep you posted


AdamStrange(Posted 2014) [#7]
OK, i've implemented the very basic vertex/face import of .obj models. grouping is not supported, as is anything else. But that is not really an issue. In theory I can now reverse the process and have .obj export.

Here are a couple of shots of the object imported (I've moved the parts so you can see them separately)


and here is the final object with some vertex colours


and here with a single texture applied (note the incorrect UV mapping - not to worry)