• 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
RobMaddison

Animation blending and/or layering

6 posts in this topic

I can now blend animations together in my engine. For testing I'm just using a simple box with 5 sections with a bone per section.

During my searches for help with animation blending, I came across animation layering as well. I read a gamedev post where haegar wrote up some info on the differences but it was a bit above my head. Could someone please explain the difference between animation blending and animation layering with some easy examples?

My blending gave some interesting results. Animation A bends my box sections in one direction effectively creating a 'C' shape. Animation B twists the box along its length, effectively simulating torsion. Now if I give animation A 90% of the blend and animation B 10%, I get a 90% bend in the 'C' shape and only 10% torsion - just as expected, and it obviously works vice versa.

Now here's the thing, what if I wanted full torsion and full bend? Would that be where animation layering comes in? And how exactly would that work?

At the moment to do the animation blends I convert my matrices to quaternions, nlerp between them quaternions and lerp between the translations and then convert that back to a matrix. Not very efficient I know, but I'll refactor this later.

So looking at this from my game character's requirements, I would like him to have an idle animation, a jog and a run, so this would be a fairly simple blend between idle and jog and then jog and run, but why would I need layering? Would this be for something like running with the bottom half of the character and shooting with the top? (instead of animating arms as they'd be when running).

Thanks for any help or pointers
0

Share this post


Link to post
Share on other sites
[quote]
So looking at this from my game character's requirements, I would like him to have an idle animation, a jog and a run, so this would be a fairly simple blend between idle and jog and then jog and run, but why would I need layering? Would this be for something like running with the bottom half of the character and shooting with the top? (instead of animating arms as they'd be when running).
[/quote]
Yep.

Animation layering is used to blend several layers of animation on top of each other. A simple example would be a character. The first layer could be a walking animation, a second layer could be a shooting animation. Instead of overlaying the second layer just on-top of the walking layer, you can use weights to just blend the animation of the upper-part of body , this is, your character runs while shooting. It is like layering several alpha blended images in photoshop.
0

Share this post


Link to post
Share on other sites
Thanks for the great explanation, I had a feeling it was that. So in a nutshell:

Animation blending is where all animation 'parts' (e.g. Walk anim, run anim) are pro-rata'd against each other using blend weights which add up to 1.

Animation layering is where you just add animation parts together with a weight for each and I assume it doesn't matter if the combined weight goes over 1, e.g. Layering run and walk would look odd but you can do it

So animation layering is the same as blending just without the combined weight normalisation?

And a use case:

My character is standing idle using the idle animation, breathing, swaying a bit etc. This is obviously just one animation, no blending or layering.

If the user leaves him in that pose for 10 or so seconds, to add a bit of eye candy, he maybe brushes something off his jacket. So I'd have an animation that only affects the top left half of his body, his head, shoulder, arms, etc. playing the idle animation, I can layer the jacket brushing anim over the top? If the jacket brushing anim has a weight of 1 and the top left half of his idle anim has a weight of 1, would that work?

The way I see it is that you'd use blending to fade nicely between animations and layering to combine animations together albeit to different parts of the skeleton.

So in the use case above, would I need to reduce the weight of the top left half of the idle anim down to 0 so the jacket brushing anim slots nicely in or can I just add them? I can't visualise what adding two anims together (making a combined weight of 2) would do - I'm guessing his hand in the jacket brushing anim wouldn't line up correctly with his chest because you've also got the idle anim in there. I guess I could add a priority and set the priority of the jacket brushing to higher than idle and restrict the combined weights to 1 meaning the top left half of the idle anim won't have any effect.

Is this about right?
0

Share this post


Link to post
Share on other sites
[quote name='RobMaddison' timestamp='1332836675' post='4925577']
Animation layering is where you just add animation parts together with a weight for each and I assume it doesn't matter if the combined weight goes over 1, e.g. Layering run and walk would look odd but you can do it
[/quote]
Not exactly, layering and blending is more or less technically the same. The weights should always sum up to 1. It is more of an other term for combining animations.

An other example:
You have a walking character with his gun ready. Then he starts running while targeting his gun at an opponent in front of him. In this case we have 4 animations (walk,run,gun ready, gun aiming). We could divide the animation on two tracks or channels (movement and action). When our character starts running, the walk animation will [u]blend [/u]over to the run animation, on the other hand, the gun ready animation will [u]blend [/u]over to the gun aiming animation. Something like this:
[code]
movement_ani = blend_animation(walk,run,alpha)
action_ani = blend_animation(ready,aim,beta)
[/code]
Alpha and beta are time dependent. Now you need to combine the movement and action animation by laying the action animation on-top of the movement animation with a bone-dependent weight, this is infact blending too.
[code]
final_ani = blend_animation(movement_ani, action_ani, bone_dependent_weight)
[/code]

More advanced approaches are vertex animation overlays (i.e. facial animations not done with bones) or inverse-kinetics (i.e. pointing the characters arm always in the direction of the mouse).
0

Share this post


Link to post
Share on other sites
[quote name='Ashaman73' timestamp='1332846217' post='4925625']
[quote name='RobMaddison' timestamp='1332836675' post='4925577']
Animation layering is where you just add animation parts together with a weight for each and I assume it doesn't matter if the combined weight goes over 1, e.g. Layering run and walk would look odd but you can do it
[/quote]
Not exactly, layering and blending is more or less technically the same. The weights should always sum up to 1. It is more of an other term for combining animations.

An other example:
You have a walking character with his gun ready. Then he starts running while targeting his gun at an opponent in front of him. In this case we have 4 animations (walk,run,gun ready, gun aiming). We could divide the animation on two tracks or channels (movement and action). When our character starts running, the walk animation will [u]blend [/u]over to the run animation, on the other hand, the gun ready animation will [u]blend [/u]over to the gun aiming animation. Something like this:
[code]
movement_ani = blend_animation(walk,run,alpha)
action_ani = blend_animation(ready,aim,beta)
[/code]
Alpha and beta are time dependent. Now you need to combine the movement and action animation by laying the action animation on-top of the movement animation with a bone-dependent weight, this is infact blending too.
[code]
final_ani = blend_animation(movement_ani, action_ani, bone_dependent_weight)
[/code]

More advanced approaches are vertex animation overlays (i.e. facial animations not done with bones) or inverse-kinetics (i.e. pointing the characters arm always in the direction of the mouse).
[/quote]

I see, so when you do the third blend (the one between the movement and the action anim), you have per bone weights which essentially means the lower body will be fully (or almost fully) weighted towards the movement anim and the upper body will be weighted heavily toward the action anim...?
0

Share this post


Link to post
Share on other sites
[quote name='RobMaddison' timestamp='1332846848' post='4925629']
I see, so when you do the third blend (the one between the movement and the action anim), you have per bone weights which essentially means the lower body will be fully (or almost fully) weighted towards the movement anim and the upper body will be weighted heavily toward the action anim...?
[/quote]
Yep.
Thought this kind of animation technique helps you to reduce the work load of creating animations (good for us hobby/indie developer), it has some disadvantages too. One is, that you really need to "separate" the action-body part from the movement-body part. This is not a major problem for animating a humanoid with a gun, but it is more difficult to animate a humanoid melee fighter (where movement is part of the action) or i.e. a spider (where single body parts can't be assigned to action or movement).

As far as I know, most modern AAA games doesn't combine animation this way and use separate animation for each possible animation piece, linking and blending them in an smart way at run-time and adding some inverse kinetics chains to push the integration into the environment even further.

Before digging into an animation system, first think about what animation are needed and what are your animator resources.
0

Share this post


Link to post
Share on other sites
Thanks for all your help so far. I would have thought layering would be an excellent way of saving data - if only part of a skeleton needs to be animated, you only need key frames for that set of bones. I guess the conversion tool (between DCC and the engine) could work out that during the whole animation there's no movement of certain bones so just flag them accordingly so they're not part of the computation.

I think at this stage I just need to be able to animate skeletons, blending between poses and layering part-skeleton animations (eg the jacket scratching from above) on top. I also would like to be able to animate arbitrary elements, like the x element of a vector, etc..
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