Animation Principles in Motion Planning and Realistic Motion

 
Animation
 
Szirmay-Kalos László
 
Animation = time dependence
 
T
1
(
t
)
 
T
2
(
t
)
 
T
V
(
t
)
 
Transformations
shape
color
Optical attributes, etc.
 
Real-time animation and
discrete time simulation
void IdleFunc( ) 
{
 
 
// 
idle call back
   
static float tend = 0;
   const float dt = 0.01; // dt is 
infinitesimal
   
float 
tstart
 = t
end
;
   t
end
 = glutGet(GLUT_ELAPSED_TIME)
/1000.0f
;
 
   
for(float t 
= tstart; t < tend; t += dt) {
      float Dt = min(dt, tend – t);
 
 
for (Object * obj : objects) obj->Control(Dt);
 
 
for (Object * obj : objects) obj->Animate(Dt);
   }
   glutPostRedisplay();
}
 
tstart
 
t
end
 
dt
 
Realistic motion
 
Physical laws:
Newton law
Collision detection and response: conservation of linear
momentum and angular momentum
No deformation of rigid bodies
Physiological laws
Skeleton: bones meet in
    joints of given degrees
    of freedom
Skin is deformed 
with
   
bone motion
Principle of lazyness
 
Newton law
 
r
(
t
) = 
r
L 
T
M
(
t
)
 
F
/
m
 =    
     r
       
= 
r
L
 
d
2
d
t
2
 
d
2
d
t
2
 
T
M
(
t
)
 
Force acts via some
elastic phenomenon, i.e.
changes continously
T
M
(
t
) C
2
continuous
 
m
 
T
M
(t): Motion planning
 
Requirement: generally C
2 
, sometimes (C
1
,C
0
)
Matrix elements are not independent
Plan in the space of independent parameters
 
p
(t)
axis+angle
 
 
       1
 
T
M
=
 
sx
     sy
          sz
 
    1
 
1
       1
             1
px  py  pz 
  1
 
R
 
r
’= 
r
 
cos(
)+
w
0
(
r
w
0
)(1-cos(
))+
w
0
r
 
sin(
)
 
1. scaling:
 
sx, sy, sz
2. orientation:
 
wx, wy, wz,
 
3. position: 
 
px, py, pz
 
Motion definition in parameter space
 
p
(t) elements are of C
2 
, sometimes (C
1
,C
0
)
 p
(t) definition:
splines
With formula: 
script animation
keyframe animation
With curves: 
path animation
With forces: 
physical animation
From measurements: 
motion capture animation
Keyframe
animáció
 
Resulting animation curves
 
Additional spline animation
 
Path animation
 
Transformation in path animation
 
Explicit up vector
  
Frenet frame:
zm
 = 
r
’(
t
)
  
 
zm
 = 
r
’(
t
)
xm
 = 
zm
 
 up
  
 
xm
 = 
zm
 
 
r
’’(
t
)
ym
  = 
zm
 
 
xm
 
 
ym
  = 
zm
 
 
xm
 
zm
 
xm
 
ym
 
T
M
 
=
 
xm
0
(
t
)    0
ym
0
(
t
)    0
zm
0
(
t
)    0
r
(
t
)         1
 
Vertical direction
is the direction
of the force
 
r
(
t
) curve:
 
r
(
t
)
 
nose
: 
z
 
Physical animation
 
Forces (e.g. gravity,
turbulence, etc.)
Mass, inertia
Linear momentum and
angular mumentum
Collision detection
Collision response
Conservation laws
 
wrong
 
Dynamics of point like objects
 
F
(
r
,
v
,t) force
 
m
for( t 
= 0; t < T; t += dt) {
     
F
 = 
force
 
(
r
,
 
v
)
     
a
 = 
F
/m
     
v
 += 
a
 
·dt
     if ( CollisionDetection )
 
CollisionResponse
     
r
 += 
v
 
·dt
}
 
v
 
n
 = CollisionNormal
 
v’
v’ = 
[
v - n(v
·
n)]-[n(v
·
n)
·
bounce]
 
v
 
ray: 
r
+
v
·
t
 
intersection: t
*
If
 t* < dt Collision
 
CollisionDetection
 
CollisionResponse
d
r
/dt = 
v
d
v
/dt = 
F
(r
,
v
,
t)/m
 
-n(v
·
n)
 
r
 
v
 
Continuous-Discrete collision detection
for a half-space
 
r
(
t
i
)
 
r
(
t
i+
1
)
 
n 
·
(
r
 - 
r
0) = 0
 
n 
·
(
r
 - 
r
0) > 0
 
n 
·
(
r
 - 
r
0) < 0
 
v
 
sugár: 
r
+
v
·t
 
metszés: 
t
*
Ha 
t
* < d
t
 Collision
 
Character animation
 
r
w
 = 
r
L
·
R
hand
·
T
lowerarm
·
R
elbow
·
T
upperarm
·
R
shoulder
·
T
spline
·
T
man
 
r
w
 
r
L
 
Homogeneous coordinates
 
Skeleton
Walking cycle
 
Transformation hierarchy
 
 
2
 
l
1
 
l
1
 
1
 
l
1
 
(
x,y
,z
)
 
T
ranslate
(
l
1
, 0, 0
)
;
 
R
otate
(theta
2
, 0, 0, 1)
 
*
T
ranslate
(
l
1
, 0, 0
)
 
Translate(
l
1
, 0, 0
)
 *
Rotate(theta
1
, 0, 0, 1)
 
Transformation hierarchy
 
l
1
 
2
 
1
 
l
1
 
2
 
1
 
Rotate(theta
2
, 0, 0, 1) *
T
ranslate
(
l
1
, 0, 0
)
 *
Rotate(theta
1
, 0, 0, 1);
 
Rotate(theta
2
, 0, 0, 1) *
T
ranslate
(
l
1
, 0, 0
)
 *
Rotate(theta
1
, 0, 0, 1) *
Translate(
x0, y0, z0
);
 
(
x
0
,y
0,z0
)
 
PMan
 
T0 = 
Pman 
moves ahead
        
Translate
(
forward, up, 0
)
 
T1= shoulder position
    Translate(leftShoulderPos)
T2
 
= arm swinging
    
Rotate(armAngle, armRotAxis)
T3 = 
hand position
    Translate(armLength, 0, 0)
 
T0
 
T1
 
T2
Pman
Head
Torso
Leg1
Leg2
Arm
Arm2
 
T0
 
T1, 
T2
 
T1
 
Pman 
drawing and animation
 
class Pman {
   float 
armAngle, dArmAngle, forward, up
;
   const … 
armLength, armRotAxis, rightArmJoint
, …;
public:
  
void Draw
Arm
(float dt
, mat4 M
) {
     M = Rotate(
armAngle
, 
armRotAxis
)
 * M
;
 // T
2
     DrawRefArm(M);
  }
  
void Draw
Pman
(
 
) {
 // set matrices from animation parameters
     mat4 M = Translate
(
forward, up
, 0
);
 // T0
     DrawRefBody(M);
     DrawArm(dt, Translate(
rightArmJoint
)
 * M); 
 
// T1
  
   DrawLeg(dt, Translate(
rightLegJoint
)
 * M);
  
}
  void Animate(float dt) { // calculate animation parameters
     armAngle += dArmAngle * dt;
     if (armAngle > 0.5 || armAngle < -0.5) dArmAngle *= -1;
     forward += 5 * dt;
  }
};
Pman
Arm1
Arm2
Body
Push/Pop
Inverse kinematics
T0 = moves ahead (forward, up) ???
T2 = leg rotation (ang)
Leg is not sliding
forward += leg * fabs(sin(angNew) - sin(angOld));
up       = leg * cos(angNew);
 
leg
forward
up
 
ang
 
Inverse kinematics
 
l
1
 
2
 
1
 
l
2
 
up(
1
,
2
) = 
l
1
 sin
 
1 
+ l
2
 sin(
1 
+
 
2
)
 
forward(
1
,
2
) = 
l
1
 cos
 
1 
+ l
2
 cos(
1 
+
 
2
)
 
Skinning
 
3. hw: Spiderman in Torus
 
The game is inside a torus that is procedurally textured and diffuse-
specular. A textured spherical ball is rolling inside the torus (path
animaton), and there are two bouncing light sources. When the ball
comes, spiderman should jump into the direction given by a mouse
click to avoid collision and death. We see the scene from the point of
view of spiderman, who always looks at the direction of the ball. The
scene is Phong shaded (per-pixel shading).
T
orus
x
y
z
 
R
 
r
 
Ball Rolling inside the Torus
 
n
 
v
 
 
v + 

(-
n
) = 0
 
Torus parameter space
 
r
(
u,v
)
 
u
 
v
 
u
(
t
)
,v
(
t
)
Slide Note
Embed
Share

Exploring the intricate world of animation through topics like time dependence, real-time simulation, Newton's laws, and motion planning. Dive into the details of keyframe animation, resulting animation curves, and spline animation to grasp the essence of creating dynamic visual experiences.

  • Animation Principles
  • Motion Planning
  • Realistic Motion
  • Keyframe Animation
  • Spline Animation

Uploaded on Oct 04, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Animation Szirmay-Kalos L szl

  2. Animation = time dependence T1(t) TV(t) T2(t) Transformations shape color Optical attributes, etc.

  3. Real-time animation and discrete time simulation tstart tend dt // idle call back void IdleFunc( ) { static float tend = 0; const float dt = 0.01; // dt is infinitesimal float tstart = tend; tend = glutGet(GLUT_ELAPSED_TIME)/1000.0f; for(float t = tstart; t < tend; t += dt) { float Dt = min(dt, tend t); for (Object * obj : objects) obj->Control(Dt); for (Object * obj : objects) obj->Animate(Dt); } glutPostRedisplay(); }

  4. Realistic motion Physical laws: Newton law Collision detection and response: conservation of linear momentum and angular momentum No deformation of rigid bodies Physiological laws Skeleton: bones meet in joints of given degrees of freedom Skin is deformed with bone motion Principle of lazyness

  5. Newton law m d2 dt2 r F/m = = rL d2 dt2TM(t) r(t) = rL TM(t) TM(t) C2 continuous Force acts via some elastic phenomenon, i.e. changes continously

  6. TM(t): Motion planning Requirement: generally C2 , sometimes (C1,C0) Matrix elements are not independent Plan in the space of independent parameters axis+angle 1. scaling: 2. orientation: wx, wy, wz, 3. position: sx, sy, sz p(t) px, py, pz 1 1 1 px py pz 1 sx sy sz R TM= 1 1 r = rcos( )+w0(r w0)(1-cos( ))+w0 rsin( )

  7. Motion definition in parameter space p(t) elements are of C2 , sometimes (C1,C0) p(t) definition: splines With formula: script animation keyframe animation With curves: path animation With forces: physical animation From measurements: motion capture animation

  8. Keyframe anim ci 1. key 2.key 3.key 4.key 5.key

  9. Resulting animation curves

  10. Additional spline animation

  11. Path animation

  12. Transformation in path animation ym r(t) curve: nose: z xm xm0(t) 0 ym0(t) 0 zm0(t) 0 r(t) 1 TM= r(t) zm Explicit up vector zm = r (t) xm = zm up ym = zm xm Frenet frame: zm = r (t) xm = zm r (t) ym = zm xm Vertical direction is the direction of the force

  13. dynamics Physical animation Forces (e.g. gravity, turbulence, etc.) Mass, inertia Linear momentum and angular mumentum Collision detection Collision response Conservation laws wrong

  14. Dynamics of point like objects F(r,v,t) force m CollisionDetection r ray: r+v t v v dr/dt = v dv/dt = F(r,v,t)/m intersection: t* If t* < dt Collision for( t = 0; t < T; t += dt) { F = force (r, v) a = F/m v += a dt if ( CollisionDetection ) CollisionResponse r += v dt } CollisionResponse n = CollisionNormal v -n(v n) v v = [v - n(v n)]-[n(v n) bounce]

  15. Continuous-Discrete collision detection for a half-space n (r - r0) > 0 r(ti) sug r: r+v t v n (r - r0) = 0 metsz s: t* Ha t* < dt Collision r(ti+1) n (r - r0) < 0

  16. Character animation rL rw rw = rL Rhand Tlowerarm Relbow Tupperarm Rshoulder Tspline Tman Homogeneous coordinates

  17. Skeleton

  18. Walking cycle

  19. Transformation hierarchy l1 (x,y,z) Translate(l1, 0, 0); Rotate(theta2, 0, 0, 1) * Translate(l1, 0, 0) l1 2 l1 Translate(l1, 0, 0) * Rotate(theta1, 0, 0, 1) 1

  20. Transformation hierarchy Rotate(theta2, 0, 0, 1) * Translate(l1, 0, 0) * Rotate(theta1, 0, 0, 1); 2 l1 1 2 Rotate(theta2, 0, 0, 1) * Translate(l1, 0, 0) * Rotate(theta1, 0, 0, 1) * Translate(x0, y0, z0); l1 1 (x0,y0,z0)

  21. PMan Pman T0 T1, T2 Head Torso Leg1 Leg2 Arm Arm2 T0 = Pman moves ahead Translate(forward, up, 0) T2 T1 T1= shoulder position Translate(leftShoulderPos) T0 T2 = arm swinging Rotate(armAngle, armRotAxis) T1 T3 = hand position Translate(armLength, 0, 0)

  22. Pman Pman drawing and animation class Pman { float armAngle, dArmAngle, forward, up; const armLength, armRotAxis, rightArmJoint, ; public: void DrawArm(float dt, mat4 M) { M = Rotate(armAngle, armRotAxis) * M; // T2 DrawRefArm(M); } void DrawPman( ) { // set matrices from animation parameters mat4 M = Translate(forward, up, 0); // T0 DrawRefBody(M); DrawArm(dt, Translate(rightArmJoint) * M); // T1 DrawLeg(dt, Translate(rightLegJoint) * M); } void Animate(float dt) { // calculate animation parameters armAngle += dArmAngle * dt; if (armAngle > 0.5 || armAngle < -0.5) dArmAngle *= -1; forward += 5 * dt; } }; Arm1 Arm2 Body Push/Pop

  23. Inverse kinematics T0 = moves ahead (forward, up) ??? T2 = leg rotation (ang) leg ang Leg is not sliding up forward forward += leg * fabs(sin(angNew) - sin(angOld)); up = leg * cos(angNew);

  24. Inverse kinematics 1 l1 up( 1, 2) = l1 sin 1 + l2 sin( 1 + 2) 2 l2 forward( 1, 2) = l1 cos 1 + l2 cos( 1 + 2)

  25. Skinning

  26. 3. hw: Spiderman in Torus The game is inside a torus that is procedurally textured and diffuse- specular. A textured spherical ball is rolling inside the torus (path animaton), and there are two bouncing light sources. When the ball comes, spiderman should jump into the direction given by a mouse click to avoid collision and death. We see the scene from the point of view of spiderman, who always looks at the direction of the ball. The scene is Phong shaded (per-pixel shading).

  27. Torus ) ( y 2 + + = 2 2 2 2 0 R x z y r r x R z = + ( , ) ( r cos( u 2 )) cos( 2 ) x u v R r u v = ( , ) sin( R + 2 ) y u v = ( , ) ( cos( 2 )) sin( 2 ) z u v r u v

  28. Ball Rolling inside the Torus Torus parameter space v r r r d ( ( ), ( )) d d u t d v t u v = = + v d d t u t v t u(t),v(t) u n r(u,v) v v + (-n ) = 0

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#