cs 184 computer graphics
play

CS-184: Computer Graphics Lecture #18: Simulation Basics Prof. - PowerPoint PPT Presentation

1 CS-184: Computer Graphics Lecture #18: Simulation Basics Prof. James OBrien University of California, Berkeley V2016-F-18-1.0 (With some slides from Prof. Ren Ng who is really an awesome guy.) 2 Today Introduction to Simulation


  1. 1 CS-184: Computer Graphics Lecture #18: Simulation Basics Prof. James O’Brien University of California, Berkeley V2016-F-18-1.0 (With some slides from Prof. Ren Ng who is really an awesome guy.) 2 Today • Introduction to Simulation • Basic particle systems • Time integration (simple version) 2

  2. 3 Physically Based Animation • Generate motion of objects using numerical simulation methods g v x t + ∆ t = x t + ∆ t v t + 1 2 ∆ t 2 a t 3 4 Physically Based Animation 4

  3. 5 Example: Cloth Simulation 5 6 Example: Fluids Macklin and Müller, Position Based Fluids 6

  4. 7 Example: Fracture 7 8 Example: Fracture 8

  5. 9 Particle Systems • Single particles are very simple • Large groups can produce interesting effects • Supplement basic ballistic rules • Collisions • Interactions • Force fields • Springs • Others... 9 Karl Sims, SIGGRAPH 1990 10 10

  6. 11 Particle Systems • Single particles are very simple • Large groups can produce interesting effects • Supplement basic ballistic rules • Collisions • Interactions • Force fields • Springs • Others... 11 Feldman, Klingner, O’Brien, SIGGRAPH 2005 12 Basic Particles • Basic governing equation • is a sum of a number of things f • Gravity: constant downward force proportional to mass • Simple drag: force proportional to negative velocity • Particle interactions: particles mutually attract and/or repell O ( n 2) • Beware complexity! • Force fields x = 1 m f ¨ • Wind forces • User interaction 12

  7. 13 Basic Particles • Properties other than position • Color • Temp • Age • Differential equations also needed to govern these properties • Collisions and other constrains directly modify position and/or velocity 13 14 Particle Rules Bryan E. Feldman, James F . O'Brien, and Okan Arikan. " Animating Suspended Particle Explosions ". In Proceedings of ACM SIGGRAPH 2003 , pages 708–715, August 2003. 14

  8. 15 Gravitational Attraction • Newton’s universal law of gravitation • Gravitational pull between particles F g = Gm 1 m 2 d 2 G = 6 . 67428 × 10 − 11 Nm 2 kg − 2 m 1 m 2 d 15 16 Example: Galaxy Simulation Disk galaxy simulation, NASA Goddard 16

  9. 17 Integration • Euler’s Method • Simple • Commonly used • Very inaccurate • Most often goes unstable x t + ∆ t = x t + ∆ t ˙ x t x t + ∆ t = ˙ x t + ∆ t ¨ x t ˙ 17 18 Integration • For now let’s pretend f = m v • Velocity (rather than acceleration) is a function of force x = f ( x , t ) ˙ Witkin and Baraff Note: Second order ODEs can be turned into first order ODEs using extra variables. 18

  10. 19 Integration • For now let’s pretend f = m v • Velocity (rather than acceleration) is a function of force x = f ( x , t ) ˙ Start Witkin and Baraff 19 20 Integration • With numerical integration, errors accumulate • Euler integration is particularly bad x := x + ∆ t f ( x , t ) Witkin and Baraff 20

  11. 21 Integration • Stability issues can also arise • Occurs when errors lead to larger errors • Often more serious than error issues Witkin and Baraff x = [ − sin( ω t ) , − cos( ω t ) ] ˙ 21 22 Integration • Modified Euler x t + ∆ t = x t + ∆ t x t + ˙ x t + ∆ t ) 2 ( ˙ x t + ∆ t = ˙ x t + ∆ t ¨ x t ˙ x t + ( ∆ t ) 2 x t + ∆ t = x t + ∆ t ˙ x t ¨ 2 22

  12. 23 Integration • Midpoint method a a. Compute half Euler step b b. Eval. derivative at halfway c. Retake step • Other methods c • Verlet • Runge-Kutta Witkin and Baraff • And many others... 23 24 Integration • Implicit methods • Informally (incorrectly) called backward methods • Use derivatives in the future for the current step x t + ∆ t = x t + ∆ t ˙ x t + ∆ t x t + ∆ t = ˙ x t + ∆ t ¨ x t + ∆ t ˙ x t + ∆ t = V ( x t + ∆ t , ˙ x t + ∆ t , t + ∆ t ) ˙ x t + ∆ t = A ( x t + ∆ t , ˙ x t + ∆ t , t + ∆ t ) ¨ 24

  13. 25 Integration • Implicit methods • Informally (incorrectly) called backward methods • Use derivatives in the future for the current step x t + ∆ t = ˙ x t + ∆ t V ( x t + ∆ t , ˙ x t + ∆ t , t + ∆ t ) ˙ x t + ∆ t = ˙ x t + ∆ t A ( x t + ∆ t , ˙ x t + ∆ t , t + ∆ t ) ˙ • Solve nonlinear problem for and x t + ∆ t x t + ∆ t ˙ • This is fully implicit backward Euler • Many other implicit methods exist... • Modified Euler is partially implicit as is Verlet 25 26 Temp Slide Need to draw reverse diagrams.... 26

  14. 27 Integration • Semi-Implicit • Approximate with linearized equations V ( x t + ∆ t , ˙ x t + ∆ t ) ≈ V ( x t , ˙ x t ) + A · ( ∆ x ) + B · ( ∆ ˙ x ) A ( x t + ∆ t , ˙ x t + ∆ t ) ≈ A ( x t , ˙ x t ) + C · ( ∆ x ) + D · ( ∆ ˙ x )   x t + ∆ t      x t        x t  ˙  A B  ∆ x  =  + ∆ t  +             x t + ∆ t x t x t ˙ ˙  ¨ C D  ∆ ˙   x 27 28 Integration • Explicit methods can be conditionally stable • Depends on time-step and stiffness of system • Fully implicit can be un conditionally stable • May still have large errors • Semi-implicit can be conditionally stable • Nonlinearities can cause instability • Generally more stable than explicit • Comparable errors as explicit • Often show up as excessive damping 28

  15. 29 Integration • Integrators can be analyzed in modal domain • System have different component behaviors • Integrators impact components differently 29 30 Example: Mass Spring Rope Credit: Elizabeth Labelle, https://youtu.be/Co8enp8CH34 30

  16. 31 Example: Mass Spring Mesh Slide from Ren Ng 31 32 Example: Hair Slide from Ren Ng 32

  17. 33 Example: Cloth Huamin Wang, Ravi Ramamoorthi, and James F . O'Brien. " Data-Driven Elastic Models for Cloth: Modeling and Measurement ". ACM Transactions on Graphics , 30(4):71:1–11, July 2011. Proceedings of ACM SIGGRAPH 2011, Vancouver, BC Canada. 33 34 Example: Clothing on Character 34

  18. 35 Strain Limiting Huamin Wang, James F . O'Brien, and Ravi Ramamoorthi. " Multi-Resolution Isotropic Strain Limiting ". In Proceedings of ACM SIGGRAPH Asia 2010 , pages 160:1–10, December 2010. 35 36 A Simple Spring • Ideal zero -length spring f a → b = ks ( b − a ) f b → a = − f a → b • Force pulls points together • Strength proportional to distance 36

  19. 37 A Simple Spring • Energy potential E = 1 / 2 ks ( b − a ) · ( b − a ) 2 2 1 1 0 0 - -1 -2 f a → b = ks ( b − a ) 8 6 f b → a = − f a → b 4 2  ∂ E � , ∂ E , ∂ E 0 f a = �r aE = � -2 -1 0 1 2 ∂ ax ∂ ay ∂ az 37 38 A Simple Spring • Energy potential: kinetic vs elastic 1 E = 1 / 2 ks ( b − a ) · ( b − a ) 0.5 -6 -4 -2 2 4 6 E = 1 / 2 m (˙ a ) · (˙ b − ˙ b − ˙ a ) -0.5 -1 38

  20. 39 Non-Zero Length Springs b − a f a → b = ks || b − a || ( || b − a || − l ) 2 2 Rest length 1 1 0 0 - -1 -2 3 E = ks ( || b − a || − l )2 2 1 0 -2 -1 0 1 2 39 40 Comments on Springs • Springs with zero rest length are linear • Springs with non-zero rest length are nonliner • Force magnitude linear w/ discplacement (from rest length) • Force direction is non-linear • Singularity at || b − a || = 0 40

  21. 41 Damping • “Mass proportional” damping f ˙ a f = − kd ˙ a • Behaves like viscous drag on all motion • Consider a pair of masses connected by a spring • How to model rusty vs oiled spring • Should internal damping slow group motion of the pair? • Can help stability... up to a point 41 42 Damping • “Stiffness proportional” damping b − a || b − a || 2( b − a ) · (˙ b − ˙ f a = − kd a ) • Behaves viscous drag on change in spring length • Consider a pair of masses connected by a spring • How to model rusty vs oiled spring • Should internal damping slow group motion of the pair? 42

  22. 43 Spring Constants • Two ways to model a single spring l/ 2 l ∆ l/ 2 l/ 2 ∆ l ∆ l/ 2 43 44 Spring Constants • Constant gives inconsistent results with different ks discretizations • Change in length is not what we want to measure • Strain: change in length as fraction of original length ✏ = ∆ l l 0 Nice and simple for 1D... 44

  23. 45 Structures from Springs • Sheets • Blocks • Others 45 46 Structures from Springs • They behave like what they are (obviously!) This structure will not resist shearing This structure will not resist out- of-plane bending either... 46

  24. 47 Structures from Springs • They behave like what they are (obviously!) This structure will resist shearing but has anisotopic bias This structure still will not resist out-of-plane bending 47 48 Structures from Springs • They behave like what they are (obviously!) This structure will resist shearing Less bias Interference between spring sets This structure still will not resist out-of-plane bending 48

Recommend


More recommend