410 likes | 781 Views
Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005 Course Information Date : 5/19, 5/21, 5/26, 5/28 (2005) Lecturer : Edward Yu-Te Shen 沈育德 Course Website: http://graphics.csie.ntu.edu.tw/~edwards/dokuwiki/doku.php?id=lecture Lecturer 沈育德 , Edward Shen
E N D
Steering Animation 數位內容學院 遊戲開發研究班第一期 3D圖學 沈育德 Edward Shen May 19, 2005
Course Information • Date: 5/19, 5/21, 5/26, 5/28 (2005) • Lecturer: Edward Yu-Te Shen 沈育德 • Course Website: http://graphics.csie.ntu.edu.tw/~edwards/dokuwiki/doku.php?id=lecture
Lecturer • 沈育德, Edward Shen • PhD Candidate (1st year) • Graphics group, Dept. of CSIE, National Taiwan University • http://graphics.csie.ntu.edu.tw/~edwards/ • edwards@cmlab.csie.ntu.edu.tw
Introduction to Steering Animation • System demo – Dove • Introduction to steering behavior • Hierarchy of motion behaviors • Java applet demo • Steering styles • Trial of the OpenSteer library • Most of the content today bases on Reynolds, C. W. (1999) Steering Behaviors For Autonomous Characters, in the proceedings of Game Developers Conference 1999, California. Pages 763-782.
Introduction to Steering Animation • System demo – Dove • Introduction to steering behavior • Hierarchy of motion behaviors • Java applet demo • Steering styles • Trial of the OpenSteer library • Most of the content today bases on Reynolds, C. W. (1999) Steering Behaviors For Autonomous Characters, in the proceedings of Game Developers Conference 1999, California. Pages 763-782.
Steering Behavior • Steering • vi. ( 不及物動詞 intransitive verb )1. 掌舵,操舵;駕駛,操縱2. 沿著某一方向前進 3. 駕馭 • vt. ( 及物動詞 transitive verb )1. 為(船)掌舵,駕駛(汽車、飛機等) 2. 沿著(某一方向)前進,取(道) 3. 指導,控制
Steering Behavior • The ability of creatures to navigate around their world in a life-like and improvisational manner • Steering behavior is one of the key components in building autonomous agents in animation • Important in making films that tell stories, games, and other virtual reality applications
Applications Source: http://www.imdb.com/gallery/ss/0266543/FNC-131.jpg http://www.conitec.net/gallery.htm http://www.lordoftherings.net/legend/gallery/
Crowd (Flocking) Behavior • Flocks of birds • Schools of fishes • Herds of land animals
Flocks: Lots of Contrasts • Made up of discrete birds: overall motion seems fluid • Simple in concept: complex scene • Randomly arrayed: magnificently synchronized. • The strong impression of intentional, centralized control: merely the aggregate result of individual animals, each acting based on its own local perception.
Difficulties • Scripting paths for individual characters • Tedious for large amount of characters • Hard to maintain the flock motion constraints (e.g. collision prevention) • Hard to edit • Not ideal for efficient, robust, believable flock animation
A Distributed Approach • A flock is assumed to be the result of the interaction between behaviors of individual characters • Simulating the flock by simulating the individuals
Introduction to Steering Animation • System demo – Dove • Introduction to steering behavior • Hierarchy of motion behaviors • Java applet demo • Steering styles • Trial of the OpenSteer library
Consider a Herd of Cattle… • A cow wanders away from the herd. The trail boss tells a cowboy to fetch the stray. The cowboy says “giddy-up” to his horse and guides it to the cow, possibly avoiding obstacles along the way. • In this example, the trail boss represents action selection: noticing that the state of the world has changed (a cow left the herd) and setting a goal (retrieve the stray).
Consider a Herd of Cattle… (cont’d) • The steering level is represented by the cowboy • Sub-goals: approach the cow, avoid obstacles, retrieve the cow. • A sub-goal corresponds to a steering behavior for the cowboy-and-horse team. Using various control signals (vocal commands, spurs, reins) the cowboy steers his horse towards the target. In general terms, these signals express concepts like: go faster, go slower, turn right, turn left, and so on.
Consider a Herd of Cattle… (cont’d) • The horse implements the locomotion level. Taking the cowboy’s control signals as input, the horse moves in the indicated direction. • This motion is the result of a complex interaction of the horse’s visual perception, its sense of balance, and its muscles applying torques to the joints of its skeleton.
The Hierarchy of Motion Behavior Action Selection: strategy, goals, planning Steering: path determination Locomotion: animation, articulation
Path-Finding • A topic related to, but separate from our topic. • A search problem, can be achieved by A* or Dijkstra’s algorithm • Used in RenderWare AI
“Fast” Motion • Running v.s. crawling • The characters’ typical velocities are large relative to their maximum accelerations • Therefore, the steering behavior must anticipate the future, and take account eventual consequences of current actions
Introduction to Steering Animation • System demo – Dove • Introduction to steering behavior • Hierarchy of motion behaviors • Java applet demo • Steering styles • Trial of the OpenSteer library
Introduction to Steering Animation • System demo – Dove • Introduction to steering behavior • Hierarchy of motion behaviors • Java applet demo • Steering styles • Trial of the OpenSteer library
Steering Behaviors • At each time step, a character exhibits a velocity vector, and will apply a new steering force according to the result of its action selection • The steering force consists of turning force, braking force, and so on
Seek and Flee • Steering towards a specified position by adjusting the velocity aligned to it • Different from the attractive force (gravity) • Steering force different from the desired velocity • Contrast with Arrive • Inverse of Seek: Flee desired_velocity = normalize (position - target) * max_speed ;steering = desired_velocity - velocity ;
Pursuit and Evade • Similar to Seek, but the target is moving • Future position is predicted at each time step • Position(T units of time in the future): scaling the velocity by T and adding it to the current position • Inverse of Pursuit: Evade • Steer away from the predicted future position of the target
Offset Pursuit • Passes near, but not directly into a moving target • Flying near enough to be within weapon range without colliding with the target • Compute a target point given a radius R from the target’s predicted position, and seek the point
Arrival • Identical to Seek while the character is far from its target • Slow down as approaching the target, eventually slowing to a stop coincident with the target • The desired velocity is clipped to max_speed outside the stopping radius, and inside it is ramped down (e.g. linearly) to zero.
Obstacle Avoidance • Unlike Flee, ObstacleAvoidance takes action only when a nearby obstacle directly in front of it. • Assume that both the character and obstacle can be reasonably approximated as spheres • Cylinder for detecting potential collision • “Most threatening” character • Return 0 if no obstacles
Wandering • Random steering force produces “twitchy” motion • Retaining steering direction states and make small random displacements using a sphere ahead. • See [Beer90] and [Tu96] for Explore and Forage steering styles
Path Following • The individual paths go near, and often parallel to, the centerline, but are free to deviate from it. • If far way initially, first approach, then follow it.
Wall Following • Path Following (Surface path) + Offset Pursuit
Unaligned Collision Avoidance • Prevent running into each other • If all nearby characters are aligned, a less complex strategy (Separation) can be used • Steer to turn away, accelerate or decelerate to prevent potential collisions
Group of Characters • Separation, Cohesion, and Alignment relate to groups of characters • Characters outside the neighborhood are ignored
Separation • Maintain a certain separation distance from others • First, find those within the specified neighborhood • Each neighbor contributes a repulsive force with a weighting value (e.g. 1/r)
Cohesion • Giving the ability to cohere with (approach and form a group with) other nearby characters • After finding neighbors, compute the “average position” (or “center of gravity”) of them • Seek that position
Alignment • Align a character with (that is, head in the same direction and/or speed as) nearby characters • Use the average velocity or forward vector as desired velocity
Flocking/Crowd Behavior • Combining Separation, Cohesion, and Alignment steering styles • Better normalizing the three components, and then summing with weighting parameters • Therefore, flocking behavior is specified by nine numerical parameters: a weight, a distance and an angle (to define the neighborhood) for each of the components.
Leader Following • One or more characters following another moving character (the leader) • Arrival + Separation
Introduction to Steering Animation • System demo – Dove • Introduction to steering behavior • Hierarchy of motion behaviors • Java applet demo • Steering styles • Trial of the OpenSteer library