26
Computer Graphics and Imaging UC Berkeley CS184 Summer 2020 Simulation and Kinematics

Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Computer Graphics and Imaging UC Berkeley CS184 Summer 2020

Simulation and Kinematics

Page 2: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Agenda

• Simulation

- Particle Systems

- Mass-spring system

- Euler’s Method

- Verlet Integration

- Forward and Inverse kinematics

• Animation

Page 3: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Particle SystemMass-spring

Euler’s method

Verlet Integration

Page 4: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Particle System — ODE

• Many dynamic systems can be described via an ordinary differential equation (ODE)

- “ordinary” means it involves derivatives in time but not in space

• Goal: Find a function based on information about or relationships between its derivatives

F = ma·x = v·v = − kx

Page 5: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Mass-spring System

Page 6: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Mass-spring System

E =12

k(L − L0)2

• Simple and common particle connection

• Hooke’s Law

• Newton’s laws of motion

Rest lengthCurrent length

Stiffness (Spring constant)

Potential Energy

F = k(L − L0) = maForce

Page 7: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Mass-spring SystemF = k(L − L0) = ma

Page 8: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Mass-spring SystemF = k(L − L0) = ma

In a cloth simulation (spring connecting particles):

• What happens if I make the spring more ‘stiff’

• What happens if I have a lighter cloth

Fabric under wind

Page 9: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of
Page 10: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Numerical Integration

• Key idea: replace derivatives with differences

- ODE only considers derivative in time

ddt

q(t) = f(q(t))

qk+1 − qk

τ= f(q)

Current, known

Unit timestamp, (update frequency)

Future, unknown

Page 11: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Euler’s Method — Newton’s laws

• Approximate the velocity as constant between timeframes

- Acceleration from the net force:

- Velocity from the acceleration:

- Position from the velocity:

a =Fm

v(t + Δt) = v(t) + a(t)Δt

x(t + Δt) = x(t) + v(t)Δt

Above is an example for forward Euler, different methods use different time stamp for evaluation. But the principle of

acceleration —> velocity —> position follows

Page 12: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Euler’s MethodForward Euler

xt+Δt = xt + Δt ·x(t)

• Simple but unstable

- Accumulating errors

- May diverge

Page 13: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Euler’s MethodBackward Euler == Implicit Euler

• Implicit — based on information from the future!

• Hard to solve but stable

- Use given future force to solve for

- What if we can’t anticipate the forces?

·x(t + Δt)

xt+Δt = xt + Δt ·x(t + Δt)

Page 14: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Verlet Integration

• Derived from Taylor expansion

• Velocity-less representation

• Instead store current and previous positions

Position-based Integration

x(t + Δt) = x(t) + ·x(t)Δt +12

··x(t)Δt2

v(t)

=

a(t)

=

x(t − Δt) = x(t)− ·x(t)Δt +12

··x(t)Δt2

How we cancel out velocity

Page 15: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Verlet IntegrationPosition-based Integration

x(t + Δt) = x(t) + ·x(t)Δt +12

··x(t)Δt2

x(t − Δt) = x(t)− ·x(t)Δt +12

··x(t)Δt2

x(t + Δt) = 2x(t) − x(t − Δt) + ··x(t)Δt2

+

=

Known, Previous position

Unknown, future position

Known, current position

Page 16: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Stability• Damping

-

• Modified Euler

- Average velocities

• Adaptive step size

- Recursively adjusting step size, avoid diverging

• Implicit Euler, Position-based Verlet Integration, …

x(t + Δt) = 2x(t)−kx(t − Δt) + ··x(t)Δt2

Page 17: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Project 4 (The last one!)

• Verlet integration to update positions of each particle

Page 18: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Animation

Page 19: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Kinematics• Motion of points, bodies, and systems of bodies

without considering the forces that cause them to move

- Referred to as the "geometry of motion"

Page 20: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Forward Kinematics

• Forward and backward

- Recall forward and backward Euler

Unknown

Known

Known

Page 21: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Backward Kinematics

Known

Unknown

Unknown

• Optimization problem (no constraints!)

- May have 0, 1 or many solutions

Page 22: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Motion appears mechanical

Page 23: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Motion Capture

• Physically-based and data-driven animation

Page 24: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Motion Capture — Triangulation

3D Point

dr

dl

Baseline

Page 25: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Graphics in Films

Pirates of the CaribbeanDawn of the Planet of the Apes

Alita Battle AngelAvatar

Page 26: Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of each particle Animation Kinematics • Motion of points, bodies, and systems of

Physical Simulation and Animation

• Physical simulation is realistic because the motion follows the laws of physics, but may appear mechanical and unnatural.

• Animation from motion capture preserves realistic human motion but makes it hard to do on-line interaction.

• Researchers combine physical modeling (simulation following biomechanics studies and robot control theory) and motion capture data (enrich the styles of motion).