Tuesday 21 February 2012

After Effects flock of birds test

This post is quite long... sorry about that!

One of the earliest things mentioned whilst we were developing the script was the potential difficulty in animating the opening scene where the flock of crows overhead towards the camera. I'd had a few ideas on how this could be achieved relatively simply using After Effects and decided to put together a small test to better get an idea as to how it could potentially be done.

I took a lot of inspiration from the above video, in which the author claims the birds were created using a random particle generator system (presumably in some 3D software such as Maya) — this is a bit beyond my scope, but looking at it set me on the right track.

I thought that if we were to create a simple flying cycle of one bird, we could simply duplicate it multiple times and offset the position/beating of the wings so that the birds fly at different speeds, creating a fairly realistic impression of a flock of birds in flight. We could then simply keyframe the position/scale of the birds so that they appear to fly towards the screen. I put together a really simple animation to test the idea.


It's not terribly realistic but in terms of testing the process I think it worked pretty well. Obviously the composition and perspective are very different to what we want, but we could quite easily apply these techniques to the opening scene.


To start with I just knocked together a very crude bird puppet in Photoshop — made very simply of two layers, the wing and the body (opacity lowered so I could see what I was doing). I imported the transparent PSD into a new After Effects composition and set the anchor point of the wing layer to the base of the wing.


I then converted both the bird's body and the wing into 3D layers so that I was able to rotate the wing down on the X axis to create a simple flight cycle. I set three keyframes on the wing: one with the rotation set to +45, the second at +135 (downward position), and a third at +45 (back to the starting position.



I also keyframed the position of the bird's body so that it rose up and down slightly as the wings beat.  Enabling the wing layer's motion blur switch which helped to soften the animation slightly, giving the wings a subtle blur as they move up and down.


I know, I know, it looks AWFUL. But stay with me on this one!



The next thing to do was to get the animation to loop continuously so our birds will flap across the sky. I could have simply repeated the keyframes to achieve the same effect, but if I wanted to lengthen the clip I would have to keep duplicating the keyframe. Setting the animation to loop using an expression ensured that I could shrink or lengthen the clip as much as I liked without effecting the loop.

I used a simple "loopOut" expression. By holding alt and clicking on the stopwatch of any parameter you can apply an expression — a bit of code that allows far greater control over those particular keyframes. In this instance, the expression loopOut(type = "cycle") basically means "at the end of this animation, go back to the beginning and play it again!"

I then created a new composition (called "bird_flock") and placed my single bird animation into it. I scaled down the bird composition to around 12% - 20% so that it would fit within the sky of the chosen backdrop. I then applied a simple "wiggle position" effect with a speed of 1 and a radius of 30 pixels. This would give the birds a little more randomness in their movement and ensure that they didn't move in perfect sync, which would have made their movements a little too robotic.




I then duplicated the original bird a whole bunch of times and shrank/scattered them randomly around the canvas in a vaguely flock-like fashion. At this point, aside from random wiggling, the birds were flapping their wings in perfect synchrony which looked a bit odd. Repositioning each layer in the timeline slightly offset the animation and started each bird's wings at slightly different positions. The result:


I then dropped the birds onto another new composition containing a generic field image I nabbed off Google. I keyframed it panning slowly to the left over the course of about 12 seconds. That's not really important, but the point is that the birds need to fly a little faster than the speed of the background.



I shrank the birds down even further and dragged them to the far right of the canvas. I then set the last keyframe at the 5 second mark and dragged the birds all the way to the left so that they would appear to fly across the screen.




To make the birds blend a little more with the background, I used a "Tint" to give them a very subtle blue-grey hue which fit in a bit better against the sky. I also gave them a slight gaussian blur effect to slightly shift them out of focus so they wouldn't look so harsh against the sky.


The final thing was to make the flock a little larger with another set of birds that moved at a slightly different speed. I duplicated the original flock layer and moved it in front of and slightly down from the original flock's position. I also activated the 3D layer switch and pushed it "back" along the Z axis so it appeared a little smaller/further away.





Then, like before, I offset the animation on the timeline and dragged the last keyframe a little further along the timeline. The resulting effect is that the first flock slightly overtakes the new flock in the air and reaches the other side of the screen slightly before.

Final result again:



It's crude and not terribly realistic, but as a result of half an hour in After Effects and Photoshop it certainly doesn't look too bad. If we spend longer creating a nicer flight cycle and are really careful with the keyframes, I think we could get a great result fairly easily!

I'm sorry for the massive post. I'll shut up and go away now!

No comments:

Post a Comment