0% found this document useful (0 votes)
16 views66 pages

ARVc 3

The document outlines advanced techniques in computer animation and virtual reality, focusing on topics such as automatic camera control, hierarchical kinematic modeling, forward and inverse kinematics, and rigid body simulation. It details the methods for controlling camera positioning, modeling articulated structures, and calculating joint angles for animations. The content is structured for a course in Digital Game Design at the University of Beira Interior for the academic year 2014/2015.

Uploaded by

Tiago
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views66 pages

ARVc 3

The document outlines advanced techniques in computer animation and virtual reality, focusing on topics such as automatic camera control, hierarchical kinematic modeling, forward and inverse kinematics, and rigid body simulation. It details the methods for controlling camera positioning, modeling articulated structures, and calculating joint angles for animations. The content is structured for a course in Digital Game Design at the University of Beira Interior for the academic year 2014/2015.

Uploaded by

Tiago
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

ANIMATION

&
VIRTUAL REALITY

2º Ciclo em:
Engenharia Informática
Design e Desenvolvimento de Jogos Digitais

DI – UBI 2014/2015

Program
! Computer Animation vs Traditional Animation
! Basic Techniques
! Advanced Techniques
! Modeling and Animating Articulated models
! Animating Natural Phenomena
! Virtual Reality/Virtual Environments

1
Chapter 3

! Advanced Techniques
! Automatic Camera Control
! Hierarchical Kinematic Modeling

! Forward Kinematics

! Inverse Kinematics

! Rigid Body Simulation

! Flexible Objects

! Controlling Groups of Objects

Automatic Camera Control

! Position and orientation of the camera


! Capture conversation
! Follow action

! Emphasize spatial qualities

! The animator is more concerned with effectively


showing an action taking place than with getting a
particular camera angle.

2
Automatic Camera
Control (cont.)

! When using high-level algorithms to control the


motion of objects

! The animator may not be able to anticipate the exact


positions of objects during the animation!

! So, it is difficult to know exactly how to position and


orient the camera

Automatic Camera
Control (cont.)

! Camera position + center-of-interest

! Center-of-interest
" Relative to the positions of one or more objects in the animation

! A static camera can be used to track an object by


attaching the center of interest to the object center point

3
Automatic Camera
Control (cont.)

! Constrain the Camera’s Position

! Predefined plane
" Keep the camera at a specified altitude so that it can capture the
action below.

! Along a line segment or curve


" Path following

Automatic Camera
Control (cont.)

! A Camera can be attached to an object of


interest

! Thefront or “Over the shoulder”


! A point directly above

! Efficient use of automatic control requires


experience.

4
Chapter 3

! Advanced Techniques
! Automatic Camera Control
! Hierarchical Kinematic Modelling

! Forward Kinematics

! Inverse Kinematics

! Rigid Body Simulation

! Flexible Objects

! Controlling Groups of Objects

Hierarchical Kinematic Modeling

! Hierarchical modeling is the enforcement of


connectivity constraints among objects organized in a
treelike structure.

! Planetary system are one type of hierarchical model


! Moons rotate around planets;
! Planets rotate around a sun;

! Which move in a galaxy.

5
Hierarchical Kinematic Modeling (cont.)

! Hierarchical models or Articulated models


! Objects are connected end to end to form multibody
jointed chains.
! Useful for modeling
animals and humans.
! The hierarchical structure
of the model maintains
automatically the limbs
attached one to another.

Hierarchical Kinematic Modeling (cont.)

! Typical joints used in computer animation


! Revolute join
" One link rotate about a
fixed point of the other
link

! Prismatic join
" One link translates
relative to another

6
Hierarchical Kinematic Modeling (cont.)

! These joints allow motion in one direction.


! So, have one Degree Of Freedom (DOF).

Hierarchical Kinematic Modeling (cont.)

! Structures in which more than one degree of freedom


are coincident are called complex joints.

! Complex joints
! Planar joint (2 DOF)

! Ball-and-socket joint (3 DOF)

! Typically, when a joint has more


than one (n>1) DOF, it is modeled as a set
of n one-degree-of-freedom joints connected.

7
Hierarchical Kinematic Modeling (cont.)

! Hierarchical models are represented by a tree


structure of nodes connected by arcs.

! The highest node of the tree is the route node.


" Corresponds to the root object of the hierarchy whose position is
known in global coordinate system.

! The position of all other nodes of the hierarchy will be


located relative to the route node.

Hierarchical Kinematic Modeling (cont.)

! A global transformation is applied to the root node, and


therefore, indirectly to all of the nodes of the tree.
! This transformation can changed over time in order to animate
the position and orientation of the rigid structure.

8
Hierarchical Kinematic Modeling (cont.)

! A node of the tree structure contains the information


necessary to define de object part.

! Rotational Joints
" The point of rotation on the object part is made to coincide with the
origin.

Hierarchical Kinematic Modeling (cont.)

! Arc and node definition

9
Hierarchical Kinematic Modeling (cont.)

! The vertices of a particular object can be


transformed to their final positions by concatenating
the transformations higher up the tree and applying
the composite transformation matrix to the vertices.

! TC=T0.T1.T2.T3 T0
T1
T2
T3

Chapter 3

! Advanced Techniques
! Automatic Camera Control
! Hierarchical Kinematic Modeling

! Forward Kinematics

! Inverse Kinematics

! Rigid Body Simulation

! Flexible Objects

! Controlling Groups of Objects

10
Forward Kinematics
! Kinematics
! The motion of objects without reference to the forces which
cause the motion.

Forward: A=f(α,β ) Inverse: α,β =f -1(A)

Forward Kinematics (cont.)


! Evaluation of a hierarchy by traversing the
corresponding tree produces the model in a position
that reflects the setting of the joint parameters.

! The traversal follows a depth-first pattern from root


to the leaf node.

11
Forward Kinematics (cont.)

! A completely specified set of rotation parameters is


a pose.
! In a simple animation
! A user may determine a key position interactively then
interpolate joint rotations between key positions.
! Positioning a model by specifying all of the joint
angles is called forward kinematics.
! Can be a tedious for the user.
! It is a trial-and-error process.

Forward Kinematics (cont.)

! To avoid the difficulties in having to specify all of the


joint angles, inverse kinematics is sometimes used.
! The desired position and orientation of the end effector
are given and the internal joint angles are calculated
automatically.

12
Local Coordinate Frames

# A transformation matrix is associated with each arc


#Transform a point from the local coordinate space of a child
node to the local coordinate space of the parent node.

#Successively applying the matrices farther up the hierarchy can


transform a point from any position in the tree into world
coordinates for display.

#The inverse of the transformation matrix can be used to


transform a point from the parent’s frame to the child’s frame.

Local Coordinate
Frames (cont.)

! Denavit-Hartenberg Notation
! Is a particular way of describing the relationship of a
parent coordinate frame to a child coordinate frame.
" This convention is commonly used in robotics and often adopted
for use in computer animation.

! Each frame is described relative to an adjacent frame by


four parameters:
" Two displacement (positions)
" Two orientations

13
Local Coordinate
Frames (cont.)

! Denavit-Hartenberg (DH) Notation


! A simple configuration in which the joints and axes of rotation
are coplanar.
" Revolute
joints

Local Coordinate
Frames (cont.)

! Nonplanar configurations can be represented by including


the two other DH parameters.

14
Local Coordinate
Frames (cont.)
! DH Notation (general case)

! di+1 and θi+1 are the translation and rotation of the i+1 joint
relative to the ith joint with respect to the ith joint’s z-axis.
! ai and αi are the translation and rotation of the
i+1 joint with respect to the ith joint’s x-axis.

Local Coordinate
Frames (cont.)

! DH Notation
Example:
! Point Vi+1 in coordinate system of joint i+1
! The coordinates in terms of joint i are:

Vi = TX (ai ) RX (α i )TZ (d i +1 ) RZ (θ i +1 )Vi +1

15
Local Coordinate
Frames (cont.)

! DH Notation (example)
Vi = TX (ai ) RX (α i )TZ (d i +1 ) RZ (θ i +1 )Vi +1
⎡cos(θ i +1 ) − sin(θ i +1 )
0 0⎤ ⎡1 0 0 0 ⎤
⎢ sin(θ ) cos(θ ) 0 0⎥⎥ ⎢0 1 0 0 ⎥⎥
i +1 i +1
RZ (θ i +1 ) = ⎢ TZ (d i +1 ) = ⎢
⎢ 0 0 1 0⎥ ⎢0 0 1 d i +1 ⎥
⎢ ⎥ ⎢ ⎥
⎣ 0 0 0 1⎦ ⎣0 0 0 1 ⎦
⎡1 0 0 0⎤ ⎡1 0 0 ai ⎤
⎢0 cos(α i ) − sin(α i ) 0⎥⎥ ⎢0 1 0 0 ⎥⎥
RX (α i ) = ⎢ TX (ai ) = ⎢
⎢0 sin(α i ) cos(α i ) 0⎥ ⎢0 0 1 0 ⎥
⎢ ⎥ ⎢ ⎥
⎣0 0 0 1⎦ ⎣0 0 0 1 ⎦

Local Coordinate
Frames (cont.)

! DH Notation (example)
Vi = TX (ai ) RX (α i )TZ (d i +1 ) RZ (θ i +1 )Vi +1
⎡ cos(θ i +1 ) − sin(θ i +1 ) 0 ai ⎤
⎢cos(α ). sin(θ ) cos(α ). cos(θ ) − sin(α ). − d . sin(α )⎥
i i +1 i i +1 i i +1 i ⎥
M ii +1 = ⎢
⎢ sin(α i ). sin(θ i +1 ) sin(α i ). cos(θ i +1 ) cos(α i ) d i +1. cos(α i ) ⎥
⎢ ⎥
⎣ 0 0 0 1 ⎦

Vi = M ii +1Vi +1 (
Vi +1 = M ii +1 Vi
−1
)

16
Local Coordinate
Frames (cont.)
! Simple manipulator using three Revolute Joint

Local Coordinate
Frames (cont.)

! Including a
Ball-and-Socket
Joint

17
Chapter 3

! Advanced Techniques
! Automatic Camera Control
! Hierarchical Kinematic Modeling

! Forward Kinematics

! Inverse Kinematics

! Rigid Body Simulation

! Flexible Objects

! Controlling Groups of Objects

Inverse Kinematics

! The user defines the desired position and orientation of


the end effector, and the joint angles are calculated
automatically.

! The problem can have zero, one, or


more solutions.

18
Inverse Kinematics (cont.)

! If there are so many constrains on the configuration


that no solution exists
! The system is called overconstrained

! If there are relatively few constrains on the system


and there are many solutions
! The system is called underconstrained

Inverse Kinematics (cont.)

! If the mechanism is simple enough, then the joint


angles can be calculated analytically.

! However, if the mechanism is too complicated for


analytic solutions, then an incremental approach
can be used.
! The end effector is iteratively nudged until the final configuration is
attained within a given tolerance.

19
Inverse Kinematics (cont.)

! Solving a simple System by Analysis


! A simple two-link arm in two-dimensional space

Inverse Kinematics (cont.)

! Any position between |L1-L2| and L1+L2 can be


reached.

20
Inverse Kinematics (cont.)

! The first step is to make sure that the position of the goal is
within the reach of the end effector.

L1− L2 ≤ X 2 + Y 2 ≤ L1+ L2

! But, how to calculate θ1 and θ2?

Cosine Rule

2 2 2
C = A + B − 2 ⋅ A ⋅ B ⋅ cos(θ )
2 2 2
A +B −C
cos(θ ) =
B 2⋅ A ⋅ B
θ

A
C

21
Inverse Kinematics (cont.)

X
cos(θT ) =
X2 +Y2
X
θT = acos( 2 2
)
X +Y
2

cos(θ1 − θT ) =
L12 + ( X2 +Y2 ) − L2 2

(cosine rule)
2 2
2 ⋅ L1⋅ X € +Y
⎛ L12 + X 2 + Y 2 − L2 2 ⎞
θ1 = acos⎜ ⎟ + θT
⎝ 2 ⋅ L1⋅ X 2 + Y 2 ⎠

Inverse Kinematics (cont.)

cos(180 − θ 2 ) =
L12 + L2 2 − ( X2 +Y2 ) (cosine rule)
2 ⋅ L1⋅ L2
⎛ L12 + L2 2 − (X 2 + Y 2 ) ⎞
θ 2 = acos⎜ ⎟
⎝ 2 ⋅ L1⋅ L2 ⎠


22
Inverse Kinematics (cont.)

! Most mechanisms of interest to computer animation


are too complex to allow an analytic solution.
" So, the motion can be incrementally constructed.
" At each time step, a computation is performed that
determines the best way to change each joint angle in order
to direct the current position and orientation of the end
effector toward the desired configuration.
" The computation forms the matrix of partial derivatives called
the Jacobian.

Inverse Kinematics (cont.)

! Example
Consider the simple three-revolute-joint

! The axis of rotation of each joint is


perpendicular to the figure.

23
Inverse Kinematics (cont.)

! The effect of an incremental rotation gi of each joint can be


determined by:

gi = ri × vi

cross product
r2

! The magnitude of each gi is a function of the distance


between the location of the joint
and the end effector.

Inverse Kinematics (cont.)

! The gi’s are recalculated


in each step.

! Normally, the path is


not linear.

24
Chapter 3

! Advanced Techniques
! Automatic Camera Control
! Hierarchical Kinematic Modeling

! Forward Kinematics

! Inverse Kinematics

! Rigid Body Simulation

! Flexible Objects

! Controlling Groups of Objects

Rigid Body Simulation

! A common objective in computer animation is to create


realistic-looking motion.
! Physically based reaction of rigid bodies to forces as:
" Gravity
" Viscosity
" …
" Forces resulting from collisions

! Creating realistic motion with keyframe techniques can be a


daunting task.

25
Rigid Body Simulation (cont.)

! The equations of motion can be incorporated into an


animation system to automatically calculate these reactions.

! In rigid body simulation, various forces to be simulated are


in the systems. These forces arise due to relative positioning
of objects (e.g., gravity, collisions), object velocity (e.g.,
viscosity) or position of objects in user-specified vector
fields (e.g., wind).

Rigid Body Simulation (cont.)

! When applied to objects, these forces induce linear and


angular accelerations based on the mass of the object (in the
linear case) and mass distribution of the object (in the
angular case).

! Accelerations are integrated over a delta time step to


produces changes in object velocity.

! Velocities are integrated over a delta time step to produces


changes in object positions and orientations.

26
Rigid Body Simulation (cont.)

Object properties (position,


orientation, linear and Calculate forces
angular velocity, linear and (wind, gravity, ...)
angular momentum, mass)

Calculate changes in object’s Calculate accelerations


positions, orientation, from object's mass
velocities, momentum

Rigid body simulation update cycle

Rigid Body Simulation (cont.)

! Example – A point in space

! To update the position of the point over time, its position x(t),
velocity v(t), and acceleration a(t), are used.

! If there are no forces applied to a point


" A point’s acceleration is zero
" Its velocity remains constant

27
Rigid Body Simulation (cont.)

! In the absence of acceleration, the point’s position is update


by its velocity:

x(t+dt) = x(t) + v(t) . dt

! A point velocity is update by its acceleration:

v(t+dt) = v(t) + a(t) . dt

! Accelerations arises from forces applied to an object over


time.

Rigid Body Simulation (cont.)

! To simplify the computation, a point’s acceleration is usually


assumed to be constant over the time period dt.
A point’s position is update by the average velocity during the
time period dt.

x(t+dt) = x(t) + ( (v(t) + v(t+dt) )/2) . dt

x(t+dt) = x(t) + v(t) . dt + ½ a(t) . dt2

! So, we can define the update position in terms


of the position, velocity and acceleration.

28
Rigid Body Simulation (cont.)

! Modeling of a
point position at
discrete time
intervals.

Rigid Body Simulation (cont.)

! A note about Numeric Approximation


! The assumption that the acceleration remains
constant over the delta time step is incorrect in most
rigid body simulations;
" Many forces continually vary as the object changes its position and
velocity over time.

! Sampling the force at the beginning of the time step


and using that to determine the acceleration
throughout the time step is not the best approach.

29
Rigid Body Simulation (cont.)

! Accuracy can be increased by taking smaller steps, but this


can prove to be computationally expensive!
! Accuracy can also be increased by using better methods of
integration.
" Runge-Kutta is a particular useful one.

! Second-order Runge-Kutta
" Which uses derivative information from the midpoint of the stepping
interval.
! Higher-order Runge-Kutta methods are more accurate (e.g.,
fourth- or fifth-order Runge-Kutta).

Rigid Body Simulation (cont.)

! Fourth-order Runge-Kutta

30
Rigid Body Simulation (cont.)

! Equations of Motion for a Rigid Body


! When a force is applied to an object not directly in line with
its center of mass it is needs to consider the torque.

! To uniquely solve for the resulting motions of interacting


objects, linear momentum and angular momentum have to be
conserved.

! To calculate the angular momentum, the distribution of an


object’s mass in space must be characterized by its inertia
tensor.

31
Rigid Body Simulation (cont.)

! Orientation and Rotational Movement


! Similar to linear attributes of position, velocity and
acceleration, 3D objects have rotational attributes of
orientation, angular velocity, and angular acceleration as
function of time
! If an individual point in space is modeled, such as in a
particle system, then its rotational information can be
ignored.
! Otherwise the physical extent of the mass of an object needs
to be taken into consideration in realistic physical simulations.

Rigid Body Simulation (cont.)

! Angular velocity ω(t )


! It is the rate at which the object is
rotating irrespective of its linear velocity.
! It is represented by a vector, ω(t ).
" The direction of the vector indicates the orientation of the axis about
which the object is rotating.
" The magnitude of the angular velocity vector gives the speed of the
rotation in revolutions per unit of time.

32
Rigid Body Simulation (cont.)

! Center of Mass
! In computer graphics, the mass distribution of an object
is typically modeled by individual points, which is usually
implemented by assigning a mass value to each of the
object’s vertices.
! If the individual masses are given by mi, then the total
mass of the object is given by

M = ∑ mi

Rigid Body Simulation (cont.)

! Center of Mass
! Assuming that x(t ) is the center of mass of an object.
! If the location of each mass point in world space is given
by qi(t ), then the center of mass is represented by:

x(t ) =
∑ m ⋅ q (t )
i i

33
Rigid Body Simulation (cont.)

! Forces
! A linear force, F, applied to a mass, m, gives rise to a linear
acceleration, a.

F = m⋅a
! This fact provides a way to calculate acceleration from the
application of forces.

F
a=
m

Rigid Body Simulation (cont.)

! Forces
! The various forces acting on a point can be summed to form the
total external force, F(t ).

F (t ) = ∑ f i (t )
! The rotational equivalent of linear force is torque. The torque
that arises from the application of forces acting on a point of
an object is given by:

τ (t ) = ∑τ t (t )

34
Rigid Body Simulation (cont.)

! Momentum (mass times velocity)


! The momentum of an object is decomposed into a linear
component and an angular component.

" The linear component acts on this center of mass;

" The angular component is with respect to this center of mass.

Rigid Body Simulation (cont.)

" The linear momentum is (mass times velocity):


p = m⋅v
" The total linear momentum P(t) of a rigid body is the sum of
the linear momentums of each particle.

P(t ) = ∑ mi ⋅ q i (t )
" If the center of mass coincides with the origin of the
coordinate system, then
P(t ) = M .v(t )

35
Rigid Body Simulation (cont.)

! Since the mass of the object remains constant, it is possible


establishes a relationship between linear momentum and
linear forces:
⋅ ⋅
P(t ) = M . v(t ) = F (t )
! So, the forces acting on a body is equal to the change in
momentum;
! Interactions composed of equal but opposite forces result in
no change in momentum.

Rigid Body Simulation (cont.)

! The angular momentum is a measure of the rotating mass


weighted by the mass’s distance from the axis of rotation.
" p is the linear momentum;
" r is the vector from the center of rotation to the point where the force
is applied to the object.

L = r× p

36
Rigid Body Simulation (cont.)

! However, the angular velocity of an object does not


necessarily remains constant even in the case of no torque.
! The angular velocity can change if the distribution of mass of
an object changes.
! Angular momentum is a function of angular velocity, mass,
and the distance the mass is from the center of mass.
! To maintain a constant angular momentum, the angular
velocity must increase if the distance
of the mass decreases.

Rigid Body Simulation (cont.)

! Inertia Tensor
! Angular momentum is related to angular velocity in much the
same way that linear momentum is related to linear velocity,
P(t)=M . v(t ).

! So, L(t ) = I (t ) ⋅ ω (t )
! In the case of angular momentum, a 3x3 matrix is needed to
describe the distribution of mass of the object in space, the
inertia tensor, I(t ).

37
Rigid Body Simulation (cont.)

! The distribution of mass of the object in space

I xz ⎤ I xx = ∑ mi ⋅ (yi + zi )
2 2
⎡ I xx I xy I xy = ∑ mi ⋅ xi ⋅ yi
⎢ ⎥
I object = ⎢ I xy I yy I yz ⎥ I yy = ∑ mi ⋅ (xi2 + zi2 ) I xz = ∑ mi ⋅ xi ⋅ zi
⎢ I xz
⎣ I yz I zz ⎥⎦ I zz = ∑ mi ⋅ (xi2 + yi2 ) I yz = ∑ mi ⋅ yi ⋅ zi
! The inertia tensor for a transformed object depends on the
orientation. Thus, it is dependent on time.

I (t ) = R(t ) I object R(t )T

Rigid Body Simulation (cont.)

! The Equations
! The state of an object can be kept in a vector, S(t ), consisting
of:
" Position; ⎡ x(t ) ⎤
" Orientation;
⎢ R(t )⎥
" Linear momentum; S (t ) = ⎢ ⎥
⎢ P(t )⎥
" Angular momentum.
⎢ ⎥
⎣ L(t ) ⎦
! Object attributes which not change over time are:
" Mass, M
" Object-space Inertia tensor, Iobject

38
Rigid Body Simulation (cont.)

! The time derivate of the object’s state vector can now be formed:
⎡ x(t ) ⎤ ⎡ v(t ) ⎤
⎢ ⎥ ⎢ ⎥
d d ⎢ R(t )⎥ ⎢ω (t ) × R(t )⎥
S (t ) = =
dt dt ⎢ P(t )⎥ ⎢ F (t ) ⎥
⎢ ⎥ ⎢ ⎥
⎣ L(t ) ⎦ ⎣ τ (t ) ⎦
! This is enough information to run a simulation with numerical
method (e.g, Euler, Runge-Kutta).
! Care must be taken in updating the orientation of an object!
(Rotation matrix can quickly becomes
nonorthogonal and not of unit length)

Rigid Body Simulation (cont.)

! Collision detention (see the book “Computer Animation”)


! When a object starts to move in any kind of environment other
than a complete void, chances are that sooner or later it will
bump into something.
! If nothing is done about this in a computer animation , the object
will penetrate and then pass through other objects.
! Other types of contact include objects sliding against and resting
on each other.
! All of these types of contact require the calculation of forces in
order to accurately simulate the reaction of one object to
another.

39
Chapter 3

! Advanced Techniques
! Automatic Camera Control
! Hierarchical Kinematic Modeling

! Forward Kinematics

! Inverse Kinematics

! Rigid Body Simulation

! Flexible Objects

! Controlling Groups of Objects

Flexible Objects

! Various physically based approaches have been


proposed that model:
! Elastic and inelastic behavior
! Viscoelasticity

! Plasticity
! Fracture

! Flexibility is modeled by a spring-mass-damper


system.

40
Flexible Objects (cont.)

! Spring-Mass-Damper
! Model each vertex of an object as a point mass
! Each edge of the object as a spring
" Each spring’s rest length is set equal to the original length of the edge;
" A mass can be arbitrarily assigned
to an object;
V1
" Spring constants are assigned E12
throughout the object to some
user-specified value.
E31 V2

E23
V3

Flexible Objects (cont.)

! As external forces are applied to specific vertices of the object:


" Vertices will be displaced relative to other
vertices of the object;
" This displacement will induce
spring forces, which will impart
forces to the adjacent vertices as
F
well as reactive forces back to V1
the initial vertex; E12
" These forces will result in further
displacements, which will induce E31 V2
more spring forces;
E23
V3

41
Flexible Objects (cont.)

! Drawbacks
" The number of vertices used to model an object and the length of
edges used have an effect on the object’s reaction to forces.

" Using a different distribution of vertices to describe the same object


will result in a difference in the way the object reacts to external
forces.

Flexible Objects (cont.)

! Dampers
" A damper introduces an additional force in the spring that works
against the velocity of the spring length, thus helping to limit the
speed at which a spring changes length.
" A damper imparts a force in the direction opposite to the velocity
of the spring length and is proportional to that velocity.
" Additional spring dampers can help
to stabilize the shape of an object.

42
Flexible Objects (cont.)

! Virtual Springs
" Introduces forces into the system that do not directly model physical
elements.
" Virtual spring with zero rest lengths can be used to constrain one
object to lie on the surface of another;
" Virtual spring with non zero rest lengths, to maintain separation
between moving objects.
" Proportional derivative controllers are another type of virtual spring
used to keep a control variable and its derivative within the
neighborhood of desired values (e.g., to maintain a joint angle).

Chapter 3

! Advanced Techniques
! Automatic Camera Control
! Hierarchical Kinematic Modeling

! Forward Kinematics

! Inverse Kinematics

! Rigid Body Simulation

! Flexible Objects

! Controlling Groups of Objects

43
Controlling Groups of Objects

! Managing complexity is one of the most important uses


of the computer in animation, and nothing exemplifies
better than particle systems.

! Particle systems, flocking, and autonomous behavior


are examples of independently behaving members of
groups with varying levels of autonomy, physical
characteristics, and simulated motions.

Controlling Groups of Objects (cont.)

! Characteristics of Group Types

Type of Number of Incorporated Intelligence


Group Elements Physics

Particles Many Much with None


environment

Some with
Flock Some environment Limited
and other
elements

Autonomous Few Little Much


behavior

44
Controlling Groups of Objects (cont.)
! Particle Systems

Controlling Groups of Objects (cont.)

! Particle Systems
! A particle system is a large collection of individual elements,
which taken together, represent a conglomerate, fuzzy object.
! Both the behavior and the appearance of each individual
particle are very simple.
! The individual particles typically behave according to simple
physical principles with respect to their environment but not
with respect to other particles of the system.

45
Controlling Groups of Objects (cont.)

! Particle Systems
! When viewed together, the particles create the impression
of a single, dynamic, complex object.

! This illusion is referred to as emergent behavior and is an


identifying characteristic of both particle system and
flocking.

Controlling Groups of Objects (cont.)

! Particle Systems
! Because typically there are a large number of elements in a
particle system, simplifying assumptions are used in both the
rendering and the calculation of their motions.
" Particles do not collide with other particles;
" Particles do not cast shadows, except in an aggregate sense;
" Particles only cast shadows on the rest of the environment;
" Particles do not reflect light - they are modeled as point light sources.

46
Controlling Groups of Objects (cont.)

! Particles are often modeled as having a finite life span. In


computing a frame of motion:
" Any new particles that are born during this frame are generated;
" Each new particle is assigned attributes;
" Any particles that have exceeded their allocated life span are
terminated;
" The remaining particles are animated and their shading parameters
changed according to the controlling processes;
" The particles are rendered.

Controlling Groups of Objects (cont.)

! If the user can enforce the constraint that there are a


maximum number of particles active at any one time;
! Then the data structure can be static and particle data
structures can be reused as one dies and another is
created in its place.

47
Controlling Groups of Objects (cont.)

! Particle Generation
! Particles are typically generated according to a controlled
stochastic process.
! For each frame, a random number of particles is generated
using some user-specified distribution centered at the desired
average number of particles per frame.
# particles = average + Rand() * range

! The distribution could be uniform or Guassian or other.

Controlling Groups of Objects (cont.)

! Particle Attributes
! The attributes of a particle determine its motion status, its
appearance, and its life in the system.
" Position
" Velocity
" Shape parameters
" Color
" Transparency
" Lifetime

48
Controlling Groups of Objects (cont.)

! Particle Animation
! Each active particle is animated throughout its life.
! To animate the particle’s position in space, the user considers
forces and computes the resultant particle acceleration.
" The forces are: gravity, global forces (e.g., wind), local forces field,
and collisions with other objects.
! The velocity of a particle is updated from its acceleration,
and then the average velocity is computed and used to
update the particle’s position.

Controlling Groups of Objects (cont.)

! Particle Animation
! The particle’s color and transparency can be function of a
global time, its height, and so on.
! The particle’s shape can be a function of its velocity:
" For example:
- an ellipsoid can be used to represent a moving particle where the
major axis of the ellipsoid is aligned with the direction of travel and
- the ratio of the ellipsoid’s length to the radius of its circular cross
section is related to its speed.

49
Controlling Groups of Objects (cont.)

! Flocking Behavior

Controlling Groups of Objects (cont.)

! Flocking Behavior
! Flocking can be characterized as having a moderate number
of members (relative to particle systems).
! Each member is controlled by a relatively simple set of rules
that operate locally.
! The members exhibit limited intelligence and are governed
by relatively simple physics.
! As compared to particle systems, there are few elements and
there is usually more interelement interaction modeled.

50
Controlling Groups of Objects (cont.)

! Flocking Behavior
! As with particle systems, aggregate behavior emerges from
the local behavior of members of the flock;
" It is emergent behavior.
! The flocking behavior manifests itself as a goal-directed
body, able to split into sections and re-form, creating
organized patterns of flock members that can perform
coordinated maneuvers.

! Example: birds-in-flight.

Controlling Groups of Objects (cont.)

! Flocking Behavior

! There are two main forces at work in keeping a collection of


objects behaving like a flock:
" Collision avoidance
" Flock centering

! These are competing tendencies and must be balanced, with


collision avoidance taking precedence.

51
Controlling Groups of Objects (cont.)

! Flocking Behavior

! Collision avoidance is relative to other members of the


flock as well as other obstacles in the environment.

! Flock centering has to do with each member trying to be


just that - a member of a flock.

Controlling Groups of Objects (cont.)

! Flocking Behavior - Local Control


! Controlling the behavior of a flock member with strictly
local behavior rules is not only computationally desirable;
! It also seems to be intuitively the way that the flocks
operate in real world.

! There are three processes that might be modeled:


physics, perception, and reasoning and reaction.

52
Controlling Groups of Objects (cont.)

! Flocking Behavior - Local Control


! The physics modeled is similar to that described in particle
systems: gravity, collision detection, and collision response.
! Perception concerns the information about the environment
to which the flock members has access.
! Reasoning and reaction are incorporated into the module
that negotiates among the various demands produced as a
result of the perception.

Controlling Groups of Objects (cont.)

! Flocking Behavior - Local control


! Some demands:
" Collision avoidance;
" Flock centering;
" Velocity matching;
" Physical rules.

53
Controlling Groups of Objects (cont.)

! Flocking Behavior - Perception


! The main distinction between flocking and particle systems
is the modeling of perception and the subsequent use of
the resulting information to drive the reaction and
reasoning processes.
! A localized area of perception is modeled:
" Usually the “sight” of the member is restricted to just those members
around, or
" further to just members generally in front of it.

Controlling Groups of Objects (cont.)

! Flocking Behavior - Interacting with other members


! A member interacts with other member of the flock to
maintain separation without collision while trying to
maintain membership in the flock.
! There is an attractive force toward other members of the
flock;
! While a repulsion force from individual members of the
flock exists.

54
Controlling Groups of Objects (cont.)

! Flocking Behavior - Interacting with the environment


! The main interaction between a flock member and the
environment is collision avoidance.

! Forces fields are the simplest to implement and give good


results in simple cases.

Controlling Groups of Objects (cont.)

! Flocking Behavior - Global control


! There is usually a global goal that is used to control and
direct the flock.
! This can be used either to influence all members of the
flock or to influence just the leader.
! Members can have migratory urge, follow the leader, stay
with the pack, or exhibit some combination of these urges.

55
Controlling Groups of Objects (cont.)

! Flocking Behavior - Flock leader


! The leader defines the flock velocity.
! To simulate the behavior of actual flocks, the animator can
have the leader change periodically.
" Birds-in-flight - Presumably, actual flocks change leaders because the
wind resistance is strongest for the leader and rotating the job allows
the birds to conserve energy.
! The leader motion can be scripted along a path to control the
flock’s general behavior.

Controlling Groups of Objects (cont.)

! Flocking Behavior - Negotiating the motion


! In producing the motion, three low-level controllers are
commonly used. They are in order of priority:
" Collision avoidance;
" Velocity matching;
" Flock centering.
! Each of them produces a directive that indicates desired
speed and direction (a velocity vector).
! The task is to negotiate a resultant velocity vector given the
various desires.

56
Controlling Groups of Objects (cont.)

! Flocking Behavior - Negotiating the motion


! As mentioned, control can be enforced with repulsion from
other members and environment obstacles and attraction to
flock center.
! However, this has major problems as forces can cancel each
other out.
! Averaging the requests is usually a bad idea in that
requests can cancel each other out and result in nonintuitive
motion.

Controlling Groups of Objects (cont.)

! Flocking Behavior - Negotiating the motion


! Reynolds suggests a three-stage process consisting of
navigation, piloting, and flying.

- Flock members to avoid - Objects to avoid


- Migratory urge Navigation module - Flock centering
- Velocity matching - External forces
Final desired velocity vector

- Physical constraints on Pilot module - Current status of


member. member.
Motion to be implemented

Flight module
Flight articulation

57
Controlling Groups of Objects (cont.)

! Flocking Behavior - Collision avoidance


! Several strategies can be used to avoid collisions.
! These strategies, in one way or another, model the flock
member’s field of view and visual processing.
! A simple strategy is to position a limited-extent, repelling
force field around every object.
" As long as flock member maintains a safe distance from an object,
there is no force imparted by the object to the flock member.
" Calculating the distance between the center point of the flock and the
center of the object.

Controlling Groups of Objects (cont.)

! Flocking Behavior - Collision avoidance


" ...
" Once the distance gets below a certain threshold, the distance-
based force starts to gently push the flock member away from the
object.
" As the flock member gets closer, the force grows accordingly.

58
Controlling Groups of Objects (cont.)

! Flocking Behavior - Collision avoidance

! Drawbacks
" It prevents a flock member from traveling close and parallel to the
surface of an object.

" The repelling force is as strong for a flock member moving parallel
to a surface as it is for a flock member moving directly toward the
surface.

Controlling Groups of Objects (cont.)

! Flocking Behavior - Collision avoidance

Attempt to fly directly Attempt at finding a passageway


toward a surface

Attempt at parallel movement

59
Controlling Groups of Objects (cont.)

! Flocking Behavior - Splitting and rejoining


! One of their more interesting behaviors is the splitting and
rejoining that result as members veer in different directions
and break into groups as they attempt to avoid collisions.
! Unfortunately, this behavior is difficult to produce because
a balance must be created between collision avoidance
and the flock membership urge.
" Without this precise balance, either a flock faction will split and
never return to the flock.

Controlling Groups of Objects (cont.)


! Autonomous Behavior

60
Controlling Groups of Objects (cont.)

! Autonomous Behavior
! Autonomous behavior refers to the motion of an object that
results from modeling its cognitive processes.

! Usually such behavior is applied to relatively few objects in


the environment.

! Autonomous behavior is usually associated with humans


(avatars), animals, or other objects controlled by a reasoning
agent.

Controlling Groups of Objects (cont.)

! Autonomous behavior models an object that:


" Knows about the environment in which it exist;
" Reasons about the state it is in;
" Plans a reaction to its circumstances;
" Carries out actions that affect its environment.
! The environment, as it is sensed and perceived by the
object, constitutes the external state.
! There is an internal state associated with the object made
up of time-varying desires, emotions, and rules of behavior.

61
Controlling Groups of Objects (cont.)

! Modeling behavior can becomes arbitrarily complex.


" Autonomous behavior can be described at various levels of
complexity, depending on how many and what type of cognitive
processes are modeled.

! Aspects to include in the simulation are:


" vision and touch;
" perception and memory;
" casual knowledge and commonsense reasoning;
" emotions and predispositions.

Controlling Groups of Objects (cont.)

! Many of these issues are more the domain of Artificial


Intelligence than of Computer Graphics.

! Computer graphics is also relevant because the objective of


the cognitive simulation is motion control.

! In addition, spatial reasoning is usually a major component of


cognitive modeling and, therefore, draws heavily on
algorithms associated with computer graphics.

62
Controlling Groups of Objects (cont.)

! Knowing the environment


! There are various ways in which an object can know about
its environment.

! Simple model
" The object simply has access to the environment database.

! Complex model
" Involve sensors, including the vision and memory.

Controlling Groups of Objects (cont.)

! Knowing the environment


! Complex model
" Vision can be modeled by rendering a scene from the point of view
of the object.
" Touch, modeled by detecting collisions, can be used in navigating
through the environment.
" Memory consists of recording the sensed information.
" …
" Imagine situations in which it might be important to monitor sounds
and smells.

63
Controlling Groups of Objects (cont.)

! Internal state
! Internal state is modeled partially by intentions.
" Intentions take on varied importance depending on the urges they
are meant to satisfy.
! Most important intention is:
" The instinct of survive.
! Internal state also includes things as:
" Inhibitions;
" Identifications of areas of interest;
" Emotional state.

Controlling Groups of Objects (cont.)

! State variables are grouped in three precedence


classes:
" Imperatives – things that must be done;

" Desires – things that should be done, if they can be


accommodated by the reasoning system;

" Suggestions – ways to do something should the reasoning system


decide to do that something.

64
Controlling Groups of Objects (cont.)

! Levels of behavior

Controlling Groups of Objects (cont.)

! Keeping behavior under control


!How to model the behavior so that they are generated
automatically but are still under control of the animator?
! The control needs to occur at various levels of specificity:
" Strategies;
" Actions sequences;
" Activity invocations.
! More general control can be exercised by setting internal
state variables.

65
Controlling Groups of Objects (cont.)

! Arbitration between competing intentions


! The highest precedent behavior must be accommodated at
all cost.

! Other behaviors may be accommodated if they do not


contradict the effect of the dominant behavior.

! Modeling behavior can get arbitrarily complex. Covering all


of the complexities is the domain of artificial intelligence.

Controlling Groups of Objects (cont.)


http://gamma.cs.unc.edu/DenseCrowds/

! Crowds

! Two main applications:

" Visual effect (e.g., audience in stadium, battle, etc.)

" Simulation of activity (e.g., evacuation simulation, etc.)

66

You might also like