steering animation 數位內容學院 遊戲開發研究班第一期 3d 圖學 沈育德 edward shen...

41
Steering Animation 數數數數數數 數數數數數數數數 3D 數數 沈沈沈 Edward Shen May 19, 2005

Upload: cecily-russell

Post on 21-Jan-2016

238 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Steering Animation

數位內容學院遊戲開發研究班第一期

3D 圖學

沈育德 Edward ShenMay 19, 2005

Page 2: 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

Page 3: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Lecturer

• 沈育德 , Edward Shen• PhD Candidate (1st year)• Graphics group, Dept. of CSIE, National Taiwan

University• http://graphics.csie.ntu.edu.tw/~edwards/• [email protected]

Page 4: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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.

Page 5: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

System Demo – Dove

Page 6: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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.

Page 7: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Steering Behavior

• Steering – vi. ( 不及物動詞 intransitive verb )

1. 掌舵 , 操舵 ; 駕駛 , 操縱2. 沿著某一方向前進 3. 駕馭

– vt. ( 及物動詞 transitive verb ) 1. 為 ( 船 ) 掌舵 , 駕駛 ( 汽車、飛機等 ) 2. 沿著 ( 某一方向 ) 前進 , 取 ( 道 ) 3. 指導 , 控制

Page 8: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 9: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Applications

Source: http://www.imdb.com/gallery/ss/0266543/FNC-131.jpg http://www.conitec.net/gallery.htm

http://www.lordoftherings.net/legend/gallery/

Page 10: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Crowd (Flocking) Behavior

• Flocks of birds

• Schools of fishes

• Herds of land animals

Page 11: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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.

Page 12: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 13: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 14: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 15: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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).

Page 16: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Consider a Herd of Cattle… (cont’d)

• The steering level is represented by the cowboy • Sub-goals: approach the cow, avoid obstacles, r

etrieve the cow. • A sub-goal corresponds to a steering behavior fo

r 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.

Page 17: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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.

Page 18: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

The Hierarchy of Motion Behavior

Action Selection: strategy, goals, planning

Steering: path determination

Locomotion: animation, articulation

Page 19: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 20: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

“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

Page 21: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 22: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Java Applet Demo

Page 23: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 24: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 25: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

desired_velocity = normalize (position - target) * max_speed ;steering = desired_velocity - velocity ;

• Contrast with Arrive • Inverse of Seek: Flee

Page 26: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

• Steer away from the predicted future position of the target

• Inverse of Pursuit: Evade

Page 27: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 28: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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.

Page 29: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Obstacle Avoidance

• Unlike Flee, Obstacle Avoidance 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

Page 30: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 31: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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.

Page 32: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Wall Following

• Path Following (Surface path) + Offset Pursuit

Page 33: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 34: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Group of Characters

• Separation, Cohesion, and Alignment relate to groups of characters

• Characters outside the neighborhood are ignored

Page 35: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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)

Page 36: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 37: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 38: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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.

Page 39: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Leader Following

• One or more characters following another moving character (the leader)

• Arrival + Separation

Page 40: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

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

Page 41: Steering Animation 數位內容學院 遊戲開發研究班第一期 3D 圖學 沈育德 Edward Shen May 19, 2005

Download the Library