Flocks, Herds, and Schools: A Distributed Behavioral Model

24
Flocks, Herds, and Flocks, Herds, and Schools: A Distributed Schools: A Distributed Behavioral Model Behavioral Model By: Craig Reynolds By: Craig Reynolds Presented by: Presented by: Stephanie Grosvenor Stephanie Grosvenor

description

Flocks, Herds, and Schools: A Distributed Behavioral Model. By: Craig Reynolds Presented by: Stephanie Grosvenor. Flocks and Boids. Flock is a group of objects that exhibit the general class of polarized (aligned), non-colliding, aggregate motion - PowerPoint PPT Presentation

Transcript of Flocks, Herds, and Schools: A Distributed Behavioral Model

Page 1: Flocks, Herds, and Schools: A Distributed Behavioral Model

Flocks, Herds, and Flocks, Herds, and Schools: A Distributed Schools: A Distributed

Behavioral ModelBehavioral Model

By: Craig ReynoldsBy: Craig Reynolds

Presented by: Presented by:

Stephanie GrosvenorStephanie Grosvenor

Page 2: Flocks, Herds, and Schools: A Distributed Behavioral Model

Flocks and BoidsFlocks and Boids• FlockFlock is a group of objects that exhibit is a group of objects that exhibit

the general class of polarized the general class of polarized (aligned), non-colliding, aggregate (aligned), non-colliding, aggregate motion motion

• To simulate flock, simulate the To simulate flock, simulate the behavior of individual birdbehavior of individual bird– PerceptionPerception– Flight dynamicsFlight dynamics

• BoidBoid is a simulated bird-like object is a simulated bird-like object

Page 3: Flocks, Herds, and Schools: A Distributed Behavioral Model

How do we simulate a flock in How do we simulate a flock in computer animation? computer animation?

– Scripting is bad Scripting is bad – Particle system too simpleParticle system too simple– Make particle systems more complexMake particle systems more complex

•Local perceptionLocal perception

•Simulated physicsSimulated physics

•Flocking behaviorsFlocking behaviors

– Result of dense interaction of relatively Result of dense interaction of relatively simple behaviors of individually simple behaviors of individually simulated birdssimulated birds

Page 4: Flocks, Herds, and Schools: A Distributed Behavioral Model

Behavioral Animation Behavioral Animation

• Animator as a theatrical directorAnimator as a theatrical director

• Character's performance is the indirect result of Character's performance is the indirect result of the director's instructions to the actor. the director's instructions to the actor.

• Not know how a simulation is going to proceed Not know how a simulation is going to proceed from the specified behaviors and initial from the specified behaviors and initial conditions - many unexpected, pleasant conditions - many unexpected, pleasant surprises.surprises.

• Problem getting uncooperative flocks to move as Problem getting uncooperative flocks to move as intended ("these darn boids seem to have a mind intended ("these darn boids seem to have a mind of their own!"). of their own!").

Page 5: Flocks, Herds, and Schools: A Distributed Behavioral Model

Boids and Turtles Boids and Turtles

• Logo turtle Logo turtle – Movement forward, Movement forward,

back, left, rightback, left, right

• 3D turtles and their 3D turtles and their paths are equivalent paths are equivalent to boid objects and to boid objects and their flight pathstheir flight paths

• Simple rules for Simple rules for complex behaviorcomplex behavior

Page 6: Flocks, Herds, and Schools: A Distributed Behavioral Model

Geometric Flight Geometric Flight

• Flight - Dynamic, incremental, rigid Flight - Dynamic, incremental, rigid motion along a pathmotion along a path

• Geometrical transformation of an Geometrical transformation of an object, moving along and tangent to a object, moving along and tangent to a 3D curve3D curve

• Motion rigid - Underlying geometric Motion rigid - Underlying geometric model free to change shape within model free to change shape within flying coordinate systemflying coordinate system

Page 7: Flocks, Herds, and Schools: A Distributed Behavioral Model

Geometric Flight Geometric Flight

• Conservation of momentumConservation of momentum

• Simple model of viscous speed Simple model of viscous speed damping – not exceed maximum damping – not exceed maximum speed speed

• Minimum speed can be specifiedMinimum speed can be specified

• Maximum acceleration used to Maximum acceleration used to provide smooth changes of speed and provide smooth changes of speed and heading heading

Page 8: Flocks, Herds, and Schools: A Distributed Behavioral Model

Geometric Flight Geometric Flight

• Gravity modeled but only defines Gravity modeled but only defines banking behaviorbanking behavior

• Many physical forces not supported Many physical forces not supported

Page 9: Flocks, Herds, and Schools: A Distributed Behavioral Model

Banking Banking

• Magnitude of turning acceleration Magnitude of turning acceleration directly varies with object’s velocity directly varies with object’s velocity and with the curvature of its pathand with the curvature of its path

• Correct banking – object’s local space Correct banking – object’s local space remains aligned with the perceptual remains aligned with the perceptual or accelerational coordinate systemor accelerational coordinate system

• Makes boid fit viewer’s expectation of Makes boid fit viewer’s expectation of how flying objects should move and how flying objects should move and orient themselvesorient themselves

Page 10: Flocks, Herds, and Schools: A Distributed Behavioral Model

Natural Flocks, Herds, and Natural Flocks, Herds, and Schools Schools • Bird in flock must have behavior that allows Bird in flock must have behavior that allows

it to coordinate movement with flockmatesit to coordinate movement with flockmates

• Two balanced, opposing behaviorsTwo balanced, opposing behaviors– Desire to stay close to flockDesire to stay close to flock– Desire to avoid collisions within flockDesire to avoid collisions within flock

• Individuals don’t pay much attention to Individuals don’t pay much attention to each and every bird in flockeach and every bird in flock– Bird’s perception of the rest of flock is localized Bird’s perception of the rest of flock is localized

and filteredand filtered• ItselfItself

• Two or 3 nearest neighborsTwo or 3 nearest neighbors

• Rest of flockRest of flock

Page 11: Flocks, Herds, and Schools: A Distributed Behavioral Model

Simulated Flocks Simulated Flocks

• Collision AvoidanceCollision Avoidance– Avoid collisions with nearby Avoid collisions with nearby

flockmatesflockmates

• Velocity MatchingVelocity Matching– Attempt to match velocity Attempt to match velocity

with nearby flockmateswith nearby flockmates

• Flock CenteringFlock Centering– Attempt to stay close to Attempt to stay close to

nearby flockmatesnearby flockmates

Page 12: Flocks, Herds, and Schools: A Distributed Behavioral Model

Collision AvoidanceCollision Avoidance

• Urge to steer away from imminent Urge to steer away from imminent impactimpact

• Static collision avoidance based on Static collision avoidance based on relative position of flockmatesrelative position of flockmates

• Ignores velocityIgnores velocity

Page 13: Flocks, Herds, and Schools: A Distributed Behavioral Model

Velocity MatchingVelocity Matching• Looks only at velocityLooks only at velocity

– Ignores positionIgnores position

• Predictive version of collision Predictive version of collision avoidanceavoidance– If boid does a good job of matching If boid does a good job of matching

velocity with neighbors – collision in near velocity with neighbors – collision in near future unlikelyfuture unlikely

• Static collision avoidance and dynamic Static collision avoidance and dynamic velocity matching are complementaryvelocity matching are complementary

• Static collision avoidance serves to Static collision avoidance serves to establish minimum required establish minimum required separation distance – velocity separation distance – velocity matching maintains itmatching maintains it

Page 14: Flocks, Herds, and Schools: A Distributed Behavioral Model

Flock CenteringFlock Centering

• Boid localized perception of world center Boid localized perception of world center of flock actually means center of nearby of flock actually means center of nearby flockmatesflockmates

• Causes boid to fly in a direction that Causes boid to fly in a direction that moves it closer to centroid of nearby boidsmoves it closer to centroid of nearby boids

• If a boid is close to the center of the flock If a boid is close to the center of the flock this will have little effect (since the boid this will have little effect (since the boid density will be uniform), but if it is on the density will be uniform), but if it is on the edges then it will have a greater effect. edges then it will have a greater effect.

• Correctly allows simulated flocks to splitCorrectly allows simulated flocks to split

Page 15: Flocks, Herds, and Schools: A Distributed Behavioral Model

Arbitrating Independent Arbitrating Independent Behaviors Behaviors • three behavioral urges associated with three behavioral urges associated with

flocking each expressed as acceleration flocking each expressed as acceleration requestsrequests

• Behavior has several parameters – Behavior has several parameters – including strength, further accentuate the including strength, further accentuate the acceleration requestacceleration request

• Navigation module of boid brain to collect Navigation module of boid brain to collect relevant acceleration requests and then relevant acceleration requests and then determine single behaviorally desired determine single behaviorally desired accelerationacceleration

• Weighted average according to priorityWeighted average according to priority

• Not good for collision with obstacles - Not good for collision with obstacles - Weighted average may cancel (opposite Weighted average may cancel (opposite directions)directions)

Page 16: Flocks, Herds, and Schools: A Distributed Behavioral Model

Arbitrating Independent Arbitrating Independent Behaviors Behaviors • Acceleration requests considered in Acceleration requests considered in

priority order and added to priority order and added to accumulatoraccumulator

• Magnitude added to another Magnitude added to another accumulatoraccumulator

• Continue until sum of accumulated Continue until sum of accumulated magnitudes larger than maximum magnitudes larger than maximum acceleration value acceleration value

• Emergency acceleration allocated to Emergency acceleration allocated to satisfy pressing needs firstsatisfy pressing needs first

• Example: Centering ignored in order to Example: Centering ignored in order to maneuver around obstaclesmaneuver around obstacles

Page 17: Flocks, Herds, and Schools: A Distributed Behavioral Model

Simulated Perception Simulated Perception

• Perception model tries to model real Perception model tries to model real birdbird

• Filtering out surplus information that Filtering out surplus information that implements boid’s behaviorimplements boid’s behavior

• Real bird imperfect senses – nearby Real bird imperfect senses – nearby flockmates hide those farther awayflockmates hide those farther away– Strongly localized information availableStrongly localized information available

• Aggregate motion of flocking depends Aggregate motion of flocking depends on limited localized view of worldon limited localized view of world

Page 18: Flocks, Herds, and Schools: A Distributed Behavioral Model

Each boid has direct access to the whole scene‘s Each boid has direct access to the whole scene‘s geometric description, but flocking requires that it geometric description, but flocking requires that it reacts only to flockmates within a certain small reacts only to flockmates within a certain small neighborhood around itself. neighborhood around itself.

The neighborhood is characterized by a The neighborhood is characterized by a distancedistance (measured from the center of the boid) and an (measured from the center of the boid) and an angle,angle, measured from the boid's direction of flight. measured from the boid's direction of flight.

Flockmates outside this local neighborhood are Flockmates outside this local neighborhood are ignored.ignored.

The neighborhood defining the region in which The neighborhood defining the region in which flockmates influence a boids steering. flockmates influence a boids steering.

Page 19: Flocks, Herds, and Schools: A Distributed Behavioral Model

Scripted Flocking Scripted Flocking • Happy aimless flocking is good – direction betterHappy aimless flocking is good – direction better• Direct motion at specific timesDirect motion at specific times• Simulations under control of general-purpose Simulations under control of general-purpose

animation scripting systemanimation scripting system• Interactive motion control facilities – provides ability Interactive motion control facilities – provides ability

to schedule invocation of user-supplied software on to schedule invocation of user-supplied software on a frame by frame basis a frame by frame basis

• Describe Timing of flock actions Describe Timing of flock actions • Flexible Control over time varying values of Flexible Control over time varying values of

parametersparameters• Set up and animate all nonbehavioral aspects of Set up and animate all nonbehavioral aspects of

scenescenebackground/lighting/camera motion/ visible objectsbackground/lighting/camera motion/ visible objects

Page 20: Flocks, Herds, and Schools: A Distributed Behavioral Model

Scripted FlockingScripted Flocking

• Migratory urge – global target (global Migratory urge – global target (global direction)direction)

• Global position – a target point toward Global position – a target point toward which birds fly (going z for the winter)which birds fly (going z for the winter)

• Bounded acceleration, incrementally turns Bounded acceleration, incrementally turns boid toward migratory targetboid toward migratory target

• Animate dynamic parameter – global Animate dynamic parameter – global position vector, global direction vectorposition vector, global direction vector

• Animate goal point along desired pathAnimate goal point along desired path

Page 21: Flocks, Herds, and Schools: A Distributed Behavioral Model

Avoiding Environmental Avoiding Environmental Obstacles Obstacles • Two types of shapes of environmental collision Two types of shapes of environmental collision

avoidanceavoidance– Force field Force field – Steer-to-avoidSteer-to-avoid

• Force FieldForce Field– Field of repulsion force emanating from obstacle out into Field of repulsion force emanating from obstacle out into

spacespace– Boid increasingly repulsed as it gets closer to obstacleBoid increasingly repulsed as it gets closer to obstacle

• Problem Problem – approach obstacle surrounded by a force field at angle approach obstacle surrounded by a force field at angle

such that exactly opposite to direction of force field such that exactly opposite to direction of force field – Worst case scenario – fail to turn Worst case scenario – fail to turn – Problem with peripheral visionProblem with peripheral vision– Too strong up close/ too weak far awayToo strong up close/ too weak far away

• Want long-range planning to avoid obstacles, not Want long-range planning to avoid obstacles, not panicky correctionpanicky correction

• Steer-to-avoid more robust - naturalSteer-to-avoid more robust - natural

Page 22: Flocks, Herds, and Schools: A Distributed Behavioral Model

Avoiding Environmental Avoiding Environmental ObstaclesObstacles• Steer-to-avoidSteer-to-avoid• Obstacles that are directly in Obstacles that are directly in

front of boid (where local z front of boid (where local z and obstacle intersect)and obstacle intersect)

• Silhouette edge of obstacle is Silhouette edge of obstacle is closest to point of eventual closest to point of eventual impactimpact

• Radial vector computed – Radial vector computed – aim boid at point 1 body aim boid at point 1 body length beyond silhouette length beyond silhouette edgeedge

Page 23: Flocks, Herds, and Schools: A Distributed Behavioral Model

Other Applications of the Flock Other Applications of the Flock Model Model

Polarized, noncolliding aggregate Polarized, noncolliding aggregate motion motion

• Traffic patterns, fish, locomotion, Traffic patterns, fish, locomotion, crowdscrowds

• Scientific investigationScientific investigation

Page 24: Flocks, Herds, and Schools: A Distributed Behavioral Model

Questions?Questions?