Friday, 23 September 2011

Pass the Flipbook

View scratch on Pass the Flipbook

So Pass the Flipbook is now stable, and can also print real old school flipbooks from your animations.  There's a new interactive 'planets' browsing mode which lets you see how animations relate to each other.  There's also an embed option so once you've finished drawing, you can share on your blog!

I'm working on a Sketch-Roulette mode as well where you only draw one frame, then pass it on.

Monday, 12 September 2011

Beta Version of The Light Box Swingers Club Goes Live

Hey Folks,

Just to say that a beta version of my side project, The Lightbox Swingers Club, has just gone live.  Its an online flipbook and animation collaboration application.  Please try it out and let me know what you think.

Choose an animation you want to extend and get drawing!

For anyone interested in the technical info, its coded in HTML5 canvas, with javascript doing the interactivity, and php with mySQL running the databases.  Let me know if you run into any problems.


Thursday, 8 September 2011

Animating Dogs: Breaking into a Gallop from Standstill

This evening I was looking through my reference footage of Rufus (a friend's dog who I borrowed for a weekend back at the start of the summer) when I stumbled across an interesting gait (or combination of gaits) which Rufus uses when he breaks into a gallop from complete standstill (lying down in this case).  I was actually searching for front view footage of a gallop to study how the legs are abducted under the body, but this accidental discovery has helped explain why a shot I animated last week came out looking slightly unnatural.  How serendipitous! (As an aside, I put that word in for the enjoyment of the non-native English speakers reading this blog as its a phrase which allegedly has few direct translations to any other languages, it's also how Dave Prosser describes his BAFTA nominated short, Matter Fisher!)

Have a look at the image below made up of a few random frame grabs from one of my reference shots.  Notice how the back legs make a bounding motion (as they do in the gallop, but in this case they are completely twinned).  Even if there's no reason to avoid twinning, I find that when I'm animating, I now do it out of habit, which isn't necessarily a good thing.  In fact avoiding twinning at all costs is probably just as much of an animation sin as twinning negligently is!  The rule really should be 'twin appropriately'.

In the image below the two back legs are exactly in sync with each other.  My guess is that this is so that the drive is as powerful as possible, and so that the best use can be made of the folding and unfolding motion of the spine and the hips.  The spine, the rear hips, and the two back legs all work in time, and together they act like a piston expanding and contracting.  Basic physics tells us that for a big acceleration we need a big force.  Anyone who's been in a tug-of-war (or a rowing boat, or pushed a piano up a set of stairs) will tell you that to get the biggest force you need everyone to pull together at once.  This is what the rear legs, hips and spine are doing - lots of working together, lots of twinning, no time offset!

click on the image to enlarge

Right, so if a dog can get the greatest force using both rear legs, the spine and the hips all in sync, why doesn't it do this all the time, in every gallop.  I'm not a biologist but I think the simple answer is that it's too tiring!  Having all the parts of the body working in one huge push together just isn't sustainable... remember the tug-of-war and pushing the piano up the stairs analogies?  A large force gives a large acceleration which gets the dog up to speed, but once the dog is at full speed it doesn't need to accelerate any more, only to maintain speed, so it switches into a smoother more economical motion which involves offsetting the timing of the legs slightly... avoiding twinning.  If this still doesn't make sense imagine your ankles are tied together.  You can definitely jump higher if you jump using both legs at the same time (twinned), rather than jumping with your right leg a few frames before your left leg (un-twinned or time offset), but now try bounding with your legs tied together... pretty tiring right?  You'd probably last longer if you used alternate legs one after the other (more commonly known as running).  For more than a few bounds, having those back legs in sync doesn't make sense, so the dog breaks out into a gallop, but only after it's got maximum acceleration by using both legs together (like a 'bunch' or 'bullet' sprint start).

The strangest part is yet to come though.  Have a look at that image sequence again.  Notice the front legs aren't bounding at all, but rather they're doing a very very fast walk.  At first glance it seems odd that to go as fast as it possibly can, the dog uses a gait which is usually used for very slow speeds!  Check out the posing on the front legs - those are pretty similar positions to the contacts and cross-overs you find on a regular walk, but in this case a stride measured from contact to contact only takes 4 frames, more than twice as fast as a regular dog walk cycle!

Switching back into my amateur biologist mode again (I've read Sir James Gray's Animal Locomotion and How Animals Move cover to cover and can recommend them both for anyone interested!) I believe this use of the walk gait on the front legs only is to stabilise the dog's chest.  While the back legs are generating a huge amount of power to move the dog forwards, something needs to be done to keep the dog's body up in the air.  Normally both pairs of legs do two jobs:
  1. move the body forwards
  2. keep the body up off the ground
So if the back legs are angling their force horizontally (ie. only moving the dog forwards), the front legs must be keeping the dog up in the air, otherwise Rufus would be face-planting the flower beds (!) rather than getting up to speed.  Take a look at how these forces work...

In a gallop the legs spend more time in the air than on the ground.  In a slow walk the reverse is true - the legs spend much more time on the ground than in the air.  However the amount of time the legs spend on the ground or in the air isn't necessarily related to the speed of the gait, but rather to the amount of vertical support needed.  Think of the slowest walk - a horse in a field eating grass has four legs on the ground and intermittently to take a step it will pick up one leg for a short while, move it forward a small amount and put it down again.  In a very slow walk there are never less than three legs on the ground, and the leg which is in the air, isn't up off the ground for very long.  A horse doesn't move very fast when its eating grass, and it doesn't leave its feet hanging round in the air because that's tiring, and legs dangling in the air don't help to support the horse's body weight.  The strange 'fast walk' that the dog's front legs do in the sequence above is to support the weight of the dog's chest.  Notice how in all the shots above there is at least one front foot on the ground and sometimes both front feet are down together!

Look again at the forces diagram above.  Note how the arrow which makes greater forward progress is lower to the ground.  Think of this as being more streamlined.  The more effort the dog is putting into accelerating, the less effort goes into bouncing up and down.  Let's test this theory:  is the opposite true?  If a dog is slowing down it needs to get rid of horizontal energy.  One way it can do this is to dissipate it as vertical energy.  Read the below image strip from left to right - Rufus catches the tennis ball then as he suddenly decelerates he explodes upwards, changing that fast forward motion into up and down vertical motion.  Then gravity and cushioned bounces (Rufus' shock absorbing legs) helps us get rid of the up and down energy in the same way a bouncing ball bounces less and less on each bounce.

click on the image to enlarge

Looking at these images has just made me realise something.  Have a look at the image below.  Who's accelerating and who's decelerating.  Who has a horizontal motion, and who has a vertical motion:

sprinters accelerating and decelerating

Or how about this one:

looks familiar?

So in summary here's the main positions roughed out.  Remember that the chest is generally more stable than the hips (which tend to jog around a bit at the back... think of how "Slinky's" hips move in Toy Story, always left behind and catching up again).

some rough sketched poses

If you wanted to study the clip the first set of images came from, here it is below on youtube.  You might want to use saveyoutube or similar to download the clip to play frame by frame in QuickTime.

The combination of a bounding gait (ie. a twinned or symmetrical gallop) on the rear legs, with an un-twinned gallop on the front legs is technically known as half-bound.  Here's a cat doing something between a half-bound and a gallop from the Muybridge Animals in Motion books.  I've annotated the "1-2" landing of the front legs and the simultaneous contact for the rear legs:

And as always, please fire off in the comments if you don't get something or think I've got something wrong. It's all open to discussion!

See Also:
How to Key a Dog's Walk
Slow Four Legged Walks

Sunday, 4 September 2011

How to Key a Dog's Walk - Animation Notes / Tutorial

Animating on my current short had been great fun until I hit a tiny 2 second segment of shot 24 which seemed to be so very much harder than the rest of the film.  I'd animated 'Blake' (the border collie dog in 'Crows') cantering and galloping without too much difficulty, but I was really struggling with the walk.  This was a huge surprise to me.  I thought that if I could cope with the faster gaits and various varieties of them then I would be fine with a simple walk.  I'd managed rotatory and transverse gallops in rear lead (rear legs landing first, suspension with the body folded, as a horse would normally gallop), front lead (front legs landing first, body outstretched during the suspension, as a dog normally gallops) and double suspension forms (as in a very fast gallop), and right and left lead canters, as well as flying changes, transitions and so on, all without any trouble.

I had some difficulty in timing the speed of the paces in a walk and working out how many frames both front feet were down together, and how many frames both rear feet were down together, my investigation of which is posted here.  It turns out however that this was not the main problem with my walk.  I went right back to my keys and found I had something like this (and mirror versions of the below), which appears in countless animation books:

Fig 1. The Wrong Way?  Is the XO a Key?

While this isn't strictly wrong, its very missing something.  These keys are not extremes of height for either the front shoulders or the back hips.  While the contact position is lower than the cross-over, the contact position is not the lowest position, and the cross-over is not the highest position.  It sounds obvious, but when presented with the above sketch its easy to forget that the high position (after the XO and before the C) is actually the highest, and the low position (after the C and before the XO) is the lowest... just like in a human walk!  If you're unsure on two legged walks I'd recommend reading up on them in The Animator's Survival Kit, which goes into a lot of detail explaining how key animation principles apply to the human walk.

In addition to the problem of not having any vertical extremes, you also have 2 keys per stride rather than the usual 1 key per stride common for a two-legged walk.  If you're like me, you prefer to plan out your two-legged walks stride by stride (contact by contact) rather than the C-XO-C-XO etc sequence which you have to use with the above keys.  In my brief experience it is much less hassle in the long run to plan your 4 legged walks in the same way as your two legged walks - with one key per stride, simply only keying the front legs:

Fig 2. One Key per Stride - The Right Way?

For the time being lock the back legs out (if you have IK/FK switching then you can just flick them onto FK and ignore them for a bit).  Also check that your joint/bone hierarchy propagates out from above the front legs rather than above the back legs ie. your root-most body joint is facing from the front shoulders to the rear hips.  Even if you choose not to work with one pair of legs, read on - there's important info on phasing.

Fig 3. Where to Put the Body Root and How to Animate It.

Now we've simplified the problem.  You can use your front feet on IK, and the body (plus locked out back legs) to animate a normal two legged walk, a bit like this:

Fig 4. Looks Familiar?

So now put in the cross over between the two contacts, building on the interpolation the computer has given us rather than starting from scratch.  Remember the cross-over is slightly higher than the contact, but still not as high as the high position (obviously).  Because its a dog walk there's some really nice breaking of the joints going on at the cross over which you don't see so much in a human foot.  Study this image taken from Dr Stuart Sumida's 2006 lecture on quadruped animation:

Fig 5. Taken from here.

Dr Sumida is simply the coolest paleontologist around and I strongly suggest you check out his work, and the very weird photo of him sitting in a bathtub in the middle of the desert.

Once you've got the contact and cross-over working as you would have them in a two-legged walk, go on and add the high and the low position.  Watch some reference videos on you tube, or see my other dog walk post for a trace-over of the skeleton.  The dog's foot swings through in the same way as a human foot swings from the low position to the high.

Fig 6. Imagine this is a Dog.

The shoulders also need to drive (lead) the movement.  Remember you're meant to be working with forces not just poses.  Check that the shoulders are ahead timing wise (you don't need to shuffle keys, just get the breakdown right).  When you're keying the C-L-XO-H-C series remember that you should be working with the body and both feet.  The ground-bound foot does a really nice successive breaking of the joints sequence as it moves from the front contact to the rear just before the lift off.

Fig 7. Successive Breaking of the Joints and Forces.

As you might have guessed from my set of keys above the head follows through vertically (unless the dog is actively moving its head around).  I've offset this follow through to be completely out of phase, but on slower walks you'll probably find the phase difference is a lot less in terms of phase difference, but similarly lagging when counted in frames.  Obviously if the dog's head is heavier then the follow through on the head will be later (greater phase offset) due to the increased inertia of the head, and if the dog's head is really light the follow through will only be very slightly behind the motion of the body.  The head moves up and down as well as having a forward/backward tilt (which is simply drag).

Fig 8. Approximate Phase Differences in a Border Collie's Walk.

So in a slowish walk the rear legs will be contacting as the front legs are crossing over.  The rear legs are actually ahead of the front legs in terms of phase difference.  So if the rear legs are at the high position with the right foot in the air, then the front legs will be two positions behind at the low with the left foot in the air.

As the dog speeds up into a trot the back legs increase this difference even more so that the contact for the rear legs occurs at the same time as the contact for the front legs, but on different sides - ie. so rear right and front left contact together and vice versa.  This is now four positions head in the chart below.  The rear legs and the tail work in the same way that the front legs and the head worked respectively:

Fig 9. Animating the Back Legs and Tail.

You'll need to study some dog anatomy before you can apply the human walk to a dog's rear legs, but again the same principles apply with successive breaking of the joints (the foot seems to pad down as if its a soft cushion at the contact, then peel off the floor as if its slimy goo just before the lift off).

Take a look at the second pose in the above image.  Two feet on the same side (the dog's left) are airborne at the same time.  The dog is very unstable laterally (left to right).  To make up for this, it happens when the two ground-bound feet are furthest apart and the dog is longitudinally at its most stable.  Remember this simple rule and it will help you make sure you keep the rear legs ahead of the front legs rather than the wrong way around.

Fig 10. The Window of Stability.

Look for the 'window of stability' - when the two airborne legs are on the same side (in this image both on the right), the body weight is longitudinally centred over the front leg (which is forward compared to the body) and the back leg (which is backward compared to the body).

And in summary this simple table will hopefully help you understand the phasing of the front and rear legs:

Front Phase Front AirborneRear Phase Rear Airborne
C [R forward] XO L
XO L C [L forward]
C [L forward] XO R
XO R C [R forward]
C [R forward] XO L
... ... ... ...

In case you hadn't guessed: in the 'phase' column C stands for contact, L for low, XO for cross-over and H for high.  In the 'airborne' column, R indicates the right leg is airborne, L indicates the left leg is airborne, and in the case that neither leg is airborne I've simply indicated which leg is furthest forward in the direction of travel.

See how what's happening to the front legs is happening two keys later than it happens to the rear legs.  For example find a left forward contact for the rear legs on the table above, then search two rows down and you'll see that the front legs have a left forward contact, two keys later!

I haven't talked much about the twisting that's going on in the shoulders and hips, or the tail wag and head nod from right to left because we've only been working in side view.  To give you a clue you need to be looking for a snaking or waving motion running through from the dog's head to its tail when you view it from top down.  Overall its the same old rules as in a two legged walk, the hip turns to favour the leg which is furthest in front.  In addition the head follows through right to left (and with side to side rotation) in much the same way that it follows through vertically.

I hope you enjoyed this extensive dog walking animation tutorial and can now animate a dog like a ninja, or even better, like a dog.  Please feel free to comment below if you have any ideas, requests or suggestions!

See Also:
From Standstill to a Gallop
Slow Four Legged Walks

Saturday, 3 September 2011

Working with the Composer

I spent yesterday afternoon working with James Whittle, the composer for my 'Crows' short.  We got a rough recording finished which I'm really pleased with.  Hopefully sometime next week we'll have access to a proper studio to record the score properly!  After a long break away from the film its really great to be making progress again.