Jump to content
  • Advertisement
Sign in to follow this  
Giallanon

OpenGL [SOLVED] X file and animation without using ID3DXAnimationController

This topic is 3735 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need a little help. What I'm trying to do is to animate x model without using ID3DXAnimationController. I managed to create a working application that can load and animate the notorius tiny.x, breokentiny.x and some other x files I found on the web, but now I've found a model that I can't animate correctly. When I load this model with MView.exe, the animation is correct so I'm sure the model is not corrupted. When I load it in my application, I can see the correct animation but hands, foots and legs are not positioned right..they stay at origin. I think I'm missing a trasnformation somewhere... I'm looking for a working code that can show me what I'm missing. I've search with google too see if there exist an opengl application (so that I'm sure it wont use DX to animate the model) that can handle x files but I've had no luck. Can you point me to some source code ? PS: I've looked at GameDev.net -- Loading and displaying .X files without DirectX It was helpfull but it does not work [Edited by - Giallanon on June 30, 2008 3:27:43 PM]

Share this post


Link to post
Share on other sites
Advertisement
probably you're not using correctly the bone hyerarchy. I don't know the structure of the other models but WHP the one you're using now is made by several meshes (body, foots, hands and legs).

I think you're using the same basic world matrix for every mesh.. you should multiply every bone matrix with the parent's one, this should do correct results
( transformedMatrix = boneMatrix * parentMatrix ).

Hope this helps :)

Share this post


Link to post
Share on other sites
thank you for reply.
I think I'm using the right bone hierarchy because I can render many x model correctly.
Even the model I can't render right, If I "disable" animation and render it with the default pose, it comes out very well.
As I put in the keyframes, some part of the mesh goes to the origin.
I've to investigate further to see why they don't get translated to the right position

Share this post


Link to post
Share on other sites
The fact that you can render many x models means nothing, they are probably made of ONLY ONE mesh, so the hierarchy is really simple.

Infact, if you disable the animation, you get the so called "bind pose", with every mesh placed at its origin == correctly placed.

During the animation the meshes are probably translated to the origin using an identity matrix.

Try posting some of your code :)

Share this post


Link to post
Share on other sites
The model I can't animate, is made of only 1 mesh.
Anyway, I've tried with a model made of 2 meshes and I found I can render and animate it the right way...

I think the model I can't render is a sorta of special case but I can't figure how to fix.

If someone wanna try and see the model, here's the link to download TheModel.zip


Share this post


Link to post
Share on other sites
FYI - I couldn't get any of 3 different viewers to load it correctly.

It's definitely a different kind of file with a header of bzip rather than txt or bin.

If you can load it, can you save it in text format? It would be easier (i.e., not impossible) to examine.

Share this post


Link to post
Share on other sites
After days of tests, I've solved the issue with the "strange" model.

The problem was that the x-file stored 60 keyframes with rotation information, but only 1 keyframe with translation information.
So the first keyframe used the right translation information, but the others 59 translated to (0,0,0), that's why foot, legs and hands were always rendered at origin.

So I've learn that if a rotation/translation/scaling information is missing for a keyframe, it means that you've to use the last good rotation/translation/scaling.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!