• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Interpreting animation data from an mdl file

Status
Not open for further replies.
Level 17
Joined
Jul 17, 2011
Messages
1,863
ive been messing around with model rendering and so far everything went well until i got to the animation part. i was looking at the mdl of a certain model and concluded that part of its animation data is this stuff
Bone "Bone_Pelvis" {
ObjectId 2,
Parent 22,
Rotation 24 {
Hermite,
133: { 0, 0, 0.149816, 0.988714 },
InTan { 0, 0, 0.187143, 0.982333 },
OutTan { 0, 0, 0.187143, 0.982333 },
134: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.147492, 0.989063 },
OutTan { 0, 0, 0.147492, 0.989063 },
1633: { 0, 0, 0.149816, 0.988714 },
InTan { 0, 0, 0.15059, 0.988596 },
OutTan { 0, 0, 0.15059, 0.988596 },
1800: { 0, 0, 0.149816, 0.988714 },
InTan { 0, 0, 0.15059, 0.988596 },
OutTan { 0, 0, 0.15059, 0.988596 },
1800: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.147492, 0.989063 },
OutTan { 0, 0, 0.147492, 0.989063 },
4467: { 0, 0, 0.149816, 0.988714 },
InTan { 0, 0, 0.15059, 0.988596 },
OutTan { 0, 0, 0.15059, 0.988596 },
4633: { 0, 0, 0.148269, 0.988947 },
InTan { 0, 0, 0.14827, 0.988947 },
OutTan { 0, 0, 0.14827, 0.988947 },
14133: { 0, 0, 0.149816, 0.988714 },
InTan { 0, 0, 0.15059, 0.988596 },
OutTan { 0, 0, 0.15059, 0.988596 },
14134: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.14788, 0.989005 },
OutTan { 0, 0, 0.14788, 0.989005 },
14567: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
17467: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.14788, 0.989005 },
OutTan { 0, 0, 0.14788, 0.989005 },
18133: { 0, 0, 0.149816, 0.988714 },
InTan { 0, 0, 0.15059, 0.988596 },
OutTan { 0, 0, 0.15059, 0.988596 },
18300: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
20167: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
23200: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
24333: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
25467: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
27667: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
183133: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.184835, 0.98277 },
OutTan { 0, 0, 0.184835, 0.98277 },
184833: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
186600: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
191333: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
192233: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
193133: { 0, 0, 0.148267, 0.988947 },
InTan { 0, 0, 0.148267, 0.988947 },
OutTan { 0, 0, 0.148267, 0.988947 },
}
GeosetId 0,
GeosetAnimId None,
}


so im curious about a few of these things here:

a. are the numbers before the brackets indicators of the time since the start of the animation?

b. what are the numbers inside the brackets for

c. what is intan and outtan for and what are the numbers inside of those brackets for

i figured these numbers translate the vertices attached to "Bone_Pelvis" but why is there a set of 4 numbers inside the brackets

it would be great if u could link me to some tutorials about this stuff i want to know how the animation is read from this file and applied to the model to make it "move"
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
The numbers outside of the brackets are the keyframe values.
They are not strictly the time since the beginning of the animation, since WC3 holds all the animation sequences in one long timeline.
You can see the start/end times of the sequences from the sequences chunk.
For example, in the data you posted, I imagine the first animation (stand?) is from 133 to 1633.

The values inside the brackets are not vertices, but rather transformation data that is applied to all the vertices that this bone, "Bone_Pelvis" affects.
You can see that this specific data is used for rotation, because it is in a "Rotation" block.

Each rotation is made of 4 values, because rotations in WC3 are done with quaternions, which are 4D vectors.

This specific rotation block is using hermite interpolation.
Interpolation means that you have two known end points, and you can calculate an estimated value in between them. Interpolation is used to create smooth animations even though you only store very few keyframes.
WC3 has three interpolation types - linear, bezier and hermite (there is also the "none" option to disable interpolation).
Bezier and hermite interpolations work on curves, and the in/out tangents tell how to calculate those curves.

This is a very math-y subject, so I suggest you to google it if you want to know more.
 
Status
Not open for further replies.
Top