models in DirectX 10

Started by
5 comments, last by bbr125 12 years, 8 months ago
What are the most common model formats used with DirectX 10? I'm looking to use a format that would be generated by an artist using 3DS Max or other professional modeling software. How would I go about importing it into a ID3DX10Mesh?
Advertisement
Check out http://assimp.sourceforge.net/index.html for model loading.
As to what format to use: which ever one you want. Most model formats are supported by ASSIMP.
After you load the model using ASSIMP you should save the model to your own custom binary format for quick loading. This is done by all games because loading most 3d file formats takes a long time and writing your own binary format will cut load time down by many many times. I don't mean by maybe 5-10%, I mean by like 500-1000% speed increase.

Thats it in a nutshell
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

Check out http://assimp.source....net/index.html for model loading.
As to what format to use: which ever one you want. Most model formats are supported by ASSIMP.
After you load the model using ASSIMP you should save the model to your own custom binary format for quick loading. This is done by all games because loading most 3d file formats takes a long time and writing your own binary format will cut load time down by many many times. I don't mean by maybe 5-10%, I mean by like 500-1000% speed increase.

Thats it in a nutshell


Thanks, I just downloaded this program and opened an .x model in it. What would be the first step to creating my own binary format? Is there any tutorial on how to do this?
no because it depends on your needs. If you want to store a static mesh, it is pretty simple: write your vertex buffers to a file, include the texture names, index buffer and the few other pieces of into you need. There isn't a specific way to do it because it is a very simple process. Should take you less than 100 lines of code to write your loader and saver for a static mesh. The animated mesh will get a little more complicated, but I wrote an animation helper to go with ASSIMP; it saves the animation data, loads it and precalculates the bone transforms needed for animations. If you are just starting, do not tinker with animation. Start by getting the static mesh loader down. Once you are able to load/save static mesh, then move onto animation stuff.

Here is my blog post for the animation loader
http://nolimitsdesigns.com/game-design/open-asset-import-library-animation-loader/
and a follow up
http://nolimitsdesigns.com/game-design/animation-code-update/
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

no because it depends on your needs. If you want to store a static mesh, it is pretty simple: write your vertex buffers to a file, include the texture names, index buffer and the few other pieces of into you need. There isn't a specific way to do it because it is a very simple process. Should take you less than 100 lines of code to write your loader and saver for a static mesh. The animated mesh will get a little more complicated, but I wrote an animation helper to go with ASSIMP; it saves the animation data, loads it and precalculates the bone transforms needed for animations. If you are just starting, do not tinker with animation. Start by getting the static mesh loader down. Once you are able to load/save static mesh, then move onto animation stuff.

Here is my blog post for the animation loader
http://nolimitsdesig...imation-loader/
and a follow up
http://nolimitsdesig...on-code-update/


Okay. I'm just going to deal with the static mesh like you said because I'm just starting but I want to make sure I'm understanding correctly.

First I link with the assimp lib and copy the .dll into the active directory.

Then in my code something along the lines of:


Assimp::Importer importer;


const aiScene* scene = importer.ReadFile( pFile,
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType);


Then I use this aiScene* to get information about the model and choose a way I want to store it. Then I write out this information to a file on disk (my own file format that I decide).

So I can build a separate 'converter' program using ASSIMP to create a special file format that I decide. And then in future games I can just include the 'loader' code to load my custom file format.

Am I on the right track or totally off base?
That is pretty much it. To see how to extract the information from ASSIMP after you load a file, check out the file assimp_view.cpp function CreateAssetData() that has the bulk of the code for extracting the verticies, textures, and bones.
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

That is pretty much it. To see how to extract the information from ASSIMP after you load a file, check out the file assimp_view.cpp function CreateAssetData() that has the bulk of the code for extracting the verticies, textures, and bones.


Thanks I'll take a look. Seems like a lot of work involved for something which should be a very common task. :)

This topic is closed to new replies.

Advertisement