#### Archived

This topic is now archived and is closed to further replies.

# XFile help...

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

## Recommended Posts

Hello, Can enyone please help me. I''m trying to findout what the data in an x file means. In particular I''d like to understand what the animation data is. I know that the first element is the key type, the second the number of keys, followed by the key data. The key data is defined as time followed by the keys. So below is a rotation key, well three of them, the time appears to be 120,1800,and 3600 for each of the key respecitevly...what does this refer too as I have the keys in Maya at 1,15, and 30? Also there are 4 floats not three? AnimationKey { 0; 3; 120;4;-0.707107,-0.707107,0.000000,0.000000;;, 1800;4;-0.653282,-0.653281,-0.270598,-0.270598;;, 3600;4;-0.707107,-0.707107,0.000000,0.000000;;; }

##### Share on other sites
I''m not sure why.. but the key times are all just multiplied by 120.

There are 4 floats because the rotations are stored as quaternions... not euler angles.

##### Share on other sites
So does that mean that when you use the set time and say your frame rate is 30 fps for the anim, I''d have to do (30*120) * frameTime to update my anim at the correct speed?

##### Share on other sites
This may help.

http://www.xbdev.net/3dformats/x/xfileformat.php

##### Share on other sites
The docs contain information on the xfile templates that D3DX defines. It''s all in there.

I like pie.

##### Share on other sites
Sure but it just says time in the definition of the template. Not the units of time are!

##### Share on other sites
Boy, do I love animated X-files! Psyche!

Anyways, hopefully Microsoft will come out with a new mesh interface sometime in the future (maybe DX10 or DXNext, whatever they''re calling it). Hopefully it''s built around animation, kinda like how modern formats are.

##### Share on other sites
The values for time specified in the x file can be anything, it's really up to the software that is exporting the data. For instance, you are probably looking at 0 to 3600 msecs, based on a 120 FPS rate, as set by the 3D software. Maya sets it to msecs, while Truespace actually saves the frame number instead of the mseconds. Templates can be good...but in this case, the ability to do whatever you want makes it difficult for the rest of us. I couldn't find an option in Truespace to change it from exporting frames to msecs instead.

If you exported the animation at 120 fps, and it looked okay at 120 fps, you shouldn't have to convert it in your directX code, because the keys are defined for 120 fps rate. If you change it to 30 fps, it will be 4 times slower.

If you are using your own animation controller, and you advance the time of the animation in the amount of msecs passed since the last frame (in order to perform the interpolation), then this should work just fine.

If you are using the DirectX Animation Controller, which requires time advanced in seconds, you would just take the msecs passed since the last frame and divide it by 1000, then advance the animation's time with that value. Also note that when I do this, the Animation Controller still does not playback at the right speed, so you may have to adjust.

Quaternions are 4-element vectors to help determine the complex rotation of an object in 3 different axes. It reduces the 3 rotations about the x, y, & z axes to a single degree rotation about the normalized axis of the 3 where:
x, y, z, and w are defined as
x = sin(theta/2)*axis.x,
y = sin(theta/2)*axis.y,
z = sin(theta/2)*axis.z,
w = cos(theta/2);

axis is the normalized axis of rotation, and theta is the counter clockwise rotation about that axis.

Chris

[edited by - Supernat02 on January 12, 2004 8:46:01 PM]

[edited by - Supernat02 on January 12, 2004 10:32:37 PM]

##### Share on other sites
D3DXAnimationController does take time in seconds, but the AnimationSets that get loaded also acquire the animation''s ticks per second and use that in the animation math. So, no matter what granularity your modeler exports, the timing will come out right (assuming you time in seconds).

If you time in anything but seconds, you need only scale the value sent to AdvanceTime() up to seconds. Everything else will still be in sync.

I like pie.

##### Share on other sites
Where is the animation's ticks per second located? The reason I ask is that I loaded an animation I made in Truespace in MeshViewer and it is 1000 times faster than it is supposed to be, as it was in my software. That's when I looked into the file and saw frames stored as keys instead of time. Also, browsing the x file, the ticks per second aren't stored anywhere. Is this a truespace issue? The AnimationSet template exported from Truespace in my x file contains nothing but other templates for Keys and Options.

X Files are pretty vague, again the template's disadvantage strikes. I know enough about the file in general, but I would like a good reference for all of the templates available. Where did you learn about them? Do you recommend a good site?

Thanks,
Chris

[edited by - Supernat02 on January 13, 2004 2:01:14 AM]

1. 1
2. 2
frob
16
3. 3
4. 4
5. 5

• 17
• 13
• 14
• 76
• 22
• ### Forum Statistics

• Total Topics
632148
• Total Posts
3004359

×