[Solved] Animations with non uniform scaling

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
Fedyakin
Halfling
Posts: 43
Joined: Thu Jul 14, 2005 6:48 pm
Contact:

[Solved] Animations with non uniform scaling

Post by Fedyakin » Sat Mar 19, 2011 2:08 am

Our artist recently created animations in which some of the bones are scaled non-uniformly during the animation. The animations when played in Ogre, were incorrect. After some research, it appears that we aren't the first to encounter the problem (http://www.ogre3d.org/forums/viewtopic.php?f=4&t=57264 and http://www.ogre3d.org/forums/viewtopic. ... tion+scale for example). The visual effects of non-uniform scaling in the animations are impressive enough that we would like to support them (and more animations like them) if possible.

To the best of my understanding, the problem arises when children of a bone with non-uniform scaling rotate. The transformation matrix in Maya will contain non-zero shear components, but this information is not exported. Even if it were, Ogre currently has no way of using it.

A solution that would work, but seems impractical would be to modify Ogre nodes to work with full matrices (as hinted at in the first thread I linked). Even if we managed to accomplish that (not trivial), it seems unlikely that a patch making that change would be accepted. We really would prefer to avoid local only changes to Ogre, especially to its core.

A shear can be represented by a series of non-uniform scales, and rotations. In fact, that is how we are acquiring shear. I was thinking that the exporter could combine these transformation matrices with the rotation matrix and export that. However, the nodes in Ogre hold orientation as a quaternion. Quaternions (I believe) can only hold rotation matrices, not arbitrary transformations.

I'm having trouble coming up with an approach that works, and either would be accepted as a patch to ogre, or makes few enough changes to maintain through future ogre versions. Does anyone have any suggestions?
Last edited by Fedyakin on Tue Mar 22, 2011 7:40 pm, edited 1 time in total.
0 x

User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7144
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 14

Re: Animations with non uniform scaling

Post by Kojack » Sat Mar 19, 2011 3:32 pm

If you export as a morph animation instead of skeleton animation, the shearing and scaling will be preserved. Although the filesize will go up (possibly a lot).
0 x

Fedyakin
Halfling
Posts: 43
Joined: Thu Jul 14, 2005 6:48 pm
Contact:

Re: Animations with non uniform scaling

Post by Fedyakin » Tue Mar 22, 2011 7:39 pm

Thanks, that makes sense. Unfortunately morph animations won't work for us because things attached to the animated object (such as hair) wouldn't scale with character changes in the animation (head size). We did find a solution though, that doesn't require any new code.

What we did was modify the way the assets are authored. In Maya, objects that have problematic animations now have two skeletons. One skeleton is the normal hierarchical one. The second skeleton is flat (no parents) and constrained to follow the first skeleton; it also is the one that applies its weights to the mesh. Animations are authored using the first skeleton as normal, but the second skeleton is used when exporting for Ogre.
0 x

Post Reply