I want to use the DirectX model format in my OpenGL engine. I use Assimp to import the model files. I would like to use DirectX because the Assimp importer recognizes the different animations pretty well. If I have multiple animations in my Collada file (exported with the "Better Collada Exporter" for Blender), Assimp only recognizes one animation.
But, I have a strange problem concerning the import of DirectX model files. A video may describe it better...
This is how it looks when I export my blender file to Collada and import it via Assimp (correctly rendered):
https://www.dropbox.com/s/jvilcem4g7vjgdp/animation_collada.mp4?dl=0
This is the same blender file exported to DirectX model in my engine:
https://www.dropbox.com/s/3u6g9qmzuje5aap/animation_directx.mp4?dl=0
Somehow, I think the transformation matrices in the animation channels seem to be a bit off. It looks like they are rotated the wrong way (or on the wrong axis?)
Do you have any experience with this? I tried loading the DirectX file into open3mod model viewer, and it renders the animations perfectly.
Maybe there is some import config flag that I forgot to set? Maybe my Blender export settings are wrong? I export with:
Cheers and thanks for your help.
Nevermind, I found a solution:
Assimp needs a true DirectX model file (left-handed, y-up), so my export settings in Blender are now: Link to Blender DirectX export settings
And in my import method (c#) I do:
if(modelfile.ToLower().EndsWith(".x"))
{
model = importer.ImportFile(modelfile, PostProcessSteps.LimitBoneWeights
| PostProcessSteps.Triangulate
| PostProcessSteps.ValidateDataStructure
| PostProcessSteps.FlipWindingOrder
| PostProcessSteps.FixInFacingNormals
);
}
else
{
model = importer.ImportFile(modelfile, PostProcessSteps.LimitBoneWeights
| PostProcessSteps.Triangulate
| PostProcessSteps.ValidateDataStructure
);
}
Works flawlessly. Thanks to Zebrafish for pointing me in the right direction.