Animations, Dynamics (08) RNDr. Martin Madaras, PhD. - - PowerPoint PPT Presentation

animations dynamics 08
SMART_READER_LITE
LIVE PREVIEW

Animations, Dynamics (08) RNDr. Martin Madaras, PhD. - - PowerPoint PPT Presentation

Principles of Computer Graphics and Image Processing Animations, Dynamics (08) RNDr. Martin Madaras, PhD. martin.madaras@stuba.sk Outline Principles of animation Keyframe animation Articulated figures Kinematics Dynamics 2


slide-1
SLIDE 1

Principles of Computer Graphics and Image Processing

Animations, Dynamics (08)

  • RNDr. Martin Madaras, PhD.

martin.madaras@stuba.sk

slide-2
SLIDE 2

Outline

2

 Principles of animation  Keyframe animation  Articulated figures  Kinematics  Dynamics

slide-3
SLIDE 3

3

  • Ask questions, please!!!
  • Be communicative
  • www.slido.com #PPGSO08
  • More active you are, the better for you!

How the lectures should look like #1

slide-4
SLIDE 4

Manual animation

4

 Stop-motion animation  e.g. Coraline, Wallace & Gromit, etc.

slide-5
SLIDE 5

Computer Animation

5

 What is animation?

 Make objects change over time according to scripted actions

 What is simulation?

 Predict how object change over time according to physical laws

slide-6
SLIDE 6

Computer Animation

6

 Animation pipeline

 3D Modeling  Articulation  Motion specification  Motion simulation  Shading  Lighting  Rendering  Postprocessing

slide-7
SLIDE 7

Keyframe Animation

7

 Define character poses at specific time steps called

“keyframes”

slide-8
SLIDE 8

Inbetweening (“tweening”)

8

 Computing missing values based on existing surrounding

values

45

slide-9
SLIDE 9

Inbetweening (“tweening”)

9

 Linear (constant)  Ease-in, ease-out

slide-10
SLIDE 10

Keyframe Animation

10

 Inbetweening:

 Linear interpolation – usually not enough continuity

slide-11
SLIDE 11

Spline Continuity

11

 How to ensure curves are “smooth”  Generally we have three levels of continuity  C0 - The curves meet  C0 & C1 - The tangents are shared  C0 & C1 & C2 - The “speed” is the same

slide-12
SLIDE 12

C0 Continuity

12

 Zero order parametric continuity

slide-13
SLIDE 13

C0 & C1 Continuity

13

 First order parametric continuity

slide-14
SLIDE 14

C0 & C1 & C2 Continuity

14

 Second order parametric continuity

slide-15
SLIDE 15

Implications for animation

15

 Linear interpolation is only C0

 Movement changes instantly at keyframes  Very unnatural looking

 We need at least C0 & C1 continuity

 Hermite interpolation  Spline interpolation  “Smoothstep” function

slide-16
SLIDE 16

Smoothstep

16

slide-17
SLIDE 17

Smoothstep

17

float smootherstep(float edge0, float edge1, float x) { // Scale, and clamp x to 0..1 range x = clamp((x - edge0)/(edge1 - edge0), 0.0, 1.0); // Evaluate polynomial return x*x*x*(x*(x*6 - 15) + 10); }

slide-18
SLIDE 18

Keyframe Animation

18

 Inbetweening:

 Spline interpolation – may be visually good enough  May not follow physical laws

slide-19
SLIDE 19

Keyframe Animation

19

 Inbetweening:

 Inverse kinematics or dynamics

slide-20
SLIDE 20

Outline

20

 Principles of animation  Keyframe animation  Articulated figures  Animation Hierarchies  Scene Graph  Kinematics  Dynamics

slide-21
SLIDE 21

Articulated Figures

21

 Character poses described by set of rigid bodies

connected by “joints”

slide-22
SLIDE 22

Articulated Figures

22

 Well suited for humanoid characters

slide-23
SLIDE 23

Keyframe Animation

23

 Inbetweening:

 Compute angles between keyframes

slide-24
SLIDE 24

Example: Walk Cycle

24

 Inbetweening:

 Compute angles between keyframes

slide-25
SLIDE 25

Example: Walk Cycle

25

 Hip joint orientation

slide-26
SLIDE 26

Example: Walk Cycle

26

 Knee joint orientation

slide-27
SLIDE 27

Example: Walk Cycle

27

 Ankle joint orientation

slide-28
SLIDE 28

Animation Hierarchies

28

 Animate objects in relation to their parent

 Sun matrix is Ms  Earth matrix is MsMe  Moon matrix is MsMeMm

slide-29
SLIDE 29

Kinematics and Dynamics

29

 Kinematics

 Considers only motion  Determined by positions, velocities, accelerations

 Dynamics

 Considers underlaying forces  Capture motion from initial positions and physics

slide-30
SLIDE 30

Example: 2-Link Structure

30

 Two links connected by rotational joints

slide-31
SLIDE 31

Forward Kinematics

31

 Animators specifies angles Θ1 and Θ2  Computer finds position of end effector: X

slide-32
SLIDE 32

Forward Kinematics

32

 Joint motion can be specified by spline curves

Joint motion can be specified by spline curves

slide-33
SLIDE 33

Forward Kinematics

33

 Joint motions can be specified by initial conditions

Joint motion can be specified by spline curves

slide-34
SLIDE 34

Example: 2-Link Structure

34

 What if animator knows position of “end effector”

slide-35
SLIDE 35

Inverse Kinematics

35

 Animator specifies end effector positions: X  Computer finds joint angles Θ1 and Θ2

slide-36
SLIDE 36

Inverse Kinematics

36

 End-effector positions can be specified by splines

slide-37
SLIDE 37

Inverse Kinematics

37

 Problem with more complex structures

 System with equation is usually under-defined  Multiple solutions

slide-38
SLIDE 38

Inverse Kinematics

38

 Solution for more complex structures

 Find best solution (eg. minimize energy in motion)  Non-linear optimization

slide-39
SLIDE 39

Inverse Kinematics

39

 Forward Kinematics

 Specify conditions (joint angles)  Compute conditions of end effectors

 Inverse Kinematics

 “Goal-directed” motion  Specify goal positions of end effectors  Compute conditions required to achieve goal

slide-40
SLIDE 40

Quaternions for Rotations

40

slide-41
SLIDE 41

Quaternions for Rotations

41

// RotationAngle is in radians

x = RotationAxis.x * sin(RotationAngle / 2)

y = RotationAxis.y * sin(RotationAngle / 2)

z = RotationAxis.z * sin(RotationAngle / 2)

w = cos(RotationAngle / 2)

 glm::quat  Interpolation using SLERP

quat result = glm::gtc::quaternion::mix(q1, q2, mixFactor);

 Casting back to matrix

glm::mat4 rotate = glm::mat4_cast(q_quat);

slide-42
SLIDE 42

42

Character Animation (Linear Blend Skinning) (Skeletal Animation)

slide-43
SLIDE 43

Skeletal Animation

43

 Hierarchical graph structure called Skeleton

 Nodes and edges (bones)

slide-44
SLIDE 44

Skeletal Animation

44

 Graph structure can be disconnected in space

slide-45
SLIDE 45

Real-time skeletal skinning

45

https://www.youtube.com/watch?v=DfIfcQiC2oA

slide-46
SLIDE 46

Facial animation

46

 Facial expressions  Lips to speech synchronization  Controllers  Skinning  Morphing

http://www.anzovin.com/products/tfm1maya.html

slide-47
SLIDE 47

Reusable animation

47

 One skeleton – different models

http://www.studiopendulum.com/alterego/

slide-48
SLIDE 48

Motion capture

48

 Markers on actor’s body  Optical / magnetic sensors  3D reconstruction of markers’ position  Motion mapping

to virtual character

slide-49
SLIDE 49

Outline

49

 Principles of animation  Keyframe animation  Articulated figures  Animation Hierarchies  Kinematics  Dynamics

slide-50
SLIDE 50

Procedural animation

50

 Programmed rules for changing parameters of the

animated objects

 E.g. according to music, physics, psychology

slide-51
SLIDE 51

Dynamics

51

 Dynamics

 Considers underlaying forces  Capture motion from initial positions and physics  Simulation of Physics insures realism of motion

slide-52
SLIDE 52

Physically based animation

52

 Rigid bodies

 No geometry deformation  Collision response

 Soft bodies

 Allow for deformation  Energy damping

slide-53
SLIDE 53

Animation construction

53

 Set body properties

 Mass, elasticity, friction, …

 Set physical rules

 Gravity, collisions, wind, …

 Set initial state

 Position, velocity, direction, …

 Set constraints  Run simulation / animation

slide-54
SLIDE 54

Spacetime constraints

54

 Animator specifies constraints:

 What the character’s physical structure is

 e.g. articulated figure

 What the character has to do

 e.g. jump from here to there in time t

 What other physical structures are present

 e.g. floor to push off and land

 How the motion should be performed

 e.g. minimize energy

slide-55
SLIDE 55

Spacetime constraints

55

 Computer finds the “best” physical motion satisfying

constraints

 Example: Simulate objects using 2nd Newtons law  F = ma  Ordinary differential equation (ODE)  Numerically solved using Euler’s method  Use discrete time steps

slide-56
SLIDE 56

Euler Integration

56

 Euler Integration

Object::Update(float dt){ /* Constant acceleration: gravity */ a = vec3(0, 0, -9.81); /* New, velocity */ v = v + a * dt; /* New, position */ p = p + v * dt; }

slide-57
SLIDE 57

Euler Integration

57

 External forces can influence motion

Object::Update(float dt) { /* Use mass and external forces */ float m = this->Mass(); F = sumExternalForces(this); /* Compute acceleration */ a = F/m; /* New, velocity */ v = v + a * dt; /* New, position */ p = p + v * dt; }

slide-58
SLIDE 58

Gravity simulation

58

https://www.youtube.com/watch?v=ztwkXq4Hj7Q

slide-59
SLIDE 59

N-body simulation

59

https://www.youtube.com/watch?v=ua7YlN4eL_w

slide-60
SLIDE 60

Fluid simulation

60

https://www.youtube.com/watch?v=r17UOMZJbGs

slide-61
SLIDE 61

Smoke and Dust

61

https://www.youtube.com/watch?v=RuZQpWo9Qhs

slide-62
SLIDE 62

Rigid-Body Dynamics

62

 Assume objects are rigid  Preserve and calculate angular momentum  Calculate collisions based on geometry  Define center of mass

slide-63
SLIDE 63

Rigid-Body Dynamics

63

https://www.youtube.com/watch?v=dvXBstJah5s

slide-64
SLIDE 64

Soft-Body Dynamics

64

 Model objects using linked particles  Usually using spring/mass models  Polygon edges can represent springs  Vertices are simulated using particles with mass

slide-65
SLIDE 65

Cloth simulation

65

https://www.youtube.com/watch?v=M2XuQSZ-8h4

slide-66
SLIDE 66

Soft-Body simulation

66

https://www.youtube.com/watch?v=KppTmsNFneg

slide-67
SLIDE 67

AI controlled

67

https://www.youtube.com/watch?v=IQEx56O73b8

slide-68
SLIDE 68

Summary

68

 Advantages

 Animation is emergent  No need to specify animation details  Animations can very between runs

 Challenges

 Accuracy and stability of simulation  Specification of constraints

slide-69
SLIDE 69

69

Colors and Visual System

Next Week

slide-70
SLIDE 70

70

Acknowledgements

 Thanks to all the people, whose work is shown here and whose

slides were used as a material for creation of these slides:

Matej Novotný, GSVM lectures at FMFI UK Peter Drahoš, PPGSO lectures at FIIT STU

slide-71
SLIDE 71

71

www.slido.com #PPGSO08 martin.madaras@stuba.sk

Questions ?!