Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
By Craig W. Reynolds Presented by Daniele Zollo
29/9/2011
Flocks, Herds, and Schools: A Distributed Behavioral Model
INTRODUCTION
The goal is to simulate a flock in computer anima9on.
A flock is a group of objects that exhibit the general class of polarized (aligned), non-‐colliding, aggregate mo9on.
A flock is composed of boids.
Boid is a simulated bird-‐like object.
PARTICLE SYSTEMS
Simulate mo9on of flocks of boids using individual behaviors.
Elaborate on a Par9cle System. Par9cle Systems are collec9ons of large number of par9cles each with their own behaviors.
More realis9c than scrip9ng the paths of the individual birds.
Boids must interact strongly in order to flock correctly: his behavior is dependent not only on internal state but also on external state.
BEHAVIORAL ANIMATION
Computer animator's job becomes somewhat like that of a theatrical director.
Character's performance is the indirect result of the director's instruc9ons to the actor.
Not knowing how a simula9on is going to proceed from the specified behaviors and ini9al condi9ons can produce many unexpected and pleasant surprises.
But there is need of rules that ensure the correct behaviors that lead to simulated flocking.
GEOMETRIC FLIGHT
A fundamental part of the boid model is the geometric ability to fly.
Each boid performs a mo9on along a path: a dynamic, incremental, rigid geometrical transforma9on of an object, moving along and tangent to a 3D curve.
The boid is free to ar9culate or change shape within this flying coordinate system.
GEOMETRIC FLIGHT
Geometric flight models conserva9on of momentum. An object in flight tends to stay in flight.
There is a simple model of viscous speed damping, so even if the boid con9nually accelerates in one direc9on, it will not exceed a certain maximum speed.
A minimum speed can also be specified but defaults to zero.
A maximum accelera9on is used to provide smooth changes of speed and heading.
BANKING Geometric flight relates transla9on, pitch, and yaw, but does not constrain roil, the rota9on about the local Z axis.
This degree of freedom is used for banking-‐rolling the object to align the local Y axis with the (local XY component of the total) accelera9on ac9ng upon it.
The Bank angle is the angle at which the vehicle is inclined about its longitudinal axis with respect to its path.
BANKING
The magnitude of the turning accelera9on varies directly with the object's velocity and with the curvature of its path (so inversely with the radius of its turn).
With correct banking (what pilots call a coordinated turn) the object's local space remains aligned with the "perceptual" or "accelera9onal" coordinate system.
NATURAL FLOCKS, HERDS AND SCHOOLS
For a bird to par9cipate in a flock, it must have behaviors that allow it to coordinate its movements with those of its flockmates.
But these behaviors are not par9cularly unique; all creatures have them to some degree.
Natural flocks seem to consist of two balanced, opposing behaviors: • a desire to stay close to the flock • a desire to avoid collisions within the flock.
NATURAL FLOCKS, HERDS AND SCHOOLS
An individual bird must have a localized and filtered percep9on of the rest of the flock.
A bird might be aware of three categories: • Itself • its two or three nearest neighbors • the rest of the flock
The complexity of the flocking algorithm described is basically O(N²): • the work required to run the algorithm grows as the square of the flock's popula9on.
SIMULATED FLOCKS
In order of decreasing precedence, the behaviors that lead to simulated flocking are:
1) Collision Avoidance: avoid collisions with nearby flockmates
2) Velocity Matching: aaempt to match velocity with nearby
flockmates 3) Flock Centering: aaempt to stay close to nearby flockmates
SIMULATED FLOCKS
Sta9c collision avoidance and dynamic velocity matching are complementary.
Sta9c collision avoidance is based on the rela9ve posi9on of the flockmates and ignores their velocity.
Conversely, velocity matching is based only on velocity and ignores posi9on.
Sta9c collision avoidance serves to establish the minimum required separa9on distance; velocity matching tends to maintain it.
SIMULATED FLOCKS
Flock centering makes a boid want to be near the center of the flock.
Flock centering causes the boid to fly in a direc9on that moves it closer to the centroid of the nearby boids.
If a boid is deep inside a flock, the centroid of the neighborhood boids is approximately at the center of the neighborhood, so the flock centering urge is small.
But if a boid is on the boundary of the flock, the flock centering urge is stronger and the flight path will be deflected somewhat toward the local flock center.
SIMULATED FLOCKS
SeparaSon: steer to avoid crowding local flockmates
Alignment: steer towards the average heading of local flockmates
Cohesion: steer to move toward the average posi9on of local flockmates
The basic flocking model consists of three simple steering behaviors
ARBITRATING INDIPENDENT BEHAVIORS
The three behaviors that lead to simulated flocking produce accelera9on requests.
Each behavior has several parameters that control its func9on and that can vary the accelera9on requests.
The easiest way to combine accelera9on requests is a them weighted average.
But in cri9cal situa9ons, such as poten9al collision with obstacles, conflicts between accelera9on requests can be dangerous.
The solu9on is based on a strict priority ordering of all component behaviors.
ARBITRATING INDIPENDENT BEHAVIORS
The accelera9on requests are considered in priority order and added into an accumulator.
The magnitude of each request is measured and added into another accumulator.
This process con9nues un9l the sum of the accumulated magnitudes gets larger than the maximum accelera9on value, which is a parameter of each boid.
In an emergency the accelera9on would be allocated to sa9sfy the most pressing needs first.
SIMULATED PERCEPTION
The real bird's informa9on about the world is severely limited because it perceives through imperfect senses and because its nearby flockmates hide those farther away.
The simula9on must filter out the surplus informa9on that are available to the sobware that implements the boid's behavior.
The behaviors that make up the flocking model are stated in terms of nearby flockmates.
The neighborhood is defined as a spherical zone of sensi9vity centered at the boid's local origin.
SIMULATED PERCEPTION
Flocking requires that each boid reacts only to flockmates within a certain small neighborhood around itself.
The neighborhood is characterized by a distance (measured from the center of the boid) and an angle, measured from the boid's direc9on of flight.
Flockmates outside this local neighborhood are ignored.
AVOIDING ENVIRONMENTAL OBSTACLES
The Force Field model postulates a field of repulsion force emana9ng from the obstacle out into space; the boids are increasingly repulsed as they get closer to the obstacle.
If a boid approaches an obstacle surrounded by a Force Field at an angle such that it is exactly opposite to the direc9on of the force field, the boid will not turn away. In this case the force field serves only to slow the boid by accelera9ng it backwards and provides no side thrust at all.
The Force Fields tend to be too strong close up and too weak far away; avoiding an obstacle should involve long-‐range planning rather than panicky correc9ons at the last minute.
AVOIDING ENVIRONMENTAL OBSTACLES
Steer To Avoid is a beaer simula9on of a natural bird guided by vision.
The boid considers only obstacles directly in front of it (It finds the intersec9on, if any, of its local Z axis with the obstacle).
Working in local perspec9ve space, it finds the silhoueae edge of the obstacle closest to the point of eventual impact. A radial vector is computed which will aim the boid at a point one body length beyond that silhoueae edge.
CONCLUSIONS
This paper has presented a model of polarized, non-‐colliding, aggregate mo9on, such as that of flocks, herds and schools.
The model is based on simula9ng the behavior of each boid independently.
However it is difficult to objec9vely measure how valid these simula9ons are.
But having approached a certain level of realism in the model, the parameters of the simulated flock can be altered at will by the animator to achieve many varia9ons on flock-‐like behavior.