Twitter  Facebook  YouTube  E-Mail  RSS
The One Man MMO Project
The story of a lone developer's quest to build an online world :: MMO programming, design, and industry commentary
Assimp Model Importer
By Robert Basler on 2021-04-02 23:07:30
Homepage: onemanmmo.com email:one at onemanmmo dot com

Back in 2012 Collada was a thing. People thought it might actually be an industry standard for 3D models. That lasted about a minute, but while that was true I adopted Collada-DOM as the 3D model format for Miranda. I wrote a nice tool to import Collada models into Miranda's internal model format. Miranda has its own format that supports compression, all the game's features, and it reads Miranda's material definitions so that it can customize the mesh data to be loaded very, very quickly.

prettydesert.jpg
[Pretty desert, courtesy of the new ModelImport]


The model importer also combines meshes and vertex arrays where it can to reduce the number of draw calls and render state updates, based on how the model is used in the game.

colladaimport.png
[ColladaImport]


That all worked fine until I wanted to add x64 support. Collada is still updated, but to say that it is a mess is a bit of an understatement. I couldn't find either a prebuilt x64 library or a way to build one myself. I can't even build the Win32 version with Visual Studio 2019. I was stuck on this problem for quite a while. What ended up breaking the standstill was that I discovered that Assimp, the Open Asset Importer Library could read FBX models and import their animations. AND IT WORKED! And it supported a whole ton of other model formats. You can preview what Assimp can do with their 3D model viewer Open3Mod. It hasn't been updated in a couple years, but still works well.

Changing my model import from Collada-DOM to Assimp actually ended up being surprisingly straightforward. First I found a good tutorial on using Assimp. Second, I realized that the tree structure that Assimp's API presents is remarkably similar to what Collada provided.

The really nice thing is that since I had a working model importer already, I could compare its output (vertices, indices, matrices) to the output of the new tool using KDiff3 to work out the bugs.

modelimport.png
[ModelImport using Assimp]


Assimp has several features I quite like. It has the ability to remove duplicate vertices and detect duplicate mesh instances. My original tool did some of that, but Assimp's vertex deduplication means my models are 40% of the size of the original models. It can also triangulate meshes for you, and present them in whatever winding order you prefer. There's a nice list of all the transformations it can do here.

The only area where I had trouble was with the orientation of models. Collada-DOM provides the orientation of the original model, so ColladaImport reoriented the models to be the way I need them. Assimp adds a matrix on the topmost node to reorient models to its output format (luckily the same as mine) but working out that detail and figuring out how to put their matrix into my existing tool was a little tricky.

If you do want to build a Win32 tool, Assimp no longer supports Win32 beyond Visual Studio 2017.

The final improvement I made was that I discovered that ColladaImport was outputting scenegraph leaf nodes with no renderable children. This happened for the camera and mesh types not supported by Miranda. ModelImport leaves these out.

New Comment

Cookie Warning

We were unable to retrieve our cookie from your web browser. If pressing F5 once to reload this page does not get rid of this message, please read this to learn more.

You will not be able to post until you resolve this problem.

Comment (You can use HTML, but please double-check web link URLs and HTML tags!)
Your Name
Homepage (optional, don't include http://)
Email (optional, but automatically spam protected so please do)
What color is the ocean? (What's this?)

  Admin Log In



[Home] [Blog] [Video] [Shop] [Press Kit] [About]
Terms Of Use & Privacy Policy