Sunday, November 20, 2011

Run cycle

This is going to be very long post. The run is not very difficult to make. But I've seen so many similar mistakes, so many people don't get the idea of the In-betweens, that I decided to make it very long, scrupulous and detailed description. Despite the length of this post, the increments between steps are so small, you'll be able to blast from picture to picture and go through this explanation rather easy.
OK...
Let's imagine what a child would draw, if you asked it to draw a running man.
Which one,                                  1st                                 or 2nd?

I think it's 2nd. Let's open Maya, bring character, set it up , create Quick Select Sets and create our first/last poses.
Blue are quick select sets selected. Let's position this guy a bit better, like below.
                                        pic 1                                   pic 2
Shape hands, lower arms, bring the heels together and rotate feet outwards (red arrows on pic 1), tilt him a little forward to shift center of gravity, to make him "fall" (red arrow on pic 2. Yellow arrow shows center of gravity)

Pay attention to what controls you use when posing the feet. I recommend using foot controls in Red Rectangle.
Also note in Green Rectangle, feet parenting is set to World (World - 1, rest - 0).

pic 1.                                                                                                   pic 2.
Get the feet OFF the ground, it's the air born pose, like in pic 1. Just like in a walk cycle, rotate the hips and counter-rotate the upper chest (red arrows in pic 2.).
This is our first and last poses. Lets make them frames 0 and 16.
Check your Graph Editor. It should look like in the pic below:
Blue is the Quick Select Sets. I keyed all the Body, legs and arms. 
Now we just need to create our second air born pose.  It's pretty much the same, only with left/right legs and arms switched. Pay attention to Graph Editor.
In red rectangles are the beginning and end of our cycle. Using the button in Blue rectangle, flatten the tangents.
Playblast should look like this. Click here 
pic 1                                                       pic 2
pic 1 above shows work on the breakdown pose. Red outline and arrow shows previous position of the "forward" leg and it's movement to the position on the ground. Underneath the character (or slightly back, to create forward streaming feel). Yellow outline and arrow show "backward" leg's movement. Basically I haven't done anything to it. Yet. Blue arrow shows Root movement down. 
pic 2 shows up/down movement of the Right leg and the Root.

Not all is good with our Graph Editor. Look below:
pic 1                                                                           pic2 
pic 1 shows slanted tangents, that leads to an "overshoot", area of the spline that protrudes beyond the key value. So our real key seems to be on the frame 3 instead of 4. 
pic2 shows the way to fix it. Use the button in yellow cyrcle to flatten the tangent. Or use autoTangent.

Do this for both legs and visit the passing foot position. It needs some tweaking.
I used Toe Roll (in Yellow rectangle) and translated back and down. But it's a matter of taste.
The body looks stiff. We need to add some spine deformation. For clarity I'll use "concave/convex" movement. 
pic 1                                                                      pic 2
Pic 1 is what we start from.
Pic 2 is spine, bent over (Red arrow). To add spring like motion to the spine, I used low spine to counter animate (yellow arrow) and moved the Root slightly backward (Green arrow).
Too exaggerated, I know. Let's keep it for now, just for demonstration. We're not done with Breakdowns yet.  We have almost forgotten the left/right weight shift and arms.

pic 1                                               pic 2                                                pic 3
Pic 1 is shifting to the left. Translation of the Root, rotation of the torso to align the head with the center (almost)
Pic 2 is shifting to the right. Yellow outline is the neutral position.
Pic 3 is my Outliner with selected Quick Select Sets I used to created the poses.
Let's look at it 

With the arms I'll simply bend out the elbows on the breakdowns. Both at once.
Pic 1. Yellow outline is position of the elbow before the adjustment. Yellow arrow is direction of the adjustment.
Pic 2. Selected ArmB on both arms (elbows)
Pic 1                                                                                                       Pic2
I'd adjust wrists as well and, perhaps, the arms.
Looking  at the run from the front we notice that arms are moving in robotic manner. So we need to adjust it as well. I'd recommend adding sideways movement. It showed that my elbow movements need to be toned down. I can't look at the weird head nodding anymore, so I'd tone it down quite a bit together with the neck. 

Time for in-betweens. Those poses when our guy's legs touch the ground and push him off the ground.
Right in-between frames 0 and 4 (frame 2) is where forward foot is touching the ground. (Yellow arrow). Pay attention to Foot controllers, the heel must be on the ground. Translate Y and Ball roll must be on "0" (in our case here). I'll leave the other leg alone for now (Green ?) 
Our next in-between is on frame 6. Pay attention!
The backward leg is on the ground. Translate Y is on "0", touching the ground (in small yellow rectangle). To avoid knee over stretching I use Toe Roll. (in yellow rectangle). After adjusting the other leg as well we get this:a
Still needs something, right?
We need overlap of the body and arms. Let's start with the arms, it's easier.
pic1                                                                                         pic2
Pic 1. The Elbow and the body moves down. Our elbow position (Yellow arrows) create sort of anticipation: moves up before moving down.
Pic 2 shows "Overshoot", when the elbow moves past the Extreme. (Extreme for the Root may not be Extreme for the Elbow. We still may call Character position Extreme or Breakdown, but we need to keep in mind that it's very relative. In reality frames 2 and 6 are Extreme for the Elbow, but if we keep on like this, our brain will shut off prematurely.)
After adjusting the elbow (and wrist) all the way to the end of the cycle, our Graph Editor will look like below.
And after adjusting both arms, we'll have this
Playblast  much softer, isn't it?
Let's apply the same thinking to the body and make overlaps in the in-betweens.
Let's make those overlaps very exaggerated, so they will be noticeable. And don't forget to increase up/down on the Root.
Crazy!
Are we done?
One more thing about the tangents.
Let's look at left/right Root movements.
Yellow circles show flattened tangents. But these keys are not platoes, why would the tangents be flat?

Using the button in yellow rectangle, adjust the tangents. Do this to all splines, even if it means to go over all of them one by one.
And I really want you to look at my timeline. Yes, we have Extremes, In-betweens and Breakdowns, but it still looks organized and easy to read. 
Now, when our crazy run is done, we can add last drop - offset of the splines. I'll leave the body alone and do it to the arms. Select right elbow and shift it one frame forward. Then select both wrists and shift the splines. Then do it to the head.
Here's what we've got.
Are we done yet?
Err... well, we are kind of done. How about one more last thing?
Let's take a look at the up/down trajectory of the backward leg?
Pic 1                                                                            Pic 2

Red trajectory is what we have. Boring. How about something like on blue trajectory?
Pic 1 is our initial position. Pic 2 is adjusted. Adjust it for both in-betweens and for both legs and...
Wait. Let's look at the pic below.
Yellow rectangle is the 2 frames it takes for the foot to get flat on the ground. Isn't it too long? How about One frame? Red arrows show our one frame range. Same for all legs. And while we are at it, let's play with in-betweens of the Root up/down.
Red trajectory is regular, neutral spline. Yellow rectangles are our In-betweens. How about moving the keys upward (Yellow arrows)? So he spends more time up and bouncing sharply off the ground.
Is that it? Nope. WHAT NOW?????
Oh, haven't you forgotten what I did for the walk cycle? We need to make sure the feet Translations on the ground are straight lines, otherwise we can't use this run cycle to simulate run across.
Yellow rectangle is where the stretch of spline is straight. Use the button in Red rectangle. White arrow shows Foot's "travel". I didn't have a key for the Translate Z in-betweens on frames 10 and 14, so I had to insert keys there. Same for all legs, bring down the Root even more and we have our final run.
And now look what our Timeline looks like
It has keys on every frame! Now if I need to change something, it will be very difficult, so before I start shifting the splines and creating one frame offsets, I should be very sure the animation goes the right way and I can change things before going to this mind blowing stage.

The End












































Friday, November 18, 2011

Gallop cycle

Gallop is tricky. At least for me. So I need to use Video Reference.
Here is the link to the YouTube video.
I recorded it from the screen using CamStudio.                                          
Click here:
Using Windows Movie Maker I selected a cycle and cut 6 of them together:
Click here
Using SnippingTool I made snap shots, trying to find Extremes, Breakdowns and In-betweens:
                                             Stretched (extreme).
                                             Passing position (front)
                                            Air born (Extreme)
                                             Passing positon (back)
                                             In-between (back)
                                             Back to beginning
Using Windows Movie Maker, I made them back into a short movie:
Click here
Works. OK, now I can try to repeat those poses in Maya.






















Something like above. Red lines show that front Left and rear Right legs are almost parallel.
Select all the controls in Quick Select Sets (in Outliner).
I'll choose the range of 16 frames, because it's easy to divide. But the real Gallop will take probably 12 or 14 frames. So our will appear slow and heavy, but I'll go for it for the ease of dividing (16/8/4/2).
Let's make our first position and set the keys on frames 0 and 16.



















Red rectangle is Quick Select Sets, Yellow is autoTangent and Purple ovals - our Extremes.
Now we need to create an Air born position, as the most important for the Gallop. Actually we could have started with it.
pic1.

























pic2.




Red angle is the shape I'd give to the overall pose. Pay attention to the flattening of the tangents. Compare pic1 and pic2.
Now I'd attempt a Breakdown for the front legs. 


























Seems like a mess, but look carefully. Follow the movement of red and blue outlines (with corresponding arrows). Chest I left as is, but the butt goes up.
Continue with another Passing position, of the Rear legs. The chest goes up, butt goes down a little.










































Select the curves and click on the button in Red rectangle to curves into Stepped. This will give us better understanding of what's going on in Playblast.
Click here

Not bad. Now we need to take care of the in-betweens. Poses, where both legs are on the ground, "pushing" it from underneath and where "ups" and "downs" of the body are.





















Red Arrows show that both hooves are on the ground. Chest goes down. Right shoulder is broken. It can be fixed either by moving the shoulder or by using Toe Roll. Like in the picture below.

At this point, after learning to do walk and trot, we should know where to place in-betweens. If this is still problematic, please refer to walk cycle , quadruped trot posts and go over them again.
Our main problem now is to compare the strides of all the legs and make sure they are 
1. straight lines, and 
2. of the same length.
Red Arrow points at the foot. Red rectangles are the section of the Translate Z, which supposed to be straight. Red circle is the button to make tangents straight.

Red lines are the straight sections of the forward/backward translation of the hooves (on the ground) after some adjustments. Now we need to compare front and back feet.


 Above are Translates Z of all 4 feet. Red sections show adjusted straight segments.
After adjustments of all the up/down curves for each leg, Toe Roll curves for each leg, Chest and hips up/down curves, chest goes up - head goes down - playblast looks like this:

Still looks funky.
 So after some tweaking and moving keys here and there, offsetting back from the front, adding tail animation, neck/head counter animation I came up with this:

And finally, here's how my Timeline looks now. 
All the offsets and in-betweens created complicated picture with keys resulting in every frame. At this point it becomes near to impossible to add changes to this cycle. So please try to keep your timeline clean as long as you can before it becomes as muddy as one below.

The End.

















Thursday, November 17, 2011

Trot across

Let's build trot across the terrain.
We need to build a terrain. (I did it using the Polygon plain, scaling it up, using vertexes and rotating, translating and scaling them. No fancy work here.)

Using world, move the horse away to beginning of it's path. Red line is the intended direction of the move. 

Having experience of trot cycle, approximately eyeball how many steps this horse will make to the end of the journey. In my calculation it will need 6 steps. 16 frames per cycle, 8 frames per step.  48 frames! Set our timeline to 48 frames.
Let's set-up the horse. Look at "how to set up the character" post, look at "Quick Select Sets" post. 
Having selected the Root ("cross" above the horse) and all it's legs, bring the horse to the end of the path. Look at Graph Editor and make the curves straight.
Now we can start working on the animation
Just as I explained in Walk Across post we need to start with passing positions.
But first let's divide the whole motion to 8 "steps". Just like in the pic below.

Considering that perhaps frames 0,8,16, 24 etc. are our extremes (up in the air poses),
in-between them we'll find our passing positions. Let's mark them.
Please note selected controllers in Outliner, (right) in the quick select sets.
Red rectangles are extremes, yellow are passing pos., blue circle - straight line button.

In the passing positions we temporarily make sort of "stepping", just for visual reference.
Red arrows and red rectangle in the GE are the "Up" positions of the feet.


Now we can start working on the Passing positions, making sure the feet don't intersect the ground, adjusting chest and rear according to the terrain.
For this I'd look at the feet from underneath to see the intersections.
Red circle with pointing at it red arrow is intersecting foot. We will translate it up and adjust it's rotations.
Time to create strides. Again, please look at thorough explanation of the process in "Walk Across" post. Here I will simply remind you that we are going to copy/paste back and forth from Passing position, using Middle Mouse Button. One foot at a time. I'll begin with rear left foot.
Red arrows show movement of the foot. Our curve begins to look like a "staircase". We need to adjust last section by eye, because there is nothing to copy from. 
Looks like funky walk, doesn't it?
Same for all legs and it should look like this
Playblast

Back to passing positions, make sure they look the best. It's some piece of work, given the terrain, where none of the keys will look alike.
I had to lower chest and rear, re-check position of the grounded feet (red arrows), lower passing feet and use Toe Roll to flip them (Yellow arrow and red rectangle).

Now we need to create those beautiful "air born" poses. But those extremes have the feet on the ground, right? If we lift them up in the air it will destroy those clever strides. Time for yet another set of divisions: in- betweens. Frames 2, 6, 10, 14 etc. Copy back and forth from passing positions. One foot at a time.
Red Arrows point at those in-betweens. Red "??" are places where they are missing. Red rectangles are in-betweens in the timeline and yellow are missing ones. 

Let's continue until all the feet are done and all the in-betweens (where feet supposed to be on the ground) are created.
And now the trick! Go to the extremes and remove them. Remember, the horse is up in the air during the extremes, so the feet will be up too. Red rectangles are to be GONE!!! and our curves to be fixed with autoTangent (yellow rectangle).
                                  Pic1
                                  Pic2
Compare Pic1 and Pic2.  Do it to all the legs.
Playblast


12. Go to all of those air born extremes and adjust all the legs, point the hooves etc.
Check chest and rear extremes and create nice streamlined poses with the legs (look at the video footage). The amount of work increases. I had to adjust up/downs of the chest and rear for the horse been able to reach the ground in the in-between phases.
Playblast

13. Time to counter-animate neck and head. Remember? the chest goes up, the neck goes down.  Green curve is up/down of the chest. Blue counter-animation is rotation of the neck.
Playblast


Neck moves a bit too much, but for the same of illustration it's OK.
Now we need to overlap the head. Same process as with the Trot Cycle (look up corresponding post).

Top curve is the neck's and bottom is head's rotation. I varied rotation of the head.

To finish this off, let's offset back animation 1 frame.
Select back legs and hips in Quick Select Sets, select them in GE and simply move one frame forward. 













For sheer fun we can animate that peace of pipe sticking from the horse's butt, and imagine it's his tail. I'll leave the tail in neutral position during extremes and passings, but create overlap in the in-betweens the same way I did with the head. Red Arrows show changed in-betweens.Yellow Arrows show those in-betweens that yet need to be done. I'm only working with the base section of the tail.

Finished section of the tail

Finished last section of a tail looks something like this. 











Actually it may look like this too










And the finished Trot is here (The head may be moving less etc. But really, for the finished product we need different rig and the most important: Not the generic locomotion, but decide on the character of the animal and add those traits: nervous, calm, young and perky, old and wise etc.)
Playblast