Recommended file formats and graphics libraries for importing 3D model into OpenGL/C++ project?

Simone picture Simone · Nov 28, 2012 · Viewed 10.3k times · Source

If you wanted to:

  • model an object in a 3D editor, e.g. Blender, Maya, etc
  • export the model into a data/file format
  • import the model into an project using OpenGL and C/C++

Then:

  • What file format would you recommend exporting to, i.e. in terms of simplicity, portability, and compatibility (i.e. common/popular)?
  • What graphics libraries would you recommend using to import the model into your OpenGL C/C++ project (i.e. preferably open source)?
  • Additionally, are there data/file formats that also capture animation, i.e. an "animated model" format, such that the animation could be modeled in the 3D editor and somehow invoked inside the code (e.g. accessibility to frames in the animation sequence or some other paradigm for saving/loading details related to changes over time)?

Generally speaking, I'm seeking simplicity as the priority, i.e. help to get started with combining my backgrounds in both art and computer science. I am a computer science major at UMass while at the same time, sort of a "pseudo" double-major in art by taking electives in graphic design at my university as well as classes at the Art Institute of Boston during summer/winter sessions So, in other words, I am not a complete newbie, but at the same time I don't really want options that are so overloaded with crazy advanced configurations making it too difficult to get started with a basic demonstration project; i.e. as a first step to understanding how to bridge the gap between these two worlds, e.g. creating a program featuring a 3D character that the user can interact with.

Answer

Mark Garcia picture Mark Garcia · Nov 28, 2012

COLLADA (I'm saying it with a "ah" at the end), and Assimp (ple as that).

And so, why COLLADA? Simple:

  • COLLADA is an open standard made by Khronos (Sony specifically). The beauty of an open standard format is that it's, well, a standard! You can be assured that any output of a standard-conformant product would also read correctly by another standard-conformant product. Sad to say though, some 3d modelling products aren't that particular in their measures for standards conformance for COLLADA. But still be rest assured: Blender, Maya, 3ds Max and all the other big names in 3d modelling has good support for the format.
  • COLLADA uses XML. This makes it much more simpler for you if your planning to create your own reader or writer.
  • ADDITIONAL: COLLADA is, I think, the only format that is not tied to a specific company. This is a very good thing for us, you know.
  • ADDITIONAL 2: It is known that COLLADA is slow to be parsed. That's true. But think of it: all other non-binary formats (like fbx) have also the same issues. For your needs, COLLADA should suffice.
  • ADDITIONAL 3: COLLADA supports animations!

For the importer library, I highly recommend Assimp. Why?

  • Assimp has support for any popular format you can imagine. It has a unified interface for all formats so that switching to another format is less of a pain.
  • Assimp is extensible. You can thus import your proprietary format and still not modify your code.
  • ADDITIONAL 4: Assimp is open source! Let's support open source software!