I am trying to make a BVH file out of a set of landmark position gotten out of MLKit. My problem is that currently, I'm not sure I have properly understood how BVH files are supposed to work.
I tried using this for the file specifications, however, it doesn't properly explain how to create a BVH file, whihc is to say, what exactly are the euler angles? Are they between the first ever frame and the current one or between 2 different ones?
The other problem is the formula to get said angles. My current algorithm is
for all landmark position:
u = vector representing the bone (landmark to next landmark in hierarchy)
v = vector representing previous bone in hierarchy
q = quaternion between u and v
return euler from q
However, this is not working at all. I also tried making sense of this repo but no luck either.
Edit: For clarification, MLKit produces an array of (x,y,z) positions each frame following this model: MLKit skeleton
I transform the skeleton to one that is more commonly used in humanoid animation: Generalized skeleton
So my goal is to make a BVH file after recording each nodes' positions. I know that I need to create a set of euler angles in the order they appear in each channel in the hierarchy, the question however is how to get said angles following the hierarchy. Angles are always between 2 things, so the first question is which 2 things are compared:
- Bone with parent bone?
- Bone with previous bone's position?
- Bone with it's position in the first part of the BVH (hierarchy)?
Overall, what I need is the mathematical formula that would transform my points into euler angles that follows the BVH specifiactions.