Algorithmen fr die Echtzeitgrafik Algorithmen fr die Echtzeitgrafik - - PowerPoint PPT Presentation

algorithmen f r die echtzeitgrafik algorithmen f r die
SMART_READER_LITE
LIVE PREVIEW

Algorithmen fr die Echtzeitgrafik Algorithmen fr die Echtzeitgrafik - - PowerPoint PPT Presentation

Algorithmen fr die Echtzeitgrafik Algorithmen fr die Echtzeitgrafik Daniel Scherzer scherzer@cg.tuwien.ac.at LBI Virtual Archeology 2 Animation Overview Animation principles Keyframing and interpolation Artist specifies


slide-1
SLIDE 1

2

Algorithmen für die Echtzeitgrafik Algorithmen für die Echtzeitgrafik

Daniel Scherzer

scherzer@cg.tuwien.ac.at

LBI Virtual Archeology

slide-2
SLIDE 2

Animation

slide-3
SLIDE 3

4

Overview

Animation principles Keyframing and interpolation

  • Artist specifies almost everything, the computer just makes it

smooth

Kinematics

  • Joints, articulated figures

Data driven

  • Motion capture

Procedural animation

  • Rules and simulations automatically produce the animation
  • Physics Simulation
slide-4
SLIDE 4

5

Applications

Special Effects

Movies, TV

Video Games Virtual Reality Simulation, Training Medical Robotics, Animatronics Visualization Communication

slide-5
SLIDE 5

6

Animation Tools

Maya 3D Studio Lightwave Filmbox Blender …

slide-6
SLIDE 6

7

Animation Basics

Persistence of vision (human eye)

Afterimage for 1/25 sec (compensate blinking) A sequence of images shown fast enough is hard to distinguish from true motion

What is fast enough? Foveal vs. Peripheral vision

Frame rate (fps = frames per second)

Film: 24

Often 48, each frame twice, to reduce flicker

TV: ~30 for NTSC, 25, for PAL

Interlaced - double the speed to reduce flicker

Computers: 60Hz or more

slide-7
SLIDE 7

8

Motion Blur

Light persists in our vision for a while

Fast moving objects leave a blurred streak

Real cameras leave shutter open for a while

Moving objects blurred

Position at start of shutter time Till position at end

Without motion blur

Strobing effect

Trail of clear staggered images

slide-8
SLIDE 8

9

Computer Animation

Setting various animation parameters

Positions, angles, sizes, … in each frame

Straight-ahead

Set all variables in frame 0, then frame 1, frame 2, …

Pose-to-pose:

  • Set variables at keyframes, let the computer smoothly

interpolate values in between

Can mix the methods:

  • Keyframe some variables (maybe at different frames), do
  • thers straight-ahead
slide-9
SLIDE 9

10

Keyframing

Traditional animation technique Dependent on artist to generate ‘key’ frames Additional, ‘inbetween’ frames are drawn automatically by computer

slide-10
SLIDE 10

11

Linear Interpolation

Simple Constant velocity at edges Discontinuous velocity at corners

Can be unnatural

slide-11
SLIDE 11

12

Linear Interpolation

Given points P0 and P1, define curve L(t):

L(t) = (1-t) P0 + t P1 t in [0,1]

Weighted average of endpoints “Curve” is linear segment

slide-12
SLIDE 12

13

Linear Interpolation: N Points

Given P0…PN define segment: Li(s) = (1-s) Pi + s Pi+1 s in [0,1] Then define piecewise-linear curve: L(u) = Li(s)

Use fractional value of u for piecewise curves

Sharp discontinuities C0 but not C1

slide-13
SLIDE 13

14

Nonlinear Interpolation

Often Catmull-Rom-Splines Removes discontinuities at corners

C0, C1 C2 often unnecessary (acceleration often changes discontinuous in nature)

slide-14
SLIDE 14

15

Parametric Curves

P(u) = (x(u), y(u), z(u)) 0 ≤ u ≤ 1

slide-15
SLIDE 15

16

Easing

Velocity is changed near a keyframe

Ball should slow down at apex

slide-16
SLIDE 16

17

Style or Accuracy

More weight Squash and stretch

slide-17
SLIDE 17

18

More Squash and Stretch

slide-18
SLIDE 18

19

Traditional Motivation

A keyframe should contain all information to understand a situation

slide-19
SLIDE 19

20

Anticipation and Staging

Don’t surprise the audience Direct their attention to what’s important

slide-20
SLIDE 20

21

Follow Through

Audience likes to see resolution of action Discontinuities are unsettling

slide-21
SLIDE 21

22

Secondary Motion

Characters should exist in a real environment Extra movements should not detract

slide-22
SLIDE 22

Animation

Kinematics

slide-23
SLIDE 23

24

Kinematics

The study of how things move

Without considering the causes

Describing the motion of articulated rigid figures

Things made up of rigid “links” attached to each other at movable joints (articulation)

Many mathematical approaches

slide-24
SLIDE 24

25

Skeletons

Skeleton

  • Pose-able framework of joints
  • Arranged in a tree structure.
  • Invisible armature

Joint (Bone)

  • Allows relative movement

within the skeleton.

  • Essentially 4x4 matrix transformations
  • Rotational, translational, …

Rigging

Building the skeleton

slide-25
SLIDE 25

26

Example Joint Hierarchy

Root Torso Neck Pelvis HipL HipR Head ElbowL WristL ElbowR WristR KneeL AnkleL KneeR AnkleR ShoulderL ShoulderR

slide-26
SLIDE 26

27

Degree of Freedom (DOF)

A variable φ describing a particular axis or dimension of movement within a joint Joints typically have around 1-6 DOFs (φ1…φN)

slide-27
SLIDE 27

28

Degree of Freedom (DOF)

A variable φ describing a particular axis or dimension of movement within a joint Joints typically have around 1-6 DOFs (φ1…φN) Changing DOF values over time results in animation of skeleton Example

Free rigid body has 6 DOFs

3 for position 3 for rotation

slide-28
SLIDE 28

29

DOF Limits

Limit DOF to some range

E.x. limit elbow from 0º to 150º

Usually, in a realistic character, all DOFs will be limited except the ones controlling the root

slide-29
SLIDE 29

30

Joints

Core joint data

  • DOFs (n floats)
  • Local matrix: L
  • World matrix: W

Additional Data

  • DOF limits (min & max value per DOF)
  • Type-specific data (rotation/translation axes, constants…)
  • Tree data (pointers to children, siblings, parent…)
slide-30
SLIDE 30

31

Reality Check

Elbow has 1 DOF: the angle the forearm makes with the upper arm (rotation in plane) Wrist has 3 DOF ...

slide-31
SLIDE 31

32

Pose

Setting of all DOFs (specify in Blender, Maya) Φ = (φ1 φ2 … φN)

slide-32
SLIDE 32

33

Pose

slide-33
SLIDE 33

34

Forward Kinematics

Root Torso Neck Pelvis HipL HipR Head ElbowL WristL ElbowR WristR KneeL AnkleL KneeR AnkleR ShoulderL ShoulderR

slide-34
SLIDE 34

35

Forward Kinematics

Top down recursive tree traversal Each joint computes local matrix L

Based on the values of DOFs (φ1 φ2 … φN) And joint type (rotational, translational, …)

  • Local matrix L = Ljoint(φ1,φ2,…,φN)

Each joint computes world matrix W

Multiply L with world matrix of parent joint

  • World matrix W = Wparent · L
slide-35
SLIDE 35

36

Pros and Cons

A simple layered approach

Get the root link moving first (e.g. the pelvis) Fix the pose outward, link by link (the back and the legs next, then the head, the arms, the hands, the fingers, ...)

Great for certain types of motion

General acting, moving in free space, ...

Problems when interacting with other objects

Fingers grabbing a doorknob Feet stay on the ground

slide-36
SLIDE 36

37

Inverse Kinematics (IK)

Root Torso Neck Pelvis HipL HipR Head ElbowL WristL ElbowR WristR KneeL AnkleL KneeR AnkleR ShoulderL ShoulderR

slide-37
SLIDE 37

38

Inverse Kinematics (IK)

Given the desired displacement of a point

Hand on doorknob, foot on the ground, ...

How to compute the necessary joint motions?

Solving joint chain Solving (linear) equation system

slide-38
SLIDE 38

39

Skinning

Till now only animated skeleton Rigid geometry (at joints) usually looks very strange (maybe OK for robots) Need to wrap skin (a mesh), flesh, clothes … around the animated skeleton Continuous mesh deformations

slide-39
SLIDE 39

40

Why trivial methods do not work

Attach each vertex to the closest solid

Discontinuities Self-intersections

slide-40
SLIDE 40

41

Skinning: Linear Blending

Basic idea

Record vertex position in the closest solids Apply a weighted sum

Difficulties

Which solids to use? Which weights? Chosen by artist

slide-41
SLIDE 41

42

Skinning: Example

rest pose

slide-42
SLIDE 42

43

Skinning: Example

slide-43
SLIDE 43

44

Skinning: Linear Blending

P = w1*P1 + w2*P2 wi: [0..1], skin weights

slide-44
SLIDE 44

45

Skeletal Subspace Deformation

Define skin geometry around skeleton in rest pose For each vertex

  • Figure out weights for each bone

based on distance painted on by artist

  • Weights sum to 1
  • New position is weighted average of positions indicated by

nearby bones

slide-45
SLIDE 45

46

Controlling SSD’s

Note: rigid parts, will want to have all but one weight equal to zero

“Skin” moves rigidly with bone

Flexible parts near joints

Smoothly change weights from emphasizing one bone to the other Skin will stay smooth as skeleton moves

slide-46
SLIDE 46

47

SSD Problems

Joint pinching

Large rotations at a joint Skin deflating Folding over itself, …

slide-47
SLIDE 47

48

SSD Problems

Missing effect of underlying anatomy

Muscles bulging, wrinkles, …

Advanced solutions

Interpolate from several example poses Simulate volumetric deformation

Masses and springs

slide-48
SLIDE 48

49

Skeleton Posing Process

  • 1. Specify DOF values for skeleton in animation system
  • 2. Traverse through the hierarchy starting at the root

down to the leaves (forward kinematics) and compute the world matrices

  • 3. Use world matrices to deform skin & render
slide-49
SLIDE 49

Animation

Programming Practice

slide-50
SLIDE 50

52

Animation Process: Programmers View

while(not finished) { //each frame once moveEverythingAlittleBit(); drawEverything(); }

slide-51
SLIDE 51

53

Ogre Animation File Format

<mesh> <!—- Ninja.mesh --> … <skeletonlink name="ninja.skeleton" /> <boneassignments> <vertexboneassignment vertexindex="0" boneindex="27" weight="1" /> … </boneassignments> </mesh>

slide-52
SLIDE 52

54

Ogre Animation File Format

<skeleton> <!—- Ninja.skeleton --> <bones> <bone id="0" name="Joint1"> <position x="0" y="0.02" z="0" /> <rotation angle="0"> <axis x="1" y="0" z="0" /> </rotation> </bone> … </bones> …

slide-53
SLIDE 53

55

Ogre Animation File Format

<skeleton> <!—- Ninja.skeleton --> … <bonehierarchy> <boneparent bone="Joint2" parent="Joint1" /> <boneparent bone="Joint23" parent="Joint2" /> … </bonehierarchy> …

slide-54
SLIDE 54

56

Ogre Animation File Format

… <animations> <animation name="Jump" length="0.46"> <tracks> <track bone="Joint1"> <keyframes> <keyframe time="0"> <translate x="0" y="-0.67" z="0" /> <rotate angle="0.08"> <axis x="0" y="-1" z="0" /> </rotate> </keyframe> … </track>

slide-55
SLIDE 55

Animation

Data Acquisition

slide-56
SLIDE 56

58

Motion Capture

Human motion very subtle

E.g. shifting balance, complex joints, personality…

Motion capture (mocap) records real motion from actors

E.g. Gollum, Polar Express, Beowulf, a lot of TV shows, plenty of games

Technical difficulties:

How do you record? What do you do with the data?

slide-57
SLIDE 57

59

Mocap Methods

Most common: “marker-based”

E.g. draw dots on the actor’s face, or dress in black and attach retro-reflective balls in key places Film from one or more cameras (preferably calibrated and synchronized, preferably with a strobe light) Reconstruct 3D positions of markers in each frame through inverse solve

Some “markerless” systems: rely on good computer vision algorithms Some use direct or electromagnetic measurement

slide-58
SLIDE 58

60

Motion Capture

slide-59
SLIDE 59

61

Move trees

Standard videogame solution Design a graph corresponding to available player actions

E.g. walk forward, turn, jump, …

Design and record corresponding actions with mocap Warp/retime/edit to make clips easily transition where needed Note: in playback need to keep separate track of global position/orientation

slide-60
SLIDE 60

62

Morphing

Closely related family of effects Warp two images or models to roughly match each

  • ther’s geometry

Often based on artist-selected features Modern computer vision and/or geometry algorithms getting better at automatically finding matches

slide-61
SLIDE 61

63

Morphing

Closely related family of effects Warp two images or models to roughly match each

  • ther’s geometry

Often based on artist-selected features Modern computer vision and/or geometry algorithms getting better at automatically finding matches

Cross-fade between the two to get in-between frames

For images, just average pixels For 3D geometry, helps to have a common parameterization…

slide-62
SLIDE 62

Animation

Physics Simulation

slide-63
SLIDE 63

65

Physics Simulation

Particles Rigid bodies

  • Collisions, contact, stacking,

rolling, sliding

Articulated bodies

  • Hinges, constraints

Deformable bodies (solid mechanics)

  • Elasticity, plasticity, viscosity
  • Fracture
  • Cloth

Fluid dynamics

  • Fluid flow (liquids & gasses)
  • Combustion (fire, smoke,

explosions…)

  • Phase changes (melting,

freezing, boiling…)

Vehicle dynamics

  • Cars, boats, airplanes,

helicopters, motorcycles…

Character dynamics

  • Body motion, skin & muscle,

hair, clothing

slide-64
SLIDE 64

66

Particle Systems

For fuzzily defined phenomena Highly complex motion Break up complex phenomena into many component parts - particles

E.g. fire into tiny flames

Instead of animating each part by hand, provide rules and overall guidance for computer to construct animation

slide-65
SLIDE 65

67

Particle Systems

Dust, sparks, fireworks, leaves, flocks, water spray… Also phenomena with many DOF: fluids (water, mud, smoke, …), fire, explosions, hair, fur, grass, clothing, … Three things to consider:

When and where particles start/end The rules that govern motion (and additional attached variables, e.g. color) How to render the particles

slide-66
SLIDE 66

68

What is a Particle?

Most basic particle only has a position Usually add other attributes, such as:

Age Colour Radius Orientation Velocity v Mass m Temperature Type

The sky is the limit

e.g. AI models of agent behaviour e.x.: flocking Behaviour

slide-67
SLIDE 67

69

Particle Seeding

Need to add (or seed) particles to the scene Where?

Randomly within a shaped volume or on a surface

Uniform, jittered grid, …

At a point (maybe another particle) Where there aren’t many particles currently

When?

At the start Several per frame When there aren’t enough particles somewhere

Need to figure out other attributes, not just position

E.g. velocity pointing outwards in an explosion

slide-68
SLIDE 68

70

Basic Animation

Specify a velocity field v(x,t) for any point in space x, any time t Break time into steps

E.g. per frame ∆t = (1/fps)th of a second Or several steps per frame

Change each particle’s position xi by “integrating”

  • ver the time step (Forward Euler)

xi

new = xi + ∆tv xi,t

( )

slide-69
SLIDE 69

71

Basic Rendering

Draw a dot for each particle But what do you do with several particles per pixel?

  • No special handling
  • Add: models each point emitting (but not absorbing) light --

good for sparks, fire, …

  • Compute depth order, do alpha-compositing (and worry

about shadows etc.)

Anti-aliasing

  • Blur edges of particle, make sure blurred to cover at least a

pixel

Particle with radius: kernel function

slide-70
SLIDE 70

72

Motion blur

One case where you can actually do exact solution instead of sampling Really easy for simple particles

Instead of a dot, draw a line (from old position to new position - the shutter time)

slide-71
SLIDE 71

73

Motion blur

May involve decrease in alpha More accurately, draw a spline curve May need to take into account radius as well…

slide-72
SLIDE 72

74

More Detailed Particle Rendering

Stick a texture (or even a little movie) on each particle: “sprites” or “billboards”

  • E.g. a noise function
  • E.g. a video of real flames
slide-73
SLIDE 73

75

More Detailed Particle Rendering

Stick a texture (or even a little movie) on each particle: “sprites” or “billboards”

  • E.g. a noise function
  • E.g. a video of real flames

Draw a little object for each particle

  • Need to keep track of orientation as well, unless spherical

Draw between particles

  • curve (hair), surface (cloth)

Implicit surface wrapped around virtual particles (e.g. water)

slide-74
SLIDE 74

76

Physics Simulation

slide-75
SLIDE 75

Animation

Physics Simulation – Real-Time Water

slide-76
SLIDE 76

78

Motivation

slide-77
SLIDE 77

79

SPH Simulation Data

SPH = Smoothed Particle Hydrodynamics Numeric method to solve hydrodynamic equations Non-sorted 3D point cloud Fluid is able to flow everywhere Difficult to extract surface for rendering Available in PhysX

slide-78
SLIDE 78

80

Direct Rendering of SPH Simulation Data

slide-79
SLIDE 79

81

Approaches

Screen space fluid rendering with curvature flow.

van der Laan et al. [vdLGS09] Thickness based rendering Screen-space curvature flow filtering

Simulation of two-phase flow with sub-scale droplet and bubble effects.

Mihalef et al. [MMS09] Weber number thresholding

A Layered Particle-Based Fluid Model for Real-Time Rendering of Water

Builds on [vdLGS09] View dependent filtering Volumetric Foam

slide-80
SLIDE 80

82

Thickness Based Rendering

slide-81
SLIDE 81

83

How to smooth the surface?

slide-82
SLIDE 82

84

Screen Space Curvature Flow

slide-83
SLIDE 83

85

Smoothing Artefacts

slide-84
SLIDE 84

86

Adaptive Curvature Flow

Interpret each integration step as a filtering step with a 3x3 kernel in view space Vary number of iterations depending on the view space distance z

slide-85
SLIDE 85

87

Improved Filtering

slide-86
SLIDE 86

88

Real-Time Foam

slide-87
SLIDE 87

89

Definitions

Foam: trapped air bubbles in the liquid Two main effects in real-time

Spray or bubbles onto the water surface Foam that occurs behind a water surface

slide-88
SLIDE 88

90

Foam Formation

Foam formation

Based on Weber number thresholding Physical formula used in off-line systems Classify particles as water or foam

slide-89
SLIDE 89

91

Weber Number Threshold

slide-90
SLIDE 90

92

Rendering of Foam

slide-91
SLIDE 91

93

Scene Configuration and View Ray

slide-92
SLIDE 92

94

Background Scene

slide-93
SLIDE 93

95

Back Water Layer

slide-94
SLIDE 94

96

Foam Layer

slide-95
SLIDE 95

97

Front Water Layer

slide-96
SLIDE 96

98

Reflection and Specular Highlights

slide-97
SLIDE 97

99

Algorithm Summary

slide-98
SLIDE 98

100

Performance Comparison

slide-99
SLIDE 99

101

Without Foam

slide-100
SLIDE 100

102

Including Foam

slide-101
SLIDE 101

103

Comparison – w/o Foam – with Foam

slide-102
SLIDE 102

104

Dynamic Scenes

slide-103
SLIDE 103

105

Ground Truth

slide-104
SLIDE 104

106

Limitation

slide-105
SLIDE 105

107

Conclusion

Rendering particle-based fluids with volumetric foam in real time Adaptive curvature flow smoothing Physically guided foam rendering Layered compositing