• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
jmakitalo

Layering animations: interpolation

6 posts in this topic

I wish to animate a human character by layering e.g. walking and shooting animations. At this point, I have implemented simple MD5 mesh animation system.

 

I suppose I will add masks for each animation to select the bones that they should affect. I would like that the upper-body animation (say shooting) could be reused for different character stances, which would be described by lower-body animations. The lower-body should control the root bone to move the whole character and the upper body should always follow.

 

I then see a problem in interpolation: thus far, I have first constructed two keyframes and then interpolated the final positions vectors and orientation quaternions of the bones. If I apply this to the two animations separately and then combine the animations, the upper body can appear incorrectly as the root bone is only affected by the lower-body animation.

 

One solution might be to interpolate the bones in local spaces for the two animations and then combine the animations. The parent multiplication would be performed during the combination procedure. Then the upper body would be transformed by a correctly transformed root bone. These operations probably don't commute, so it is not clear that this will lead to good results. How is this usually done?

0

Share this post


Link to post
Share on other sites
I would use an additive rather than a modulative approach to animation layering. Each frame, the skeleton will be reset to the bind pose. Then, the whole skeleton will be transformed by the lower-body animation pose. You can then transform the skeleton by additional poses to add on a shooting animation, a waving animation, and so on. In this way, the upper-body animations won't affect the root bone as long as the pose keeps the root static.
1

Share this post


Link to post
Share on other sites
I would use an additive rather than a modulative approach to animation layering. Each frame, the skeleton will be reset to the bind pose. Then, the whole skeleton will be transformed by the lower-body animation pose. You can then transform the skeleton by additional poses to add on a shooting animation, a waving animation, and so on. In this way, the upper-body animations won't affect the root bone as long as the pose keeps the root static.

 

I guess that in order to sensibly add animations, the bone transformations of the keyframes must be relative to bind pose. I think for me they are absolute, since after constructing the keyframe transformations, I transform vertices from inverse bind pose space. Adding such transformations would then effectively apply bind pose multiple times, which would be undesirable.

 

But I think that parent multiplication should be done after adding the animations in local bone spaces. The upper-body animations should not affect the root bone, but the previously transformed root bone should affect the upper body.

0

Share this post


Link to post
Share on other sites

You can do it like this:

1. Update all local bone matrices for both animations A and B independently.

2. Interpolate A and B by some bone dependent weight: F_i =  weight_i * A_i + (1-weight_i) * B_i

3. Build your final matrices by considering the according parent bone matrices.

4. Apply the bind pose.

 

Some hints: the main animation (e.g. walking) should control the whole lower body including the root. The upper body can be blended using a weight >0, e.g. use 0.25 to 1.0 for the spine and 1.0 for the rest of the upper body.

0

Share this post


Link to post
Share on other sites
You can do it like this:

1. Update all local bone matrices for both animations A and B independently.

2. Interpolate A and B by some bone dependent weight: F_i =  weight_i * A_i + (1-weight_i) * B_i

3. Build your final matrices by considering the according parent bone matrices.

4. Apply the bind pose.

 

Some hints: the main animation (e.g. walking) should control the whole lower body including the root. The upper body can be blended using a weight >0, e.g. use 0.25 to 1.0 for the spine and 1.0 for the rest of the upper body.

Ok. I think this is close to what I was trying to go for. In step 1 the interpolation for each animation is performed in local bone space. This is different to what I was doing in my simple one animation case, where first the frames were fully constructed in bind pose space and then interpolated, which makes sense intuitively. But I guess that interpolation in local space also works, although I suspect that it is different in a strict sense.

0

Share this post


Link to post
Share on other sites
I suppose I will add masks for each animation to select the bones that they should affect. I would like that the upper-body animation (say shooting) could be reused for different character stances, which would be described by lower-body animations. The lower-body should control the root bone to move the whole character and the upper body should always follow.

 

Good plan.

 

I then see a problem in interpolation: thus far, I have first constructed two keyframes and then interpolated the final positions vectors and orientation quaternions of the bones. If I apply this to the two animations separately and then combine the animations, the upper body can appear incorrectly as the root bone is only affected by the lower-body animation.

 

Should never happen.

 

One solution might be to interpolate the bones in local spaces for the two animations and then combine the animations. The parent multiplication would be performed during the combination procedure. Then the upper body would be transformed by a correctly transformed root bone. These operations probably don't commute, so it is not clear that this will lead to good results. How is this usually done?

 

All interpolation should ALWAYS* happen in local space ( *not strictly true, but I'll spare you the details. ). Once you've performed the local space interpolations, simply convert those transforms into world space by multiplying by their parent transforms.

0

Share this post


Link to post
Share on other sites

[quote name='RobTheBloke' timestamp='1357228518' post='5017158']
All interpolation should ALWAYS* happen in local space ( *not strictly true, but I'll spare you the details. ). Once you've performed the local space interpolations, simply convert those transforms into world space by multiplying by their parent transforms.
[/quote]

 

Ok then. I will try this out.

 

Thanks all for the help.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0