Jump to content
  • Advertisement
Sign in to follow this  
Jiia

x file Nightmares Persistent

This topic is 5403 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

This is more of a warning than a cry for help. But if anyone can explain why this is the way it is, please do so. This is mainly aimed at the default MS exporter. An x file animation keyframe contains some complex matrix multiples, such as it's offset from it's parent, plus it's orientation rotation, etc. If you are dealing with a bone which has no parent (or all of it's parent's orientations are identity matrices), then you could simply say that the animation keyframes contain a [orientation * animation] transform. If you were to take the inverse of the bind pose "TransformationMatrix" (aka the matrix of the non-animated pose) for that bone and multiply it with the animation keys, you end up with a world-space transform for each key. In other words, the [inversed bind pose matrix] multiply will turn the keyframes into local transforms. Except for one part. Yep. There is one case in an entire x file hierarchy system where this is not true. It's the translation vector part of the base bone matrices. By base bone, I mean the little diamond in the center of a bip's hip. Time for an example.. This is an animation keyframe for that bone:
0.000001,0.000000,-1.000000,0.000000,
0.001450,0.999999,0.000000,0.000000,
0.999999,-0.001450,0.000001,0.000000,
0.150840,35.572189,0.000002,1.000000
Note that the bip is standing up-right. No weird rotations. See how screwed up this matrix is? It says X=-Z and Y=Y and X=Z. This is the bind pose (non-animated) transformation matrix:
0.000001,-0.068404,-0.997658,0.000000,
-0.000000,0.997658,-0.068404,0.000000,
1.000000,0.000000,0.000001,0.000000,
0.000002,38.933674,0.000010,1.000000
Notice that the top 3x3 rotation part is almost identical to the other? That's because the animation keyframe doesn't rotate much. So if you were to invert this above matrix, and multiply it with the animation key, you get something very close to an identity matrix. The point is, the animation key contains a transform that is nothing like the real rotation being applied to it in the game. You have to multiply the inverse bind pose transform to make it all right. Groovy [lol] Now the problem. See the bottom row of numbers on the animation key? The first 3 floats? 0.150840,35.572189,0.000002 - That is the translation vector. There is a problem here. Because it is already correctly orientated. It doesn't need the inverse multiply with the bind pose. That is really the way the model is orientated, and the way it will be moved in game. X=0.150840,Y=35.572189,Z=0.000002. Guess what happens when I multiply the inverse bind pose transform? Instead of fixing it (like the rotation), it messes it up. So what is the deal? DirectX plugin team just decided to make the translation part for the base bone non-relative to the orientation? Unlike every other single bone, and unlike the base bone's rotations? Sorry for bitching, and thanks for reading. Any help is appreciated. [smile] [Edited by - Jiia on October 4, 2004 3:03:22 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sorry, but I can't really help too much with the whole X file issue. I have never completely understood all of the intracacies of The "X File" (cue weirdo music), and probably never will. Hopefully, MS switches to a newer, better format before the day comes when I do. Which may not be far of, because they know .X has problems (hence, not much development with the file format itself OR any exporters).

Alas, I have good news! I have started work on DirectMesh v1.1, which will have the following new features:

- Skeletal animation (bones, instead of keyframes)
- Morph targets
- Multiple meshes in one model (aka subsets)
- Animation blending
- File compression using zLib

ETA is a little over a month, if all goes well. A little under a month, if all goes REALLY well. [smile]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!