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

10,948

Solution 1

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!

Solution 2

First , here you can read about suggested model loading lbs.Lib Assimp is really good and supports many formats.For the preferred formats.Collada-I wouldn't recommend because that is XML (text) based formats which is slow to parse. Obj format is also widespread but suffers from the same problems as Collada.It is still good if you want to write your own parser as its structure is very simple.But Instead I would suggest 3Ds which is binary.It doesn't support animations though.The most popular format today which supports both static mesh and animation is FBX.You can download for free FBX SDK from Autodesk and connect it to your engine.The reason I would choose FBX is because both SDK and the format are really robust.For example ,in FBX you can embed not just geometry and animation but also scene objects as lights ,cameras etc.Autodesk docs are very nice too. Hope it helps.

Solution 3

I would reccomend using your own custom format that basically just a binary dump of the vertex buffer and index buffers used in your program. (Using d3d terms there, I know opengl has the same concepts but can't remember if they have different names).

I would then write a separate program using assimp that takes pretty much any format and writes out the file in your custom format. Then you can use collada or whatver to store your actual models in, but not have the complixity and slowness of loading that format at run time.

Share:
10,948
Simone
Author by

Simone

Updated on June 02, 2022

Comments

  • Simone
    Simone almost 2 years

    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.