five physics simulators for articulated bodies
Download
Skip this Video
Download Presentation
Five Physics Simulators for Articulated Bodies

Loading in 2 Seconds...

play fullscreen
1 / 27

Five Physics Simulators for Articulated Bodies - PowerPoint PPT Presentation


  • 192 Views
  • Uploaded on

Five Physics Simulators for Articulated Bodies. Chris Hecker definition six, inc. [email protected] Prerequisites. comfortable with math concepts, modeling, and equations kinematics vs. dynamics familiar with rigid body dynamics

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Five Physics Simulators for Articulated Bodies' - albert


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
prerequisites
Prerequisites
  • comfortable with math concepts, modeling, and equations
  • kinematics vs. dynamics
  • familiar with rigid body dynamics
    • probably have written a physics simulator for a game, even a hacky one,
    • or at least read about it in detail,
    • or are using a licensed simulator at a low level
takeaway
Takeaway
  • 2 key concepts, vital to understand even if you’re licensing physics:
    • degrees of freedom, configuration space, etc.
    • stiffness, and why it is important for games
  • pros and cons & subtleties of 4 different simulation techniques
    • all are useful, but different strengths
  • all examples are 2D, but generalize directly to 3D
  • not going to be detailed physics tutorial
problem domain highly redundant ik
Problem DomainHighly Redundant IK
  • Simulate a human figure under mouse control
    • for a game about rock climbing...demo
  • Before going to physics, I tried...
    • Cyclic Coordinate Descent (CCD) IK
    • works okay, simple to code, but problems:
      • non-physical movement
      • no closed loops
      • no clear path to adding muscle controls
      • gave a GDC talk about CCD problems, slides on d6.com
solving ik with dynamics
Solving IK with Dynamics
  • rigid bodies with constraints
      • need to simulate enough to make articulated figure
  • 1st-order dynamics
      • f = mv
      • no inertia/momentum; no force, no movement
  • mouse attached by spring or constraint
      • must be tight control
  • hands/feet attached by springs or constraints
      • must stay locked to the positions
i tried 4 simulation techniques
I Tried 4 Simulation Techniques

integration type

explicit integration

implicit integration

augmented

coordinates

Lagrange

Multipliers

Stiff Springs

coordinate type

generalized

coordinates

Recursive

Newton-Euler

Composite Rigid

Body Method

  • Wacky demo of all 4 running simultaneously...
obvious axes of the techniques
Obvious Axes of the Techniques
  • Augmented vs. Generalized Coordinates
    • ways of representing the degrees-of-freedom (DOF) of the systems
  • Explicit vs. Implicit Integration
    • ways of stepping those DOFs forward in time, and how to deal with system stiffness
degrees of freedom dof
Degrees Of Freedom (DOF)
  • DOF is a critical concept in all math
      • find the DOF to understand the system
  • “coordinates necessary and sufficient to reach every valid state”
  • examples:
      • point in 2D: 2DOF, point in 3D: 3DOF
      • 2D rigid body: 3DOF, 3D rigid body: 6DOF
      • point on a line: 1DOF, point on a plane: 2DOF
      • simple desk lamp: 3DOF (or 5DOF counting head)
dof continued
DOF Continued
  • systems have DOF, equations on those DOF constrain them and subtract DOF
      • example, 2D point, on line
  • “configuration space” is the space ofthe DOF
  • “manifold” is the c-space, usuallyviewed as embedded in theoriginal space

(x,y)

2DOF

x = 2y

(x,y) = (t,2t)

2DOF - 1DOF = 1DOF

augmented coordinates
Augmented Coordinates
  • aka. Lagrange Multipliers, constraint methods
  • simulate each body independently
  • calculate constraint forces and apply them
      • constraint forces keep bodies together

f

3DOF + 3DOF - 2DOF = 4DOF

generalized coordinates
Generalized Coordinates
  • aka. reduced coordinates, embedded methods, recursive methods
  • calculate and simulate only the real DOF of the system
      • one rigid body and joints

q

3DOF + 1DOF = 4DOF

augmented vs generalized coordinates revisited
Augmented vs. Generalized Coordinates, Revisited
  • augmented coordinates: dynamics equations + constraint equations
      • general, modular, plug’n’play, breakable
      • big (often sparse) systems
      • simulating useless DOF, drift
  • generalized coordinates:dynamics equations
      • small systems, no redundant DOFs, no drift
      • complicated, custom coded
      • dense systems
      • no closed loops, no nonholonomic constraints
stiffness
Stiffness
  • fast-changing systems are stiff
  • the real world is incredibly stiff
      • “rigid body” is a simplification to avoid stiffness
  • most game UIs are incredibly stiff
      • the mouse is insanely stiff...IK demo
      • FPS control is stiff, 3rd person move change, etc.
  • kinematically animating objects can be arbitrarily stiff
      • animating the position with no derivative constraints
      • have keyframes drag around a ragdoll closely
handling stiffness
Handling Stiffness
  • You want to handle as much stiffness as you can!
      • gives designers control
      • you can always make things softer, that’s easy
  • it’s very hard to handle stiffness robustly
  • explicit integrator will not handle stiff systems without tiny timestep
      • that’s sometimes used as a definition of numerical stiffness!
stiffness example
Stiffness Example
  • example: exponential decay
      • phase space diagram, position vs. time
  • demo of increasing spring constant

position

time

dy/dx = -y

dy/dx = -10y

explicit vs implicit integrators non stiff problem
Explicit vs. Implicit IntegratorsNon-stiff Problem
  • explicit jumps forward to next position
      • blindly leap forward based on current information
  • implicit jumps back from next position
      • find a next position that points back to current
slide17
Explicit vs. Implicit IntegratorsStiff Problem
  • explicit jumps forward to next position
      • blindly leap forward based on current information
  • implicit jumps back from next position
      • find a next position that points back to current
four simulators in more detail
Four Simulators In More Detail
  • Augmented Coordinates / Explicit Integration
      • Lagrange Multipliers
  • Augmented Coordinates / Implicit Integration
      • Implicit Springs
  • Generalized Coordinates / Explicit Integration
      • Composite Rigid Body Method
  • Generalized Coordinates / Implicit Integration
      • Implicit Recursive Newton Euler
      • spend a few slides on this technique
      • best for game humans?
four simulators in more detail augmented explicit lagrange multipliers
Four Simulators In More Detail Augmented / ExplicitLagrange Multipliers
  • form dynamics equations for bodies
  • form constraint equations
  • solve for constraint forces given external forces
        • the constraint forces are called “Lagrange Multipliers”
  • apply forces to bodies
  • integrate bodies forward in time
      • forward euler, RK explicit integrator, etc.
  • pros: simple, modular, general
  • cons: medium sized matrices, drift, nonstiff
  • references: Baraff, Shabana, Barzel & Barr, my ponytail articles
four simulators in more detail augmented implicit implicit springs
Four Simulators In More Detail Augmented / ImplicitImplicit Springs
  • form dynamics equations
  • write constraints as stiff springs
  • use implicit integrator to solve for next state
      • e.g. Shampine’s ode23s adaptive timestep, or semi-implicit Euler
  • pros: simple, modular, general, stiff
  • cons: inexact, big matrices, needs derivatives
  • references: Baraff (cloth), Kass, Lander
four simulators in more detail generalized explicit composite rigid body method
Four Simulators In More Detail Generalized / ExplicitComposite Rigid Body Method
  • form tree structured augmented system
  • traverse tree computing dynamics on generalized coordinates incrementally
      • outward and inward iterations
  • integrate state forward
      • RK
  • pros: small matrices, explicit joints
  • cons: dense, nonstiff, not modular
  • references: Featherstone, Mirtich, Balafoutis
four simulators in more detail generalized implicit implicit recursive newton euler
Four Simulators In More Detail Generalized / ImplicitImplicit Recursive Newton Euler
  • form generalized coordinate dynamics
  • differentiate for implicit integrator
      • fully implicit backward Euler
  • solve system for new state
  • pros: small matrices, explicit joints, stiff
  • cons: dense, not modular, needs derivatives
  • references: Wu, Featherstone
generalized implicit some derivation warning 2 slides of hot and heavy math
Generalized / ImplicitSome DerivationWarning: 2 slides of hot and heavy math!
  • f = fint + fext = mv
  • Forward Dynamics Algorithm
      • given forces, compute velocities (accelerations)
      • v = m-1(fint + fext)
  • Inverse Dynamics Algorithm
      • given velocities (accelerations), compute forces
      • fint = mv - fext
  • Insight: you can use an IDA to check for equilibrium given a velocity
      • if fint = 0, then the current velocity balances the external forces, or f - mv = 0 (which is just a rewrite of “f = mv”)
generalized implicit some derivation cont
Generalized / ImplicitSome Derivation (cont.)
  • IDA computes F(q,q’) (ie. forces given state)
      • when F(q,q’) = 0, then system is moving correctly
      • we want to do implicit integration, so we wantF(q1, q1’) = 0, the solution at the new time
  • implicit Euler equation: q1 = q0 + h q1’
      • q1 = q0 + h q1’ ... q1’ = (q1 - q0) / h
  • plug’n’chug: F(q0 + h q1’, q1’) = 0
      • this is a function in q1’, because q0 is known
  • we can use a nonlinear equation solver to solve F for q1’, then use this to step forward with implicit Euler
solving f q 1 0 can be hard even impossible but it s a very well documented impossible problem
Solving F(q1’) = 0 can be hard, even impossible!(but it’s a very well documented impossible problem!)
  • open problem
  • solve vs. minimize?
the 5th simulator
The 5th Simulator
  • Current best:
      • implicit Euler with F(q’) = 0 Newton solve
      • lots of wacky subdivision and searching to help find solutions
        • want to avoid adaptivity, but can’t in reality
      • doesn’t always work, finds no solution, bails
  • Idea:
      • an adaptive implicit integrator will find the answer, but slowly
      • the Newton solve sometimes cannot find the answer, no matter how slowly because it lacks info
      • spend time optimizing the adaptive integrator, because at least it has more information to go on
summary
Summary
  • simulating an articulated rigid body is hard, and there are a lot of tradeoffs and subtleties
  • there is no single perfect algorithm
      • yet?
  • stiffness is very important to handle for most games
  • generalized coordinates with implicit integration is the best bet so far for run-time
      • maybe augmented explicit (?) for author-time tools
  • I’ll put the slides on my page at d6.com
ad