32
Physics-based Simula1on simple (independent par1cles), or complex (robust colliding, stacking, sliding 3D rigid bodies) many many simulators! PhysX (Unity, Unreal), Bullet, Open Dynamics Engine, MuJoCo, Havok, Box2D, Chipmunk, OpenSim, RBDL, Simulink (MATLAB), ADAMS, SD/FAST, DART, Vortex, SOFA, Avatar, Project Chrono, Cannon.js, many course projects, theses, abandon-ware

Physics-based Simula1on

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Physics-basedSimula1on

•  simple(independentpar1cles),orcomplex(robustcolliding,stacking,sliding3Drigidbodies)

•  manymanysimulators!–  PhysX(Unity,Unreal),Bullet,OpenDynamicsEngine,MuJoCo,Havok,Box2D,Chipmunk,OpenSim,RBDL,Simulink(MATLAB),ADAMS,SD/FAST,DART,Vortex,SOFA,Avatar,ProjectChrono,Cannon.js,…

–  manycourseprojects,theses,abandon-ware

Resources•  hUps://processing.org/examples/see“Simulate”;2Dpar1clesystems•  Non-convexrigidbodieswithstacking3Dcollisionprocessingandstacking

hUp://www.cs.ubc.ca/~rbridson/docs/rigid_bodies.pdf•  Physically-basedModeling,coursenotes,SIGGRAPH2001,Baraff&Witkin

hUp://www.pixar.com/companyinfo/research/pbm2001/•  DougJamesCS5643coursenotes

hUp://www.cs.cornell.edu/courses/cs5643/2015sp/•  RigidBodyDynamics,ChrisHeckerhUp://chrishecker.com/Rigid_Body_Dynamics•  Videogamephysicstutorial

hUps://www.toptal.com/game/video-game-physics-part-i-an-introduc1on-to-rigid-body-dynamics•  Box2DjavascriptlivedemoshUp://heikobehrens.net/misc/box2d.js/examples/•  RigidbodycollisionsjavascriptdemohUps://www.myphysicslab.com/engine2D/collision-en.html•  RigidBodyCollisionReponse,MichaelManzke,courseslides

hUps://www.scss.tcd.ie/Michael.Manzke/CS7057/cs7057-1516-09-CollisionResponse-mm.pdf•  RigidBodyDynamicsAlgorithms.RoyFeatherstone,2008•  Par1cle-basedFluidSimula1onforInterac1veApplica1ons,SCA2003,PDF•  StableFluids,JosStam,SIGGRAPH1999.interac1vedemo:

hUps://29a.ch/2012/12/16/webgl-fluid-simula1on

Simula1onBasics

•  simula1onloop– Equa1onsofMo1on

sumforces&torques; solveforaccelera1ons

– numericalintegra1onupdateposi1ons,veloci1es

– collisiondetec1on– collisionresolu1on

•  basicpar1clesim

Physically-basedSimula1on–movementgovernedbyforces

•  par1clesystems–  fire,water,smoke,(fluids,cloth,hair)–  heuris1cs-basedormoreprincipled

•  rigid-bodysimula1on–  blocks,robots,humans

•  con1nuumsystems–  deformablesolids–  fluids,cloth,hair

•  groupmovement–  flocks,crowds

OrdinaryDifferen1alEqua1ons

dX(t)dt

= f (X(t), t)Given X0 = X(t0 )

X(t)Compute t > t0for

Simula1onasapaththroughstate-space,drivenbyavectorfield

NewtonianPhysicsasfirst-orderODE

•  mo1onofonepar1cle

•  mo1onofmanypar1cles

Par1cleForces

•  gravity•  viscousdamping•  springs&dampers•  Lennard-Jonespoten1als

F = −kpx − kdv

ProxyForces•  behaviorforces:

flockingbirds,schoolingfish,etc.[“Boids”,CraigReynolds,SIGGRAPH1987]

CurlnoiseforproceduralfluidflowR.Bridson,J.Hourihan,M.Nordenstam,Proc.SIGGRAPH2007.

ODENumericalIntegra1on:Explicit(Forward)Euler

ImagesfromMIT-OCW:

dXdt

= f (X)

ΔX = Δt f (X)

ExplicitEuler:problems

Solu1onspiralsoutwardsnomaUerhowsmallthe1mestep!(althoughsmaller1mestepsares1llbeUer)

Orcanleadtoinstabili1es:

[PhysicallyBasedAnima1onWitkin&Baraff,SIGGRAPHcoursenotes]

Midpoint&Trapezoidmethods

[slideinpartfromMIT-OCW]

Secondorderaccurate;Midpointmethodalsoknownas“secondorderRunge-KuUa”

Code

EXPLICITEULER

MIDPOINTMETHOD

ImplicitEuler

Xn+1 = Xn + h f (Xn )Xn Xn+1

Xn+1 = Xn + h f (Xn+1)xn+1

backward“implicit”Euler

xn+1 = xn + hvn+1

vn+1 = vn + h(−kxn+1m

)

forward“explicit”Euler

xn+1 = xn + hvn

vn+1 = vn + h(−kxnm)

Idea:Usethederiva1veatthedes1na1onProblem:Wedon’tknowthedes1na1onyet!!

RigidBodyDynamics

•  frompar1clestorigidbodies…

Newton-Eulerequa1onsofmo1onNewton’sequa1onsofmo1on

Preliminaries

•  crossproductviaamatrixmul1ply

!a

Kinema1csofRota1on

•  Intui1vely,withscalars:

•  Moregenerally:

ω r

!ω !r

Fr

!rF

v

!r

!P

m

Newton’sLaw

Euler’sLawtopview

sideview

AngularMomentumofaSetofPar1cles

Iner1aTensor

Newton-EulerEqua1onsofMo1on

Upda1ngtheIner1aTensor

Simula1onLoop

foreach1mestep

setup

solveeqnsofmo1on

integrate

linearposi1onlinearvelocityangularorienta1onangularvelocity

RigidBodyCollisions

•  CollisionDetec1on– broadphase:e.g.,AABBs,boundingspheres– narrowphase:detailedchecks

•  CollisionResponse– collisionimpulses– constraintforces:res1ng,sliding,hinges,….

Par1cle-PlaneCollisionshUps://www.scss.tcd.ie/Michael.Manzke/CS7057/cs7057-1516-09-CollisionResponse-mm.pdf

hUps://www.scss.tcd.ie/Michael.Manzke/CS7057/cs7057-1516-09-CollisionResponse-mm.pdf

hUps://www.scss.tcd.ie/Michael.Manzke/CS7057/cs7057-1516-09-CollisionResponse-mm.pdf

hUps://www.scss.tcd.ie/Michael.Manzke/CS7057/cs7057-1516-09-CollisionResponse-mm.pdf

hUps://www.scss.tcd.ie/Michael.Manzke/CS7057/cs7057-1516-09-CollisionResponse-mm.pdf

hUps://www.scss.tcd.ie/Michael.Manzke/CS7057/cs7057-1516-09-CollisionResponse-mm.pdf