Introduction to Computer Graphics Animation (2) May 25, 2017 - - PowerPoint PPT Presentation

β–Ά
introduction to computer graphics animation 2
SMART_READER_LITE
LIVE PREVIEW

Introduction to Computer Graphics Animation (2) May 25, 2017 - - PowerPoint PPT Presentation

Introduction to Computer Graphics Animation (2) May 25, 2017 Kenshi Takayama Physics-based animation of deforming objects Classic: faithful simulation of physical phenomena Mass-spring system Finite Element Method (FEM)


slide-1
SLIDE 1

Introduction to Computer Graphics – Animation (2) –

May 25, 2017 Kenshi Takayama

slide-2
SLIDE 2

Physics-based animation

  • f deforming objects
  • Classic: faithful simulation of physical phenomena
  • Mass-spring system
  • Finite Element Method (FEM)
  • CG-specific: plausible & robust, but not faithful simulation
  • Shape Matching (Position-Based Dynamics)

2

slide-3
SLIDE 3

Simple example: single mass & spring in 1D

  • Mass 𝑛, position 𝑦, spring coefficient 𝑙,

rest length π‘š, gravity 𝑕 : 𝑛 𝑒2𝑦 𝑒𝑒2 = βˆ’π‘™ (𝑦 βˆ’ π‘š) + 𝑕 = 𝑔

int 𝑦 + 𝑔 ext

  • 𝑔

ext : External force (gravity, collision, user interaction)

  • 𝑔

int 𝑦 : Internal force (pulling the system back to original)

  • Spring’s internal energy (potential):

𝐹 𝑦 ≔ 𝑙 2 𝑦 βˆ’ π‘š 2

  • Internal force is the opposite of potential gradient:

𝑔

int 𝑦 ≔ βˆ’ 𝑒𝐹

𝑒𝑦 = βˆ’π‘™ 𝑦 βˆ’ π‘š

3

Equation of motion

π‘š 𝑦(𝑒) 𝑛 𝑕 𝑃 𝑙

slide-4
SLIDE 4

Mass-spring system in 3D

  • 𝑂 masses: 𝑗-th mass 𝑛𝑗, position 𝑦𝑗 ∈ ℝ3
  • 𝑁 springs: π‘˜-th spring 𝑓

π‘˜ = 𝑗1, 𝑗2

  • Coefficient π‘™π‘˜, rest length π‘šπ‘˜
  • System’s potential energy for a state 𝐲 = (𝑦1, … , 𝑦𝑂) ∈ ℝ3𝑂:

𝐹 𝐲 ≔

π‘“π‘˜= 𝑗1,𝑗2

π‘™π‘˜ 2 𝑦𝑗1 βˆ’ 𝑦𝑗2 βˆ’ π‘šπ‘˜

2

  • Equation of motion:

𝐍 𝑒2𝐲 𝑒𝑒2 = βˆ’π›‚πΉ(𝐲) + 𝐠ext

  • 𝐍 ∈ ℝ3𝑂×3𝑂 : Diagonal matrix made of 𝑛𝑗 (mass matrix)

4

π‘šπ‘˜ 𝑗2 𝑗1

slide-5
SLIDE 5

Continuous elastic model in 2D (Finite Element Method)

  • 𝑂 vertices: 𝑗-th position 𝑦𝑗 ∈ ℝ2
  • 𝑁 triangles: π‘˜-th triangle π‘’π‘˜ = (𝑗1, 𝑗2, 𝑗3)
  • Undeformed state: 𝐘 = (π‘Œ1, … , π‘Œπ‘‚) ∈ ℝ2𝑂
  • Deformed state: 𝐲 = 𝑦1, … , 𝑦𝑂 ∈ ℝ2𝑂
  • Deformation gradient:

𝐆

π‘˜ 𝐲 ≔

  • System’s potential:

𝐹 𝐲 ≔

π‘’π‘˜= 𝑗1,𝑗2,𝑗3

π΅π‘˜ 2 𝐆

π‘˜ 𝐲 βŠΊπ† π‘˜ 𝐲 βˆ’ 𝐉 β„± 2

  • Equation of motion:

𝐍 𝑒2𝐲 𝑒𝑒2 = βˆ’π›‚πΉ(𝐲) + 𝐠ext

  • 𝐍 ∈ ℝ2𝑂×2𝑂 : Diagonal matrix made of vertices’ Voronoi areas

5

Area of π‘’π‘˜ Green’s strain energy ∈ ℝ2Γ—2 𝑦𝑗2 – 𝑦𝑗1 𝑦𝑗3 – 𝑦𝑗1 π‘Œπ‘—2 – π‘Œπ‘—1 π‘Œπ‘—3 – π‘Œπ‘—1

  • 1

Tessellate the domain into triangular mesh Linear transformation which maps edges 𝐆 𝐆

slide-6
SLIDE 6

Computing dynamics

  • Problem: Given initial value of position 𝐲(𝑒) and velocity 𝐰 𝑒 ≔

𝑒𝐲 𝑒𝑒 as

compute 𝐲(𝑒) and 𝐰(𝑒) for 𝑒 > 0. (Initial Value Problem)

  • Simple case of single mass & spring:

𝑛 𝑒2𝑦 𝑒𝑒2 = βˆ’π‘™ 𝑦 βˆ’ π‘š + 𝑕  analytic solution exists (sine curve)

  • General problems don’t have analytic solution

 From state π²π‘œ, π°π‘œ at time 𝑒, compute next state π²π‘œ+1, π°π‘œ+1 at time 𝑒 + β„Ž. (time integration)

  • β„Ž: time step

6

𝐲 0 = 𝐲0 and 𝐰 0 = 𝐰0 ,

slide-7
SLIDE 7

Simplest method: Explicit Euler

Update velocity π°π‘œ+1 ← π°π‘œ + β„Ž πβˆ’1 (𝐠int(π²π‘œ) + 𝐠ext) Update position π²π‘œ+1 ← π²π‘œ + β„Ž π°π‘œ+1

  • Pro: easy to compute
  • Con: overshooting
  • With larger time steps, mass can easily

go beyond the initial amplitude

 System energy explodes over time

7

Discretize acceleration using finite difference: 𝐍 π°π‘œ+1βˆ’π°π‘œ

β„Ž

= 𝐠int π²π‘œ + 𝐠ext

slide-8
SLIDE 8

Method to be chosen: Implicit Euler

Find π²π‘œ+1, π°π‘œ+1 such that: π°π‘œ+1 = π°π‘œ + β„Ž πβˆ’1 𝐠int π²π‘œ+1 + 𝐠ext π²π‘œ+1 = π²π‘œ + β„Ž π°π‘œ+1

  • Represent π°π‘œ+1 using unknown position π²π‘œ+1
  • Pros: can avoid overshoot
  • Cons: expensive to compute (i.e. solve equation)

8

slide-9
SLIDE 9

Inside of Implicit Euler

  • Reduce to root-finding problem of function 𝐆: ℝ3𝑂 ↦ ℝ3𝑂

 Newton’s method:

  • Coefficient matrix of large linear system changes at every iteration

 high computational cost!

9

π°π‘œ+1 = π°π‘œ + β„Ž πβˆ’1 𝐠int π²π‘œ+1 + 𝐠ext Denote unknown π²π‘œ+1 as 𝐳

π²π‘œ+1 = π²π‘œ + β„Ž π°π‘œ+1 𝐳 𝑗+1 ← 𝐳 𝑗 βˆ’ 𝑒𝐆 𝑒𝐳

βˆ’1

𝐆(𝐳 𝑗 ) = π²π‘œ + β„Ž π°π‘œ + β„Ž2πβˆ’1 𝐠int π²π‘œ+1 + 𝐠ext = π²π‘œ + β„Ž π°π‘œ + β„Ž2πβˆ’1 βˆ’π›‚πΉ π²π‘œ+1 + 𝐠ext = 𝐳 𝑗 βˆ’ β„Ž2π“˜πΉ 𝐳 𝑗 + 𝐍

βˆ’1 𝐆(𝐳 𝑗 )

2nd derivative of potential 𝐹 (Hessian matrix)

β„Ž2𝛂𝐹 𝐳 + 𝐍 𝐳 βˆ’ 𝐍 π²π‘œ + β„Ž π°π‘œ βˆ’ β„Ž2𝐠ext = 𝟏 𝐆 𝐳

slide-10
SLIDE 10
  • Both:
  • System potential defined as the sum of deformation energy of small elements
  • Implicit Euler needed for both
  • Mass-spring:
  • Inappropriate for modeling objects occupying continuous 2D/3D domains
  • Effective for modeling web-/mesh-like materials
  • https://www.youtube.com/watch?v=N520KFOxaDg
  • FEM:
  • Higher computational cost in general
  • Good domain tessellation
  • Complex potential energy
  • Can handle various (nonlinear) materials
  • http://graphics.cs.cmu.edu/projects/Bargteil-2007-AFE/Stuff/examples-360.mov

Mass-spring model vs continuous model (FEM)

10

Mass-spring

β–³ 〇 FEM 〇 β–³

Physical accuracy

  • Impl. / comput. cost
slide-11
SLIDE 11

Physics-based animation

  • f deforming objects
  • Classic: faithful simulation of physical phenomena
  • Mass-spring system
  • Finite Element Method (FEM)
  • CG-specific: plausible & robust, but not faithful simulation
  • Shape Matching (Position-Based Dynamics)

11

slide-12
SLIDE 12

Physics-based animation framework specialized for CG

  • Pioneering work:
  • Meshless deformations based on shape matching

[MΓΌller et al., SIGGRAPH 2005]

  • Position Based Dynamics

[MΓΌller et al.,VRIPhys 2006]

  • Basic idea

Compute positions making potential zero (goal position), then pull particles toward them

  • System energy always decreases (never explodes)
  • Easy to compute  perfect for games!
  • Not physically meaningful computation (e.g. FEM)
  • OK for CG purposes

12

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

slide-13
SLIDE 13

Case of single mass & spring (no ext. force)

  • 0 ≀ 𝛽 ≀ 1 is β€œstiffness” parameter unique to PBD
  • 𝛽 = 0  No update of velocity (spring is infinitely soft)
  • 𝛽 = 1  Spring is infinitely stiff (?)

 Energy never explodes in any case 

  • Note: Unit of 𝛽/β„Ž is (time)-1  𝛽 has no physical meaning!
  • Reason why PBD is called non physics-based but geometry-based

13

π‘€π‘œ+1 ← π‘€π‘œ +

β„Ž 𝑙 𝑛 π‘š βˆ’ π‘¦π‘œ

π‘¦π‘œ+1 ← π‘¦π‘œ + β„Ž π‘€π‘œ+1

π‘š 𝑦(𝑒) 𝑛 𝑃 𝑙 Explicit Euler Position-Based Dynamics

π‘€π‘œ+1 ← π‘€π‘œ +

𝛽 β„Ž π‘š βˆ’ π‘¦π‘œ

π‘¦π‘œ+1 ← π‘¦π‘œ + β„Ž π‘€π‘œ+1

slide-14
SLIDE 14

Case of general deforming shape (no ext. force)

  • Goal position 𝐑
  • Rest shape rigidly transformed

such that it best matches the current deformed state

  • (SVD of moment matrix)
  • Called β€œShape Matching”
  • One technique within the PBD framework
  • Connectivity info (spring/mesh) not needed  meshless

14

π°π‘œ+1 ← π°π‘œ βˆ’ β„Ž πβˆ’1𝛂𝐹 π²π‘œ

Explicit Euler

Position-Based Dynamics

π°π‘œ+1 ← π°π‘œ +

𝛽 β„Ž 𝐑 π²π‘œ βˆ’ π²π‘œ

π²π‘œ+1 ← π²π‘œ + β„Ž π°π‘œ+1

π²π‘œ+1 ← π²π‘œ + β„Ž π°π‘œ+1

π²π‘œ 𝐑(π²π‘œ) 𝐲0

slide-15
SLIDE 15

Shape Matching per (overlapping) local region

  • More complex deformations
  • Acceleration techniques

15

Local regions from voxel lattice

Local regions from octree Animating hair using 1D chain structure

FastLSM; fast lattice shape matching for robust real-time deformation [Rivers SIGGRAPH07] Fast adaptive shape matching deformations [Steinemann SCA08] Chain Shape Matching for Simulating Complex Hairstyles [Rungjiratananon CGF10]

slide-16
SLIDE 16

Extension: Deform rest shapes of local regions

16

https://www.youtube.com/watch?v=0AWtQbVBi3s

Autonomous motion of soft bodies Example-based deformations

https://www.youtube.com/watch?v=45QjojWiOEc ProcDef; local-to-global deformation for skeleton-free character animation [Ijiri PG09] Real-Time Example-Based Elastic Deformation [Koyama SCA12]

slide-17
SLIDE 17

Position-Based Dynamics (PBD)

  • General framework including Shape Matching
  • Input: initial position 𝐲0 & velocity 𝐰0
  • At every frame:

πͺ = π²π‘œ + β„Ž π°π‘œ prediction π²π‘œ+1 = modify πͺ position correction 𝐯 = π²π‘œ+1 – π²π‘œ /β„Ž velocity update π°π‘œ+1 = modify 𝐯 velocity correction

17

Position Based Dynamics [MΓΌller et al., VRIPhys 2006] http://www.csee.umbc.edu/csee/research/vangogh/I3D2015/matthias_muller_slides.pdf

(My understanding is still weak)

slide-18
SLIDE 18

Robust Real-Time Deformation of Incompressible Surface Meshes [Diziol SCA11] Long Range Attachments - A Method to Simulate Inextensible Clothing in Computer Games [Kim SCA12] Position Based Fluids [Macklin SIGGRAPH13] Position-based Elastic Rods [Umetani SCA14] Position-Based Simulation of Continuous Materials [Bender Comput&Graph14]

Various geometric constraints available in PBD (other than Shape Matching)

18

Twist constraint Stretch constraint Volume constraint Strain constraint Density constraint

slide-19
SLIDE 19

Putting everything together: FLEX in PhysX

  • SDK released by NVIDIA!

19

Unified Particle Physics for Real-Time Applications [Macklin SIGGRAPH14] https://www.youtube.com/watch?v=z6dAahLUbZg

slide-20
SLIDE 20

Collisions

  • Another tricky issue
  • Popular methods in PBD:
  • For each voxel grid, record

which particles it contains

  • Test collisions only among

nearby particles

  • Recent method specialized for PBD

20

Collision detection for deformable objects [Teschner CGF05] Staggered Projections for Frictional Contact in Multibody Systems [Kaufman SIGGRAPHAsia08] Asynchronous Contact Mechanics [Harmon SIGGRAPH09] Energy-based Self-Collision Culling for Arbitrary Mesh Deformations [Zheng SIGGRAPH12] Air Meshes for Robust Collision Handling [Muller SIGGRAPH15]

[Harmon09] [Zheng12] [Kaufman08] [Muller15]

slide-21
SLIDE 21

Pointers

  • Surveys, tutorials
  • A Survey on Position-Based Simulation Methods in Computer Graphics [Bender CGF14]
  • http://www.csee.umbc.edu/csee/research/vangogh/I3D2015/matthias_muller_slides.pdf
  • Position-Based Simulation Methods in Computer Graphics [Bender EG15Tutorial]
  • Libraries, implementations
  • https://code.google.com/p/opencloth/
  • http://shapeop.org/
  • http://matthias-mueller-fischer.ch/demos/matching2dSource.zip
  • https://bitbucket.org/yukikoyama
  • https://developer.nvidia.com/physx-flex
  • https://github.com/janbender/PositionBasedDynamics

21