Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Getting Started

animation blending tutorial?  [SOLVED]

You feel lost? You don't understand how to use ShiVa?

animation blending tutorial?

Postby mbaucco » 21 Jul 2012, 03:46

Hello,

I have looked at the samples, and I have read the docs and I have looked online, but I am still having a lot of trouble understanding how to blend animations. If I am only blending between two animations it is fairly easy as long as I know that there are only two and I am just jogging back and forth between them (as in the simple animation example), but I really need a more realistic tutorial where you have three or more animations and you want to blend between any two at any time without knowing ahead of time which two you'll be blending.

Does anyone know of something like this?

thanks,
Matt
mbaucco
Gold Boarder
Gold Boarder
 
Posts: 198

Re: animation blending tutorial?

Postby gamescorpion » 21 Jul 2012, 07:40

Here is a photo of how the ShiVa Animation System Works:

Image

As you can see, animations are loaded into up to 8 different blend layers.

Think of it like a DJ Music Mixing System. If I raise the "VOLUME" in blend layer 0 to full power, the Idle animation will be running COMPLETELY. If I put it only to HALF VOLUME (Or 50%) the animation will only run half as "STRONG".

Now if I at the same time put to HALF VOLUME blend layer 1 along with HALF VOLUME on blend layer 0 I will have both the idle and walk sequence running in a MERGED WAY. Meaning my character will be breathing a little and also walking a little. This is known as INTERPOLATION in ShiVa where ShiVa 3D interpolates between the two animations and creates a unique animation of the two without you having to go to create an animation in your own software tools for a SEMI-Idle, SEMI-Walking state.

This is the beauty and strength of the system. If I wanted to go from idle to run, I could do this in a SMOOTH way by starting off with blend layer 0 in FULL POWER (1) and everything else at 0 power.

Then I simply move the IDLE POWER from FULL power down to Zero (0) power, while at the same time moving the "VOLUME" of blend layer 2 (RUN) up to Full Power (1).

ShiVa at this point calculates all the frames in between and interpolates between the two animations thus creating the animation of Idle to Run on its own without you having to use your animation software to create that specific transition.

Now when you get into 3-4 animations at a SINGLE time, you would then have to play around with the various "POWER" settings. The issue here lies in the fact that in almost all cases, you rarely ever use 3 transitions at one time. Its usually from one blend layer to another (Ex. idle to run, or idle to walk, or walk to run, or run to jump, or idle to jump, etc.). So what most people will do is reduce the power on the blend layer they dont want, and increase the power on the blend layer they do want.

Some examples:
1. Character gets SPOOKED out by some other object and JUMPS immediately from an idle state. To do this, go from Idle to Jump (Blend layer 0 to Blend Layer 3) by simply moving the power of blend layer 1 down to 0 and blend layer 3 up to 1. In this case to make it look like its really a startling thing, you could move the POWER of blend layer 3 twice as fast as you move the power of blend layer 0. This will merge the animations just as fast. OR to really get it going even faster, set blend layer 0 power RIGHT to ZERO and blend layer 3 power right to 1.

2. Character needs to run from idle stage. Move power of blend layer 0 to zero and move power of blend layer 2 to one (Full Power). ShiVa will create the idle to walk to run animation and everything in between. This is great if you are planning to have your character get right into a run but look like it first did a few steps walking. ShiVa will interpolate that inner part of the animation on its own.


Hope this little tutorial helped :)

Nav
Game Scorpion Inc. http://www.gamescorpion.com
MY KICKSTARTER PROJECT ARMIES OF RIDDLE - NOW LIVE (SEP/OCT 2014):
https://www.kickstarter.com/projects/617242070/mobile-and-physical-fantasy-card-rpg-game-ios-and
User avatar
gamescorpion
Platinum Boarder
Platinum Boarder
 
Posts: 667
Location: Ontario, Canada

Re: animation blending tutorial?

Postby mbaucco » 21 Jul 2012, 14:54

That's a great description of the system, and it helps a lot! I think that belongs on the wiki or something, because it sums up the system very clearly. I don't have a lot of formal game design experience so this is really great. Thanks very much!

Now that I have had some sleep I think I have a better grasp of where I'm having trouble. One thing I find confusing is this: the animbank contains all the information needed to play one of its clips, but I noticed in the simple animation sample the code seems to require that information be re-entered manually. If all that data is in the animbank, why does it have to be written out in the program code rather than taken from the animbank?

I am having trouble with when to use setClip and when to use setPlayBackLevel as well. I thought at first that setClip was how you played an animation, but it appears that I should be using setPlayBackLevel unless I am not blending an animation.

Also, am I right in assuming that the blend layers don't "remember" what they contain? That is to say, I can just set layer zero to zero percent by issuing a new setPlayBackLevel ( object, 0, 0 ) command, for example?

Thanks again for all your help and patience. I am more of a story teller than a programmer, but I'm slowly learning! :)

-Matt
mbaucco
Gold Boarder
Gold Boarder
 
Posts: 198

Re: animation blending tutorial?

Postby gamescorpion » 21 Jul 2012, 19:10

mbaucco wrote:That's a great description of the system, and it helps a lot! I think that belongs on the wiki or something, because it sums up the system very clearly. I don't have a lot of formal game design experience so this is really great. Thanks very much!

Now that I have had some sleep I think I have a better grasp of where I'm having trouble. One thing I find confusing is this: the animbank contains all the information needed to play one of its clips, but I noticed in the simple animation sample the code seems to require that information be re-entered manually. If all that data is in the animbank, why does it have to be written out in the program code rather than taken from the animbank?

I am having trouble with when to use setClip and when to use setPlayBackLevel as well. I thought at first that setClip was how you played an animation, but it appears that I should be using setPlayBackLevel unless I am not blending an animation.

Also, am I right in assuming that the blend layers don't "remember" what they contain? That is to say, I can just set layer zero to zero percent by issuing a new setPlayBackLevel ( object, 0, 0 ) command, for example?

Thanks again for all your help and patience. I am more of a story teller than a programmer, but I'm slowly learning! :)

-Matt


Hi Matt,

Ok so setCurrentClip literally in English means to CHANGE the animation that is in a specific BlendLayer. I know it sounds confusing, it can be at first, but hopefully the terminology will help you out.

Lets say my character has around 20 different animations. However in ShiVa at any given time I can only have 8 animations (as I only have 8 blend layers). So how do I add another animation in? Once again come back to the example of the image above, you simply remove one animation and input another one, in other words, setCurrentClip replaces a blend layer with another animation.

For example lets say I had Attack1 but I ran out of space. To run Attack1, I would have to replace lets say for example Blend Layer 3 for Jump with Attack1, THEN I would do a smooth transition by reducing the volume from my IDLE animation and increasing the volume on my Blend Layer 3 for the new Attack1 animation. If I wanted to get my jump animation again, I would have to replace Blend Layer 3 again with the jump animation.

setPlaybackCursor allows you to start your animation by setting the actual first frame that you will start playing your animation on. Usually it is set to 0.

Hope that answers that question.

Nav
Game Scorpion Inc. http://www.gamescorpion.com
MY KICKSTARTER PROJECT ARMIES OF RIDDLE - NOW LIVE (SEP/OCT 2014):
https://www.kickstarter.com/projects/617242070/mobile-and-physical-fantasy-card-rpg-game-ios-and
User avatar
gamescorpion
Platinum Boarder
Platinum Boarder
 
Posts: 667
Location: Ontario, Canada


Re: animation blending tutorial?  [SOLVED]

Postby mbaucco » 21 Jul 2012, 20:19

Thanks again for the excellent descriptions and the wiki entry, I hope this helps other folks as much as it has helped me! :)

-Matt
mbaucco
Gold Boarder
Gold Boarder
 
Posts: 198

Re: animation blending tutorial?

Postby mbaucco » 22 Jul 2012, 04:59

I think I have finally grasped the basics of animation blending! I thought it might help other people if I posted my practice program. I have put a lot of comments in the code in places where I got stuck myself. :)

I'm pretty sure there are far better ways to do this, but as far as I can tell it does work properly and may help someone else who might be struggling with animation blending. Please feel free to offer suggestions or corrections!

Thanks,
Matt

https://dl.dropbox.com/u/6574206/Simple%20Animation%20Blending%20Example.ste
mbaucco
Gold Boarder
Gold Boarder
 
Posts: 198

Re: animation blending tutorial?

Postby gamescorpion » 22 Jul 2012, 06:59

mbaucco wrote:Thanks again for the excellent descriptions and the wiki entry, I hope this helps other folks as much as it has helped me! :)

-Matt


Hey Matt, np Glad we could all help ya out :)

God Bless!

Nav
Game Scorpion Inc. http://www.gamescorpion.com
MY KICKSTARTER PROJECT ARMIES OF RIDDLE - NOW LIVE (SEP/OCT 2014):
https://www.kickstarter.com/projects/617242070/mobile-and-physical-fantasy-card-rpg-game-ios-and
User avatar
gamescorpion
Platinum Boarder
Platinum Boarder
 
Posts: 667
Location: Ontario, Canada


Return to Getting Started