Simulation and Kinematics...Project 4 (The last one!) • Verlet integration to update positions of...

Preview:

Citation preview

Computer Graphics and Imaging UC Berkeley CS184 Summer 2020

Simulation and Kinematics

Agenda

• Simulation

- Particle Systems

- Mass-spring system

- Euler’s Method

- Verlet Integration

- Forward and Inverse kinematics

• Animation

Particle SystemMass-spring

Euler’s method

Verlet Integration

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

Mass-spring System

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

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

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

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

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

Euler’s MethodForward Euler

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

• Simple but unstable

- Accumulating errors

- May diverge

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)

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

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

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

Project 4 (The last one!)

• Verlet integration to update positions of each particle

Animation

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"

Forward Kinematics

• Forward and backward

- Recall forward and backward Euler

Unknown

Known

Known

Backward Kinematics

Known

Unknown

Unknown

• Optimization problem (no constraints!)

- May have 0, 1 or many solutions

Motion appears mechanical

Motion Capture

• Physically-based and data-driven animation

Motion Capture — Triangulation

3D Point

dr

dl

Baseline

Graphics in Films

Pirates of the CaribbeanDawn of the Planet of the Apes

Alita Battle AngelAvatar

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).

Recommended