introduction to computer graphics animation...

Post on 24-Jun-2020

9 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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)

โ€ข CG-specific: plausible & robust, but not faithful simulationโ€ข Shape Matching (Position-Based Dynamics)

2

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

๐‘™

๐‘ฅ(๐‘ก) ๐‘š ๐‘”

๐‘‚

๐‘˜

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

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 areas5

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

๐…

๐…

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 ,

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 easilygo beyond the initial amplitude System energy explodes over time

7

Discretize acceleration

using finite difference:

๐Œ๐ฏ๐‘›+1โˆ’๐ฏ๐‘›

โ„Ž= ๐Ÿint ๐ฑ๐‘› + ๐Ÿext

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

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 = ๐ŸŽ

๐… ๐ฒ

โ€ข 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

Physics-based animation of 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

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 ideaCompute 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

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

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

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 structureFastLSM; 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]

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]

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

17Position 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)

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 constraintStrain constraint

Density constraint

Putting everything together: FLEX in PhysX

โ€ข SDK released by NVIDIA!19Unified Particle Physics for Real-Time Applications [Macklin SIGGRAPH14]

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

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]

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

top related