How to deal with unknown file animations

Skeletons, animations, shaders, texturing, converting, fixing and anything else related to read game models
Cuber456
Posts: 9
Joined: Fri Dec 26, 2014 4:46 am

How to deal with unknown file animations

Post by Cuber456 »

This is kind of a continuation of my previous thread but for model animations. I now want to try to play animations inside my model viewer.

For models inside Virtue's Last Reward, I understand how to render points, render triangles between said points and texture said triangles. I know this might be a bit of an open ended question to ask but how do animations work?

This is what I do know:
  • There are two types of model files that VLR uses. One is called BM and the other is called BSM. Both files contain data such as points, triangles, how to texture said triangles and what texture to use (all of which I can grab and render). What really distinguishes BSM from BM files is that BSM makes string references to bones of a model. I assume they have something to do with animations.
  • There is another file type called MOTION. Unless I am crazy, they should somehow store the data to run/play animations.

Below is a sample BSM file and a sample MOTION file for Phi. I tried to find the smallest files since those are easier to understand.
Link

In terms of looking through those files in a hex editor, the bone strings in the BSM file begin after about 0x640. For the MOTION file, everything in it is a mystery. I've tried rendering various parts of these files as points in hopes that maybe they would display bones or something but I don't really get anything sensical. Any help/advice that could be offered would be of big help.

Thanks.
TGE
Posts: 38
Joined: Sat Dec 20, 2014 5:14 pm

Re: How to deal with unknown file animations

Post by TGE »

Bones are often represented in matrices, which can either be 4x4 or 4x3 (anything else is odd)
Those local bone matrices are then often transformed by their parent bone matrix.
As for animations, afaik they usually store the changed matrix of the bone so multiplying the bind pose matrix with the animated matrix results in the animated position or something like that. They then also have framerates and keyframe data in it.