Bird flocks: modelisation and animation
As part of one of my course (computer animation, made by Ronen Barzel), I made with one of my friends a little soft which shows in real time the evolution of a bird flock - actually, the model we used is one of a bat :).
TAKE CARE : when loading big terrains, it can easily eat all of your RAM.
- OpenSceneGraph, available at www.openscenegraph.org and on this site as a debian package. (see the Debian Packages section).
- Demeter, a terrain engine. Available on this site as a debian package. (see the Debian Packages section).
In order to work, it needs a text file which contains :
- a terrain (texture and elevation data)
- the bird model, in osg format. Don't change it, the deformation system, which makes the birds flap, won't work otherwise.
- parameters for the evolution of the flock
There is a commented example of such a file in the source tree
We wanted to be real-time, we had to get a very simple way of
deforming the bird shape: we define a set of 'control points',
and we define a weight of these control points on each vertices
expf(-a * distance), where
- the parameter a has to be of the order of
1/(2*size), where size is the characteristic dimension of the wing.
- distance is the distance between the control point and the vertice
When the control points are moved, we move the vertices by computing a weighted average of the control points' movements
How birds are influenced
We use a force field model: flock/bird, bird/bird and terrain/bird interactions are modelised as forces, which are either vectors or rotations. At each step, we calculate for each bird the evolution of his speed vector by computing the sum of the forces.
It is based on the boids model. Basically, it tells that birds are only influenced by the other birds near them, and that one bird try to have the same speed, that it is attracted to the mean position and that it exists a short-distance repulsion between birds.
Sometimes, the flock gets divided into two or more little flocks. We try to avoid that by creating an attraction force between these flocks.
We definitely want the birds not to go into the terrain. To achieve that, we compute a repulsing force field near the ground.
Screenshots & videos
Used to be "coming soon", but, well, it has been coming soon during a year... Let's say "coming someday"