introduction to computer graphics animation 2
play

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)


  1. Introduction to Computer Graphics – Animation (2) – May 25, 2017 Kenshi Takayama

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

  3. Simple example: single mass & spring in 1D • Mass 𝑛 , position 𝑦 , spring coefficient 𝑙 , rest length 𝑚 , gravity 𝑕 : 𝑃 𝑛 𝑒 2 𝑦 Equation of motion 𝑒𝑢 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

  4. 𝑗 2 Mass-spring system in 3D 𝑗 1 𝑚 𝑘 • 𝑂 masses: 𝑗 -th mass 𝑛 𝑗 , position 𝑦 𝑗 ∈ ℝ 3 • 𝑁 springs: 𝑘 -th spring 𝑓 𝑘 = 𝑗 1 , 𝑗 2 • Coefficient 𝑙 𝑘 , rest length 𝑚 𝑘 • System’s potential energy for a state 𝐲 = (𝑦 1 , … , 𝑦 𝑂 ) ∈ ℝ 3𝑂 : 𝑙 𝑘 2 𝐹 𝐲 ≔ 𝑦 𝑗 1 − 𝑦 𝑗 2 − 𝑚 𝑘 2 𝑓 𝑘 = 𝑗 1 ,𝑗 2 • Equation of motion: 𝐍 𝑒 2 𝐲 𝑒𝑢 2 = −𝛂𝐹(𝐲) + 𝐠 ext • 𝐍 ∈ ℝ 3𝑂×3𝑂 : Diagonal matrix made of 𝑛 𝑗 (mass matrix) 4

  5. Continuous elastic model in 2D ( F inite E lement M ethod) Tessellate the domain into triangular mesh • 𝑂 vertices: 𝑗 -th position 𝑦 𝑗 ∈ ℝ 2 • 𝑁 triangles: 𝑘 -th triangle 𝑢 𝑘 = (𝑗 1 , 𝑗 2 , 𝑗 3 ) • Undeformed state: 𝐘 = (𝑌 1 , … , 𝑌 𝑂 ) ∈ ℝ 2𝑂 𝐆 • Deformed state: 𝐲 = 𝑦 1 , … , 𝑦 𝑂 ∈ ℝ 2𝑂 -1 • Deformation gradient: 𝐆 𝑌 𝑗 2 – 𝑌 𝑗 1 𝑌 𝑗 3 – 𝑌 𝑗 1 𝑦 𝑗 2 – 𝑦 𝑗 1 𝑦 𝑗 3 – 𝑦 𝑗 1 𝐆 𝑘 𝐲 ≔ ∈ ℝ 2×2 Linear transformation which maps edges Area of 𝑢 𝑘 • System’s potential: 𝐵 𝑘 2 𝑘 𝐲 ⊺ 𝐆 Green’s strain energy 𝐹 𝐲 ≔ 𝐆 𝑘 𝐲 − 𝐉 ℱ 2 𝑢 𝑘 = 𝑗 1 ,𝑗 2 ,𝑗 3 • Equation of motion: 𝐍 𝑒 2 𝐲 𝑒𝑢 2 = −𝛂𝐹(𝐲) + 𝐠 ext • 𝐍 ∈ ℝ 2𝑂×2𝑂 : Diagonal matrix made of vertices’ Voronoi areas 5

  6. Computing dynamics 𝑒𝐲 • Problem: Given initial value of position 𝐲(𝑢) and velocity 𝐰 𝑢 ≔ 𝑒𝑢 as and 𝐰 0 = 𝐰 0 , 𝐲 0 = 𝐲 0 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

  7. Simplest method: Explicit Euler Discretize acceleration using finite difference: 𝐍 𝐰 𝑜+1 −𝐰 𝑜 = 𝐠 int 𝐲 𝑜 + 𝐠 ext ℎ 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

  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

  9. Inside of Implicit Euler 𝐰 𝑜+1 = 𝐰 𝑜 + ℎ 𝐍 −1 𝐠 int 𝐲 𝑜+1 + 𝐠 ext 𝐲 𝑜+1 = 𝐲 𝑜 + ℎ 𝐰 𝑜+1 = 𝐲 𝑜 + ℎ 𝐰 𝑜 + ℎ 2 𝐍 −1 𝐠 int 𝐲 𝑜+1 + 𝐠 ext = 𝐲 𝑜 + ℎ 𝐰 𝑜 + ℎ 2 𝐍 −1 −𝛂𝐹 𝐲 𝑜+1 + 𝐠 ext Denote unknown 𝐲 𝑜+1 as 𝐳 ℎ 2 𝛂𝐹 𝐳 + 𝐍 𝐳 − 𝐍 𝐲 𝑜 + ℎ 𝐰 𝑜 − ℎ 2 𝐠 ext = 𝟏 𝐆 𝐳 • Reduce to root-finding problem of function 𝐆: ℝ 3𝑂 ↦ ℝ 3𝑂  Newton’s method: −1 𝐳 𝑗+1 ← 𝐳 𝑗 − 𝑒𝐆 𝐆(𝐳 𝑗 ) 𝑒𝐳 −1 𝐆(𝐳 𝑗 ) = 𝐳 𝑗 − ℎ 2 𝓘 𝐹 𝐳 𝑗 + 𝐍 2 nd derivative of potential 𝐹 (Hessian matrix) • Coefficient matrix of large linear system changes at every iteration  high computational cost! 9

  10. Mass-spring model vs continuous model (FEM) • 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: Mass-spring FEM • Higher computational cost in general △ Physical accuracy 〇 • Good domain tessellation Impl. / comput. cost 〇 △ • Complex potential energy • Can handle various (nonlinear) materials • http://graphics.cs.cmu.edu/projects/Bargteil-2007-AFE/Stuff/examples-360.mov 10

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

  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), https://www.youtube.com/watch?v=CCIwiC37kks 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

  13. Case of single mass & spring (no ext. force) Explicit Euler Position-Based Dynamics ℎ 𝑙 𝛽 𝑤 𝑜+1 ← 𝑤 𝑜 + 𝑛 𝑚 − 𝑦 𝑜 𝑤 𝑜+1 ← 𝑤 𝑜 + ℎ 𝑚 − 𝑦 𝑜 𝑙 𝑛 𝑦 𝑜+1 ← 𝑦 𝑜 + ℎ 𝑤 𝑜+1 𝑦 𝑜+1 ← 𝑦 𝑜 + ℎ 𝑤 𝑜+1 𝑃 𝑚 𝑦(𝑢) • 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

  14. Case of general deforming shape (no ext. force) Explicit Euler Position-Based Dynamics 𝛽 𝐰 𝑜+1 ← 𝐰 𝑜 − ℎ 𝐍 −1 𝛂𝐹 𝐲 𝑜 𝐰 𝑜+1 ← 𝐰 𝑜 + ℎ 𝐡 𝐲 𝑜 − 𝐲 𝑜 𝐲 𝑜+1 ← 𝐲 𝑜 + ℎ 𝐰 𝑜+1 𝐲 𝑜+1 ← 𝐲 𝑜 + ℎ 𝐰 𝑜+1 • Goal position 𝐡 𝐡(𝐲 𝑜 ) • Rest shape rigidly transformed such that it best matches the 𝐲 0 𝐲 𝑜 current deformed state • (SVD of moment matrix) • Called “Shape Matching” • One technique within the PBD framework • Connectivity info (spring/mesh) not needed  meshless 14

  15. Shape Matching per (overlapping) local region • More complex deformations • Acceleration techniques 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] 15 Chain Shape Matching for Simulating Complex Hairstyles [Rungjiratananon CGF10]

  16. Extension: Deform rest shapes of local regions Autonomous motion of soft bodies Example-based deformations https://www.youtube.com/watch?v=0AWtQbVBi3s https://www.youtube.com/watch?v=45QjojWiOEc ProcDef; local-to-global deformation for skeleton-free character animation [Ijiri PG09] 16 Real-Time Example-Based Elastic Deformation [Koyama SCA12]

  17. Position-Based Dynamics (PBD) • General framework including Shape Matching • Input: initial position 𝐲 0 & velocity 𝐰 0 • At every frame: prediction 𝐪 = 𝐲 𝑜 + ℎ 𝐰 𝑜 position correction 𝐲 𝑜+1 = modify 𝐪 velocity update 𝐯 = 𝐲 𝑜+1 – 𝐲 𝑜 /ℎ velocity correction 𝐰 𝑜+1 = modify 𝐯 (My understanding is still weak) Position Based Dynamics [Müller et al., VRIPhys 2006] 17 http://www.csee.umbc.edu/csee/research/vangogh/I3D2015/matthias_muller_slides.pdf

  18. Various geometric constraints available in PBD (other than Shape Matching) Twist constraint Stretch constraint Strain constraint Volume constraint Robust Real-Time Deformation of Incompressible Surface Meshes [Diziol SCA11] Density constraint 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] 18 Position-Based Simulation of Continuous Materials [Bender Comput&Graph14]

  19. Putting everything together: FLEX in PhysX https://www.youtube.com/watch?v=z6dAahLUbZg • SDK released by NVIDIA! 19 Unified Particle Physics for Real-Time Applications [Macklin SIGGRAPH14]

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend