• Advertisement
Sign in to follow this  

skeletal animation-do we really need quaternions?

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

All the demos I've seen of skeletal ankiamtion use quaternions. I can't help thinking maybe we don't need them - I mean the bone joints are only ever going to be moved by about 45 degrees in any one direction hence all the complications due to the axis being rotated aren't going to be too big. Maybe I should hack a demo so as not to use quaternions and then see what happens, unless you have other idea ? cheers

Share this post


Link to post
Share on other sites
Advertisement
No one is forcing you to use quarternions... if you don't want to use them, then don't use them. I doubt posting on GDnet about it is really going to affect what everyone else does though.

John B

Share this post


Link to post
Share on other sites
unhelpful.

I just want to know if it would cause unexpected behaviour if I simply rotated each bone then render the mesh for each bone rather than build a quaternion matrix for each vertex.

Share this post


Link to post
Share on other sites
Quote:
Original post by ade-the-heat
All the demos I've seen of skeletal ankiamtion use quaternions.
I can't help thinking maybe we don't need them - I mean the bone joints are only ever going to be moved by about 45 degrees in any one direction hence all the complications due to the axis being rotated aren't going to be too big.

Maybe I should hack a demo so as not to use quaternions and then see what happens, unless you have other idea ?

cheers

I can think of bones in joints that need to move more than 45 degree's and in more than 1 direction. Think of hands, they need to move more than 45 degree's (more like 80 or even 90) and they also move (and rotate) in more than 1 direction.

Share this post


Link to post
Share on other sites
Quote:
Original post by ade-the-heat
unhelpful.

I just want to know if it would cause unexpected behaviour if I simply rotated each bone then render the mesh for each bone rather than build a quaternion matrix for each vertex.


You build either a quaternion or a matrix, not both. And you don't build a matrix or a quaternion for each vertex - that would be too slow.

Using quaternions can make the computation less heavy (if you have to interpolate, as doing a slerp using matrices can be tricky) but using matrices is definitevely possible.

skeletal animation using matrices paper on intel.com. The paper deal with optimizing on an intel processor using SSE, but also deal with DX8 shaders (they will prefer matrices instead of quaternions). The articles has a demo attached.

Regards,

Share this post


Link to post
Share on other sites
Quats do make certain things easier, but most importantly they make it very easy to slerp along the shortest path between 2 orientations (ie, between 2 keyframes). You could use axis angle if you really wanted - they'd give the same effect, though they'd be slightly more computationally heavy than quats. To be honest it's probably easiest just doing this stuff with quats, which is fairly well defined...

Share this post


Link to post
Share on other sites
Although doing the interpolation with quaternions is certainly less computation, you also have to factor in the overhead of converting to matrix form - I'm not aware of any hardware that accepts quaternions as input to the transformation pipeline. A major reason to use quaternions is that they take up less memory to store (7 floats verses 12 for a matrix) which is handy for consoles as it gives you more for your memory.

Skizz

Share this post


Link to post
Share on other sites
Quote:
Original post by Skizz
A major reason to use quaternions is that they take up less memory to store (7 floats verses 12 for a matrix) which is handy for consoles as it gives you more for your memory.
Why does a quaternion require 7 floats? Just curious as to what you mean... [Reading the later posts, I see that you were probably referring to 4 floats for the quaternion + 3 for the translation.]
Quote:
Original post by Funkymunky
you can avoid gimbal lock with quaternions
This isn't incorrect, technically speaking, in the sense that it's certainly possible to avoid gimbal lock when using quaternions. However:

a) Used incorrectly, quaternions can still lead to gimbal lock.

b) Gimbal lock can be avoided just as easily when using matrices or vectors.

[Edited by - jyk on October 17, 2006 5:21:43 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by ade-the-heat
All the demos I've seen of skeletal ankiamtion use quaternions.
I can't help thinking maybe we don't need them - I mean the bone joints are only ever going to be moved by about 45 degrees in any one direction hence all the complications due to the axis being rotated aren't going to be too big.

I don't understand your reasoning, unless it applies to Euler angles vs. quaternions/matrices. In that case, Euler angles work if you restrict rotations, but to combine rotations you would have to convert the angles to a matrix anyway.

Here are the reasons I can think of for using quaternions over matrices in animations:
  1. Less space: 7 floats vs. 12 floats
  2. Faster computation (in software)
  3. Slerp

Share this post


Link to post
Share on other sites
Quote:
Original post by Skizz
Although doing the interpolation with quaternions is certainly less computation, you also have to factor in the overhead of converting to matrix form - I'm not aware of any hardware that accepts quaternions as input to the transformation pipeline.

Any hardware that supports vertex shaders (which is most PC hardware released in the last 5 years, both the next gen consoles and the original Xbox) and even the PS2 can use quaternions for hardware skinning (the VUs are programmable to use quats just as easily as matrices). In fact, the limited number of vertex shader constants available on most hardware is a very good reason to use quaternions instead of matrices for the bone palette for skinning.
Quote:
A major reason to use quaternions is that they take up less memory to store (7 floats verses 12 for a matrix) which is handy for consoles as it gives you more for your memory.

A quat is 4 floats, you need another 3 to store translation if you need that and another to store a uniform scale if you want it. Quats compress well though so you can store them in much less space without any major loss of quality. 10:10:10:2 is a good storage format for quats, espescially where hardware has special support for it. For the translation and scale components 32 bit floats are usually overkill as well.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement