A history of CG bird flocking

Do you know about Boids?

The latest issue of befores & afters magazine (issue #4) goes deep into the history of ‘VFX bird shots’. And it includes a deep dive into the history of early bird flocking tools pioneered by Craig Reynolds and Andy Kopra.

Here’s an excerpt from issue #4 — which you can now buy at Amazon (check the different worldwide marketplaces, too) — that looks at the early CG flocking approaches, and where they first started getting used on film projects.

Get issue #4 at Amazon (available on US and other marketplaces).

Early flocking, in CG

Certainly, if you need a flock of birds in your shot these days, you can animate them. The trouble is, animating hundreds or thousands of individual birds flying in random formations is hard. They may eventually be small in frame, but it can still be a mammoth effort. That’s why, as the use of CG in films ramped up in the 1980s and 1990s, several practitioners made early headways into using flocking algorithms and computer simulations to animate the flight of birds and bird flocks.

Among the first to devise a process for this and then turn it into a useful tool directly used in the visual effects industry was Craig Reynolds, who in 1986 while working at Symbolics Inc. made a computer model of co-ordinated animation motion, the kind you see in bird flocks and schools of fish. He called the model ‘Boids’, a play on the notion of ‘bird-oid.’

Buy Me A Coffee

1987 screen capture from a Symbolics Lisp Machine of the first Boids implementation. (Courtesy Craig Reynolds)

“I had been interested in flocks and related group motions—and natural complexity in general—since childhood,” says Reynolds. “As I began to learn how to program computers in high school and college, in the 1970s, I saw these natural systems through a procedural lens: how could I write a program to simulate that?”

Reynolds established a flocking model that consisted of three simple steering behaviors: separation, alignment and cohesion. “The rules came from informal observation of the natural world, mostly in urban settings, occasionally out in the wild. When I worked at triple-I (1979 to 1982, Information International Inc., Culver City, California) our building was adjacent to a large cemetery. Large flocks of blackbirds would forage in the acres of lawn there, occasionally taking flight and providing me with inspiration. I tried to mentally extract out elements of the motion, looking for ‘modular’ properties that were largely independent of each other. I came up with the three rules quickly, and was sure they were necessary, but until I actually tried it I would not know if they were sufficient.”

Reynolds says that the flocking model was in the back of his mind from about 1975 until 1986. “I was going to give a tutorial at the SIGGRAPH conference. I was preparing slides and started to write, as I had several times before, that I thought you could easily make a model of a bird flock, if you just had a suitable model of an individual bird. I was sure the flock would emerge from the interactions between birds. So in 1986 I decided that I should either make such a simulation, or stop saying how easy I thought it would be.”

Within only a month or two, and using the graphic software tools he and his colleagues had been developing at Symbolics, Reynolds wrote the first version of Boids. “Lucky for me, it was easy! Very early in my prototype implementation, the group of Boids began behaving very much like a natural flock. The next year we made the film Stanley and Stella in: Breaking the Ice and my paper on Boids was published at SIGGRAPH 1987 (Flocks, Herds, and Schools: A Distributed Behavioral Model).”

Later, Reynolds, who in 1998 received an Academy Scientific and Engineering Award for his “pioneering contributions to the development of three-dimensional computer animation for motion picture production,” would expand his initial three Boids rules to a larger set of, as he describes, “steering behaviors for autonomous characters used for virtual crowd scenes in movies and for non-player characters in video games.”

The rise and rise of Boids

Craig Reynolds’ Boids model and other research began catching the attention of others, including Andy Kopra. While working at Digital Effects Inc. in New York, Kopra had read Reynolds’ 1982 SIGGRAPH paper, Computer Animation with Scripts and Actors, which he outlines below.

10,000 simulated fish animated with the Boids algorithm, running at 60 frames per second on a PlayStation 3. (Courtesy Craig Reynolds)

“The paper describes his Actor/Scriptor Animation System (ASAS), implemented in the Lisp programming language. Animators write scripts in ASAS to define objects, their relationships, and their frame-to-frame transformations. At one point, Craig suggests an approach to animation that could be implemented in ASAS using ‘behavior simulation’:

Some animation is made to match a preconceived image, especially in commercial production. Other times, animation is produced as an experiment, the answer to “what would happen if…”. In the second type, which might be called “behavior simulation”, the animator sets up a little world by defining the rules of behavior and selecting the cast of characters. When the behavior simulation is run we obtain images of what went on in the little world.

He then proposes an example of this method to animate a flock of birds:

A classic example of this sort of thing is to try to build a computer graphic simulation of a flock of birds. We must define the behavior of a single bird so that when a lot of instances of the bird are simulated, they flock convincingly. The flock seems to be following a leader, but each time they turn, a new bird becomes the leader. The flock changes direction like a single unit, yet it is just an assembly of individuals. The flock is a dense cluster, but the birds do not often collide.

Having absorbed these observations by Reynolds, Kopra says he was struck by the idea that “apparently purposeful movement of a group could be produced by defining only the actions of the individuals and the manner in which those actions were determined by other members of the group.” That revelation was only backed up even further when Kopra found himself working in the Symbolics Graphics Division (SGD) in Los Angeles with Reynolds himself.

“He was developing the Symbolics animation product that I had been demonstrating in New York,” recalls Kopra. “Depending on which manager you asked, one of the reasons for my transfer was to join the group working on an SGD animation project, Stanley and Stella in Breaking the Ice. Luckily, the producer of the piece, Michael Wahrman, prevailed, and I was able to help with the project shortly after my move there.”

In fact, Breaking the Ice was designed to demonstrate the capabilities of the Boids system, as well as show the possibilities of the Symbolics graphics products in the production of longer-form computer animation. While Kopra didn’t use the Boids software himself on Breaking the Ice, he watched “first hand how Craig and Larry Malone, the author of the Symbolics modeling application, animated the flocks of birds and schools of fish. I did, however, model and animate the ice breaking, using the procedural hooks provided by Craig’s design of the animation system.”

After that experience at Symbolics, Kopra jumped directly into visual effects. He was hired by Video Image (later VIFX) partner Richard Hollander to help start a digital visual effects group, alongside John ‘DJ’ DesJardin, Scott Peterson and Antoine Dürr. The production equipment at VIFX included Symbolics systems which Kopra would later use for behavioral animation on several projects. And it would be VIFX that enabled a practical film application of Boids—in several films—starting with Tim Burton’s Batman Returns (1992).

Bats are kind of like birds

Batman Returns needed computer simulated bat swarms, and Andy Kopra leapt in at VIFX to lead that charge (interestingly, the film also featured an army of marching penguins, which were handled by Boss Film using tools based on Reynolds’ research).

For the bat swarms, Kopra would first specify, in terms of the Boids software, the directional goals of the bats required by the particular shot, previewing the animation on the Symbolics system, with Kopra noting that “Craig’s Boids simulation software was written in Lisp and added behavioral capability to the Symbolics animation application.”

An early CG bat model with art directorial suggestion, from VIFX’s work on Batman Returns. (Courtesy Andy Kopra)

To then render the bats, Kopra added code to the simulation software that wrote a file for each frame containing the transformation data for each bat. “I wrote another program that would take this transformation data as input and produce a RenderMan RIB file. Frames were then rendered from the RIB files with Pixar’s prman rendering product. These bat animation elements were finally combined with the background plate footage with the compositing and image processing software I was also developing at VIFX. The rapid motion of the bats made rendering with motion blur a necessity and was a deciding factor in using prman. To provide a suggestion of detail despite the streaking produced by motion blur, the shader for the bat’s body looked more like the spots of a leopard than the typically uniform coloring of a bat.”

One initial challenge also came in the form of the bat model, which Kopra says was at first close to the actual shape of a bat, then augmented to have ears that were taller relative to the rest of the body. “Like the bats’ unnaturally spotted coloring, this exaggeration was helpful in providing a suggestion of form even with extreme motion blur. I felt that I was in good company with such an artistic decision; the ears of The Batman’s costume have also varied in height over the years.”

Once the design of the bat model was complete, Kopra created an animation cycle for the flapping of the wings. The cycle started at a random point for each bat at the beginning of the shot. That’s when behavioral animation principles came much more into play, states Kopra.

“The chief advantage of behavioral animation—the naturalism provided by a simulation that is not directly controlled by the animator—can become a frustrating disadvantage when specific demands are made by a semi-infinite hierarchy of supervisors, art directors, directors and producers. A shot may require that the members of a flock, or, in the case of bats, a cloud, repeatedly fly close to the virtual camera, right in front of it, back and forth. The flock, however, has its own procedural idea of what it wants to do, and may not return to the camera no matter how long you choose to wait.”

“To thwart the flock’s natural tendencies in such a situation,” explains Kopra, “I would define a rectangular region immediately in front of the camera, in which the left, top, right and bottom sides were just outside the field of view. Whenever a bat would fly out of the box, I would move it for the next frame to the symmetric position on the other side of the box. The bats speed and direction were preserved; if it left the box flying out of the upper left side, it would very shortly re-enter the box at the lower right, heading in the same direction. The bats were all similarly rendered and moving too fast for the viewer to realize that the same bat that had just left the frame had suddenly reappeared on the other side. I thought of the result as bat teleportation.”

The scene from Batman Returns.

What’s fascinating about this digital bats work by Kopra and VIFX was that it occurred at a time when digital visual effects were only just starting to be used in a significant way in feature films. New approaches to animation, rendering, tracking, match-moving and compositing were all in the mix then. Still, there were limits to what could be done in a digital VFX shot. For example, Kopra notes, the team was anxious to keep the camera as motionless as possible on the bat flocking scenes.

“Grudging acquiescence by the cinematographer to this restriction facilitated the compositing process. I painted digital mattes for occluding objects, with separate rendering passes for the bats that flew between the spaces defined by the matte layers. In a scene in the Gotham City square, bats suddenly swarm out of the Christmas tree. I animated a slight distortion of the tree where the bats emerged to suggest that real bats were moving the branches.”

Read the whole birds article and more in issue #4 of befores & afters magazine.

Get issue #4 here.
Need After Effects and other VFX plugins? Find them at Toolfarm.

Leave a Reply