Flocking Crows |
Creating a script driven flocking system could easily be a project in itself. Fortunately Houdini has a powerful and flexible array of tools which allow the creation of very realistic flocks. For this reason I chose to use Houdini instead of Maya to create a flock of crows. The Flock Particle System: each sphere represents a bird (click on movie to play)
The first stage involved importing dummy objects (simplified geometry in place of the buildings etc.) into Houdini to enable the crows to avoid obstructions. The flight path NURBS curve was also imported and would specify the basic direction of the crows movement. A particle system was created which placed a series of particles just above the surface of the main meadow geometry. This was the starting position of the birds. Each particle represented an individual bird and the number could be varied. In the end I used about 150 birds as this seemed to provide a good balance between flock density and speed of computation. As the animation progressed the birds would take off from the ground, following the path and avoiding each other and also the dummy building objects. I was pleasantly surprised to see the birds form small groups and clusters within the main flock and then breakup and move within the flock dimensions. This looked much more realistic than if the individuals had stayed in the same relative positions. This movement was probably attributable to the slightly random velocitys, size and repelling force of each bird. Although Houdini can produce flocks by use of the 'follow', 'attractor' and 'interaction' tools it is still necessary for the user to design the network of operations by which this flock will operate. There are many different ways of doing this. My solution was as follows:
2. Leader Bird Follows Dummy - a leader bird (renderable) was set to follow the dummy. The leader would not follow precisely but stayed a safe distance behind - roughly matching the velocity and position of the dummy. 3. Bird Flock Follows Leader - the main flock was set to follow the leader. This meant that the flock moved in the approximate direction of the path but with some variance and movement. This created a realistic effect. 4. Birds and Building Interaction - each bird avoided its neighbours, moving away when veering too close. Each bird also avoided the buildings. Although the birds moved on a bird by bird basis, it often appeared that the flock was moving as a single coordinated entity (as in real life).
Finally at render time a bird model was copied to each particle. Each bird was given a random size (within limits) which in turn controlled its wing movement and speed. For instance bigger birds had a greater angle of wing rotation. A sine wave was used to control the wing flapping of each bird. The birds would flap harder when going up hill and would glide when going down hill.
Possible Improvements There were three ways in which I would have liked to improve the behaviour of the flock. Firstly I noticed that in real life birds in flocks tend to change level of flight, moving from top to bottom of the flock. This did not happen in my system. I would need to somehow trigger individual birds to make such movements at certain times, within the flock boundaries. Secondly my birds did not bank very much. This is because I had to restrict their banking in order to stop them flipping upside down. In reality a bird knows not to turn upside down because of instinct and physical limitations - this decision has nothing to do with the flock as a whole. In a computer simulation this banking is controlled by the up-vector of an object and rules must be written to limit it's rotation. I would like to improve these rules in any future flock I produce. Lastly the simulation did not take into account turbulence and updrafts caused by external objects such as the ground. These are crucial factors in reality, both for birds and planes. |