Hierarchical Modeling Model: Representation of a system Modeling: Creation and manipulation of a...
-
Upload
arthur-armstrong -
Category
Documents
-
view
219 -
download
2
Transcript of Hierarchical Modeling Model: Representation of a system Modeling: Creation and manipulation of a...
Hierarchical Modeling
Model: Representation of a system
Modeling: Creation and manipulation of a system representation
Geometric Model: Graphical representation of a system using geometric shapes
Symbol: Representation of system component
Instance: Each occurrence of a symbol within a model
Hierarchical Tree Structure
robot
base body
headtorso left arm
right arm
basic symbols (number of instances)
head(1)base(1) torso(1) arm(2)
wb
lb
wh
lh
wt
lt
wa
la
Ingredients of a geometric model:• Geometric shapes and other attributes of components• Interconnection between components• Other properties of components (physical properties, text
description, etc.)
Interconnections
waist
neck
base and body torso and head torso and arms
shoulders
1 2
Local Coordinates and World Coordinates
World Coordinates (Global Coordinates): A global reference frame that contains all the models.
Local Coordinates (Modeling Coordinates, Master Coordinates): Coordinate system that is attached to an individual component.
x
y
World coordinate system
Local coordinate systems
robot base body
headtorso arm
x
y
x
y
x
y
x
y
x
y
x
y
Modeling Transformation
Modeling Transformation: Transform model components from local coordinate system to world coordinate system.
Two different views of modeling transformation:• Global View: Transform object in world coordinate system• Local View: Transform local coordinate system of an object
Global View:
Local View:
Rz(45)
Rz(45)
T(10, 0, 0)
T(10, 0, 0)
Global View:
Local View:
T(10, 0, 0)
T(10, 0, 0)
Rz(45)
Rz(45)
The following two views are equivalent for composite transformation:M = Mn Mn-1 ... M2 M1
Global View:• Transform the object with M1.• Transform the object with M2.• . . .• Transform the object with Mn.• Draw the object in world coordinate system.
Local View:• Transform the local coordinate system with Mn.• Transform the local coordinate system with Mn-1.• . . .• Transform the local coordinate system with M1.• Draw the object in local coordinate system.
Transformation of local coordinate system is relative to itself
In hierarchical tree structure, each tree node stores transformation matrix from its parent’s local coordinate system to its own local coordinate system.
x
y
robotM IM base
waist
)(0),(,0 21 ytbbody ll RTM IM torso
neck
)(0),(,0 21 yhthead ll RTM
left shoulder
1
0,,0)(0,),( 21
121
21
axtat
leftarm
llww TRT
M
right shoulder
2
0,,0)(0,),( 21
221
21
axtat
rightarm
llww TRT
M
Hierarchical Tree Traversal
Tree_traverse( NODE n, MATRIX M ){
M1 = local transformation matrix of n;M = M M1;if (n is a leaf){
Set current transformation matrix to M;Draw object associated with leaf n;
}else{
for (each child node n1 of n)Tree_traverse( n1, M );
}}
NODE: Data structure for hierarchical tree nodeMATRIX: Data structure for 4 by 4 transformation matrix
Example for the robot:
Draw_robot( MATRIX M ){
Draw_base( M );Draw_body( M );
}
Draw_base( MATRIX M ){
M = M Mbase;Set current transformation matrix to M; Draw geometric structure for base;
}
Draw_body( MATRIX M ){
M = M Mbody;Draw_torso( M );Draw_head( M );Draw_arm( M Mleftarm );Draw_arm( M Mrightarm );
}
Draw_torso( MATRIX M ){
M = M Mtorso;Set current transformation matrix to M; Draw geometric structure for torso;
}
Draw_head( MATRIX M ){
M = M Mhead;Set current transformation matrix to M; Draw geometric structure for head;
}
Draw_arm( MATRIX M ){
Set current transformation matrix to M; Draw geometric structure for arm;
}
Physics Based Modeling
Particle Systems
Collection of particles moving under external forces. Can be used to model clouds, smoke, fire, fireworks, explosion, waterfalls, fountain, etc.
Particle Properties:• position• velocity• mass• age• life span• shape, color, texture, etc.
Particle System• Particle generation and annihilation• External force field construction• Particle movement control• Particle rendering
Particle generation and annihilation
Controlled randomization on initial properties of particles
Fireworks Fountain Waterfall
while (…){
Get elapsed time dt;n = generation rate * dt;Generate n new particles;for (each particle){
Update particle velocity and position;age += dt;if (age > life span) delete particle;
}}
External force field construction
Gravity
Buoyant force
),0,0( mgF
Sine wave
),0,0( gVF
Air friction
)sin( xLAF tvvF
1 kc
Add randomization to the force field
Particle movement control
Newtonian lawmdt
d Fx
2
2
Numerical time integration
t
tm
vxx
avv
Fa
Particle rendering
Render particle as a texture mapped quad
The quad should always face the viewer (billboard effect)
F: Camera Forward DirectionU: Camera Up DirectionR: Camera Right DirectionP: Particle Positiona: Particle Size
P
F
U
R
A
B
C
D
URPD
URPC
URPB
URPA
22
22
22
22
aa
aa
aa
aa
Cloth simulation using Mass-Spring model
A number of particles with mass interconnected by springs
(i, j) (i+1, j) (i+2, j)
(i, j+1)
(i, j+2)
(i+1, j+1)
Types of springs
(i, j) (i+2, j)
(i, j+2)
(i, j) (i+1, j)
(i, j+1)
(i, j) (i+1, j)
(i, j+1) (i+1, j+1)
Tensile spring Shear spring
Bending spring
Spring forces
xi
xjvi
vj
Elastic force
Damping force
mass particle original position position velocity
i x0i xi vi
j x0j xj vj
ij xxR Rll
Rr 00
0 ijl xx
rFF )( 0llkijjielastic
ijelastic
rrvvFF )( ijijjidamp
ijdamp c
Dynamic equations for mass particles
i
j
ijdamp
ijelasticexti
to connected all
)( FFFF
i
ii
mdt
d Fx
2
2
Numerical time integration
t
tm
iii
iii
i
ii
vxx
avv
Fa
Collision detection and collision response
Examples
Skeletal Animation
Hierarchical Bone Structure
neckright
shoulder
right elbow
right wrist
left shoulder
left elbow
left wrist
chest
waist
hip
right thigh
right knee
right ankle
left thigh
Left knee
left ankle
hip
waist
right thigh left thigh
chest
neckright shoulder
left shoulder
right elbow
right wrist
left elbow
left wrist
right knee
right ankle
Left knee
left ankle
Joint tree
Joint Transformations
For joint i:Tilocal: Position relative to its parent joint
Rilocal: Rotation transformation relative to its parent joint
Tiworld: Position in world coordinate system
Riworld: Rotation transformation in world coordinate system
Assume joint i’s parent is joint j, then:
locali
worldj
worldi RRR
locali
worldj
worldj
worldi TRTT
Vertex Skinning
Each vertex is attached to one or more joints
For vertex i:wij: Weight for joint jPijlocal: Position in joint j’s local coordinate systemPiworld: Position in world coordinate system
j
localij
worldj
worldjij
worldi w PRTP
Key Frame Animation
Key frames
Frame 0 Frame 1 Frame 2 ......
tt t
......
Frame interval: tFrame rate: 1/t
Key Frame Interpolation
Frame k Frame k+1
t
t
Intermediate Frame
h
t
hs
Position interpolation
1)1( kk ss TTT
)10( s
Slerp (Spherical Linear Interpolation) for rotation
Linear interpolation Slerp
Slerp in 2D
A
B
P
BAP vu
cos
cos
1
PA
BA
P
sin
sinsin
)sin(
v
u
BAP
sin
sin
sin
)sin(
Quaternion Slerp
1sin
sin
sin
)1(sin
kk qs
qs
q
1cos kk qq
When cos > 0
1sin
sin
sin
)1(sin
kk qs
qs
q
When cos < 0
coscos