Real-time Physics Round-up Revised Schedule of Demos TUESDAY 06/03 - - PowerPoint PPT Presentation
Real-time Physics Round-up Revised Schedule of Demos TUESDAY 06/03 - - PowerPoint PPT Presentation
Real-time Physics Round-up Revised Schedule of Demos TUESDAY 06/03 Session #1 (11-1pm) Session #2 (2-3pm) Name Time Name Time Name Time 11:30 13:00 Shane Jan 11:40 13:10 Carlos Stephen 11:50 13:20 Dermot Darragh 12:00 13:30
Revised Schedule of Demos TUESDAY 06/03
Session #1 (11-1pm)
Name Time
Shane 11:30 Carlos 11:40 Dermot 11:50 Andy 12:00 Kevin 12:10 Colin 12:20 Owen 12:30 Brendan 12:40 Gavin 12:50
Session #2 (2-3pm)
Name Time Name Time Jan 13:00 Stephen 13:10 Darragh 13:20 Siddiqur 13:30 Dariaus 13:40 Gianluca 13:50 Jeff W 14:00 Rick 14:10 Luis 14:20 Geoff K 14:30 Marco 14:40
Please note Small changes (in red) due to a Postgraduate Committee meeting scheduled before this
Finite Element Simulation
Mass spring
Pros:
Easy to implement Reasonable fast
Some problems:
Lack of correct preservation of volume Behaviour is heavily dependent on mesh topology and choice of springs
Finite Element Simulation
A more physically accurate approach –popular technique in physics and engineering Employs finite element method to solve the partial differential equations which govern the dynamics of an elastic material Objects are modelled as a three-dimensional elastic continuum by breaking it into a large number of solid elements which fit together, and solving for the stresses and strains in each element using a model of the material. Pixelux use a finite-element-based approach for DMM, using a tetrahedral mesh
Pixelux Demo, Parker & O’Brien 2009
Some impressive FEM based effects used in Force Unleashed in their 2009 paper at SCA. This is a great example of cutting edge research deployed in a game.
Video and paper: http://graphics.eecs.berkeley.edu/site_root/papers/Parker-RTD-2009-08/ Eric G. Parker and James F. O'Brien. "Real-Time Deformation and Fracture in a Game Environment". In Proceedings of the ACM SIGGRAPH/Eurographics Symposium on Computer Animation, pages 156–166, August 2009.
Continuum mechanics
Branch of physics that studies the behavior of materials modeled as a continuum
Solid: There exists some equilibrium state /rest position for the body Characterised by Elasticity / Plasticity Fluids: Characterised by Viscosity
Deformable properties
Stress within a solid object is the Magnitude of force applied on an object divided by the surface area over which it acts
Has units of pressure
Strain is the fractional deformation caused by stress Elasticity: Tendency of a body to return to its original shape after the forces causing deformation are removed
Opposite of plasticity: tendency to undergo permanent deformation due to forces
Hooke’s Law in a bit more detail
Hooke’s Law: Extension of spring is directly propotional to the load placed on it f = -kx Force per area applied is proportional to its relative elongation
Can be rewritten Where is the applied stress and the resulting strain E: elasticisty tensor N/m2 defined by young’s modulus
Measuring Deformations
An object in its equilibrium configuration is defined as a connected subset M of 3 .
Coordinates x є M of a point on the
- bject are called material co-
- rdinates of the point
When object deforms, points move to p(x), the spatial world co-ordinates We can represent displacement vectors u(x) = p(x) – x
u defines the displacement field
(x,y,z) p(x,y,z) Deform geometry from its
- riginal configuration
u
Rotation and translation are solid movements and not deformations – spatially constant displacement field Relative movement of point with respect to its neighbours
Strain
The relative elongation (or compression) of the material in 3d A magnitude to measure deformation
A function of the displacement field u(x) Not constant inside a body Derived from the spatial variation or spatial derivatives of the displacement field
stretched compressed
Strain in 3D
In 3D, the displacement function has 3 components
N.b. A point getting compressed in one direction may be depressed in another
Strain cannot be expressed as a single scalar but by a symmetric 3x3 matrix:
Diagonal describes stretch Off-diagonals: shear
Strain in 3D
Strain tensor
Non linear tensor Green tensor:
Invariant to rigid body motions
Linear tensor
Cauchy strain tensor
Invariant to translations Not invariant to rotations!!! Linearization of Green Strain
Where Gradient
- f displacement
field:
Strain in 3D
Green strain tensor vs. Cauchy strain tensor
Stress
Describes forces acting inside object Stress is defined as a force per unit area: As with strain, represented by a 3x3 stress matrix: To get force per unit area with a specific plane defined by normal n:
Axioms of Continuum Mechanics
- 1. A material continuum remains continuum under the
action of forces.
- 2. Stress and strain can be defined everywhere in the
body.
- 3. Stress at a point is related to the strain and the rate of
change of strain with respect to time at the same point.
Stress at any point in the body depends only on the deformation in the immediate neighborhood of that point. The stress-strain relationship may be considered separately, though it may be influenced by temperature, electric charge, ion transport, etc.
Continuum Mechanics
The full continuum model of a deformable object considers the equilibrium of a general body acted on by external forces. The
- bject reaches equilibrium when its potential energy is at a
minimum. The total potential energy P of a deformable system is P = - W where is the total strain energy of the deformable object, and W is the work done by external loads on the deformable object. In order to determine the shape of the object at equilibrium, both are expressed in terms of the object deformation, which is represented by a function of the material displacement over the
- bject. The system potential reaches a minimum when dP w.r.t.
displacement function is zero.
Continuum Mechanics
What we need to solve is the momentum equation for a finite element within a continuum
Other Deformable Techniques
Shape Matching
Match rest state to deformed state of a point cloud Replace energies by geometric constraints and forces by distances of current positions to goal positions Versatile and efficient (speed and memory)
Constraint-based
Not to be forgotten, character animation is one of the most common instances of “deformable” object in games Not discussed here but essentially the physics boils down to a hierarchy of rigid bodies, held together with constraints Geometric operations are used to associate the rigid body with the actual deforming rendered geometry E.g. Matrix palette skinning
For more on constraints: see Baraff et al Siggraph Course Notes on PBM
Image (c) Francois Faure
Recommended Reading
Matthias Muller ran a course on real-time Physics at Siggraph 2007 (included a segment by Jos Stam) The course notes provide an excellent review of Real-time Deformable Objects Supplemental Reading: http://www.matthiasmueller.info/realtimephysics/index.html In particular : Chapters 3, 4, and 5 Link to video of Matthias talk (slightly cut down):
https://www.scss.tcd.ie/John.Dingliana/cs7057/muellertalk.mov
De Defor
- rma
mable le ob
- bject
ct Col
- llisi
ision
- ns
Deformable Object Collision Detection
Almost entirely separate problem from Rigid Bodies
Different Data Structures Rigid body data structures usually cannot be computed on the fly strictly depend on the shape of the object Different techniques Different optimizations Different Granularity Self Intersections possible
A typical feature of deformable objects:
Dynamic change of topology and/or (from the point of view
- f a mesh) change of surface tesselation
Strategies
Bounding volume hierarchies (AABB trees, OBB trees, sphere trees) Grids, either uniform (using hashing for memory efficiency) or hierarchical (e.g. Octree, kd-tree) Coherence-exploiting schemes, such as sweep and prune with insertion sort, or tree-tree collisions with front tracking. Hybrid methods involving a combination of various of these schemes, e.g. a coarse AABB tree plus sweep-and- prune with coherence between colliding leaves.
Hierarchies
Axis Aligned Bounding Boxes are the most used, because they are:
Easiest to compute Easiest to check for interference
They do not provide the best fitting volume, but this concept becomes a bit fuzzy for deformable objects The manner in which the bounding volumes is computed is the most notable difference among the various approaches
Best fit : sphere Best fit : box
AABB Trees
Problem statement: the surface of an object is tessellated with polygons The hierarchy of boxes can be quickly updated using the following property:
Let Sm(R) be the smallest AABB of a region R and r1, r1 two regions.
The hierarchy is updated in O(n) time Note: this is not the same as rebuilding the hierarchy
[Van Den Bergen 1998] Public domain library: http://www.win.tue.nl/~gino/solid/index.html
) ( )) ( ) ( (
2 1 2 1
r r Sm r Sm r Sm Sm
refitting rebuilding
BD-Trees
Bounded Deformation Tree, or BD- Tree, can perform collision detection with reduced deformable models at costs comparable to collision detection with rigid objects
BD-Tree Update
Preprocess:
Compute Bounding Box of leaves Compute parent BB in bottom-up order
At Run Time – Refit Tree
Refitting AABB takes constant time - Ten times faster than rebuilding it Refitted tree has more overlap
BD-Tree Summary
Doug L. James and Dinesh K. Pai. BD-Tree: Output-Sensitive Collision Detection for Reduced Deformable Models. ACM Transactions on Graphics (SIGGRAPH 2004), 23(3), August 2004.
Distance Fields
Specify (signed) distance to a closed surface for all points in the field Fast evaluation of distances and normals Independent of complexity of object
Distance Fields
Many techniques for storing
Uniform 3d grid Octree Bsp tree
Distance values calculated at each grid and then tri- linearly interpolated Some Resolution problems
Solution Adaptive Sampling (ADF)
Fuhrman, Sobottka, Gross. Distance Fields for Rapid Collision Detection in Physically Based Modeling International Conference on Computer Graphics and Vision. Graphicon 2003.
- S. Fisher, M. Lin.
Deformed Distance Fields for Simulation of Non-Penetrating Flexible BodiesEG Symposium on Comptuer Animation 2001.
Distance Fields
DiFi: Fast 3D Distance Field Computation Using Graphics Hardware by Avneesh Sud, Miguel A. Otaduy, and Dinesh Manocha.
References
Collision Detection for Deformable Objects
- M. Teschner, S. Kimmerle, B. Heidelberger, G. Zachmann,
Laks Raghupathi, A. Fuhrmann, Marie-Paule Cani, François Faure, N. Magnetat-Thalmann, W. Strasser, P. Volino Computer Graphics Forum, Volume 24, Number 1, page 61--81 - March 2005 http://www- evasion.inrialpes.fr/Publications/2005/TKHZRFCFMSV05/ STARmain.pdf
Fluid Simulation – Basic Concepts
Some slides are based on Notes by : (1) Marcos Garcia (2) Richard Lee (3) Matthias Mueller (4) Michael Su
Granular Flow e.g. sand [Zhu, Bridson] Animating Sand as a Fluid, SIGGRAPH 05 Smoke [Fedkiw, Stam, Jensen] Visual Simulation of Smoke, SIGGRAPH 01 Newtonian Fluids [Tessendorf] Simulating Ocean Water, SIGGRAPH 01 Non-newtonian Fluid [Goktekin, Bargteil, O'Brien] A Method for Animating Viscoelastic Fluids, SIGGRAPH 04 Microscopic Effects [Wang, Mucha, Turk] Water Drops on Surfaces, SIGGRAPH 05
Different types of fluids and representative papers at SIGGRAPH
Fluid Characteristics (1)
Basic properties
Pressure Density Viscosity (subject to shear stress) Surface tension
Different types of fluids:
Incompressible (divergence-free) fluids: Fluids doesn’t change volume (very much). Compressible fluids: Fluids change their volume significantly. Viscous fluids: Fluids tend to resist a certain degrees of deformation
Fluid Characteristics (2)
Inviscid (Ideal) fluids: Fluids don’t have resistance to the shear stress Turbulent flow: Flow that appears to have chaotic and random changes Laminar (streamline) flow: Flow that has smooth behavior Newtonian fluids: Fluids continue
to flow, regardless of the force acting on it
laminar turbulent
Fluid Characteristics (3)
Non-Newtonian fluids: Fluids that have non-constant viscosity Phase Transition: Fluids may change
physical behavior under different environmental conditions.
Calculus Review (1)
Gradient ( ): A vector pointing
in the direction of the greatest rate of increment
Divergence ( ): Measure how the
vectors are converging or diverging at a given location (volume density of the outward flux)
z u y u x u u , ,
u can be a scalar or a vector
z y x u u u u
u can only be a vector Source, Div(u) > 0 Sink, Div(u) < 0
z u y u x u u , ,
Calculus Review (2)
Laplacian (∆ or ): Divergence of the gradient Finite Difference: Derivative approximation
2
2 2 2 2 2 2 2
z u y u x u u
u can be a scalar or a vector i i i i
x x u u x u
1 1
Useful operators
dy dx
xij xi(j-1) x(i-1)j
Compressible Navier-Stokes
Momentum Equation: Continuity Equation: Equation of State:
Change in velocity Diffusion / Viscosity Advection Pressure Body Forces
g u u u u p t 1 . .
. u t
) ( f p
u: the velocity field : kinemaic viscocity : density p: pressure g:external force (e.g. gravity)
Navier-Stokes
Equations of motion taken from Computational Fluid Dynamics (CFD) Computationally expensive to solve
Many state variables required to describe continuum Not quite fast enough for games yet (half of the cost is rendering!)
Various simulation techniques
Grid-based approaches: Eulerian Particle-based approaches: Lagrangian Height-field approaches e.g. shallow water equations
Eulerian Approach
Discretize the domain using finite differences Define scalar & vector fields on the grid
Some Redundancy Grid resolution is critical More complex math
[Stam] Stable Fluids, SIGGRAPH 99
Lagrangian Approach
Treat the fluid as discrete particles Apply interaction forces (i.e. pressure/viscosity) according to certain pre-defined smoothing kernels Evaluations:
Mass / Momentum conservation More intuitive Fast, no linear system solving Connectivity information/Surface reconstruction
[Mueller, Charypar, Gross] Particle-Based Fluid Simulation for Interactive Applications, SCA03
Solver Overview
- 1. Specify initial and boundary conditions
- 2. Solving equations each time-step gives us the fluid
velocity at any point in space (interpolate sample points)
- 3. Use some device to represent fluid, e.g.:
- Scalar field for smoke density
- Marker particles or implicit surface for liquid
- 4. Then use fluid velocity field to move fluid around
- 5. Render
Incompressibility
Real fluids are compressible
Fluid density varies through space Usually not important for animation
Simplify by assuming density field is constant:
No longer need an Equation of State Continuity equation simplifies to: Now the pressure field is whatever it takes to make the velocity field have zero divergence
This constraint-based approach generally gives better results:
Analogous to simulating a rigid body instead of a very stiff deformable body
u=0
g u u u u p t 1 . .
Scalar/Vector fields defined
- n the grid
Advection Body Force Diffusion Pressure Solve
u=0
Inviscid Fluids
Another common simplification for water and smoke is to assume zero viscosity Momentum equation w/o viscosity term: Discrete solution to equations introduces errors which resemble physical viscosity
Called ‘numerical dissipation’ Arises from averaging, interpolation, etc. Much of research in fluids tries to combat this dissipation
g u u u p t 1 .
The Marker and Cell Method
Originally due to Harlow & Welch, 1965 Introduced to graphics by Foster/Metaxas, 1996 Solution to NSE are computed at fixed grid points Solves for incompressible fluid
MAC Grid Discretization
Discretize fields on Cartesian grid(s)
Speed/accuracy/stability all depend on grid resolution
Offline Fluid Simulations
Typical grid size 2563 cells Linear system with 16 million unknowns With rendering (Photorealistic results)
10 seconds to 50 minutes per frame!
3D MAC simulation is almost impossible in real-time for decent sized grids
For games, consider:
- Computational cost
- Stability
- Memory Consumption
Real-time Fluids
But real-time fluids IS possible
Some Common Real-time Solutions
Procedural Water
Unbounded surfaces, oceans
Heightfield Fluids
Ponds, lakes
Particle Systems
Splashing, spray, puddles, smoke
Procedural Animation
Empirical Models
Simulate effect not the cause
Difficult to do accurate interactions with procedural fluids
Procedural Heightfields
Sum of sinusoidal waves (simple solution to NSE) “Canned” animation “Simulating Ocean Water”
- J. Tessendorf .Siggraph
’99 Used in Titanic (also see course notes 2001)
http://www.finelightvisualtechnology.com/docs/coursenotes2004.pdf
Heightfield Fluids
Represent Fluid as a 2D function
Dimensional reduction Impossible to do breaking waves
Try this at home:
=
Heightfield Simulation
Based on simplifications of the full Navier-Stokes equations
Shallow water equations 2D wave equation:
Fast enough for realtime but limited
Particle Fluids
Can define some effects with simple particle system (no-particle- particle interactions):
E.g. Spray / splash
Smoothed Particle Hydrodynamics
Image (c) Richard Lee Particle Simulations that take Navier-Stokes into Account
NSE with Particles
How to formulate Navier-Stokes Eqn. on particles? We need continuous fields, e.g. u(x) We Only have u1, u2, .. un sampled on particles Basic idea:
– Particles induce smooth local fields – Global field is sum of local fields
Particle-particle interaction
For n particles O(n2) potential interactions!
To reduce to linear complexity O(n) define interaction cutoff distance h Also Need some kind of proximity cullling e.g. Spatial hashing
Wave Particles
Cem Yuksel, Donald H. House, and John Keyser, Wave Particles Proceedings of SIGGRAPH 2007 (TOG), 26(3) 2007
GPU heightfield simulation warped to include wave induced flow
Wave forces for interaction with floating particles Scalable: simulation and interaction with 100s
- bject in real-time
http://www.cemyuksel.com/research/waveparticles/
Recommended Reading
Bridson & Mueller: Fluid Simulation for Computer Animation (Sggraph 2007 course):
http://www.cs.ubc.ca/~rbridson/fluidsimulation/
Jos Stam GDC 03 Course notes
http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC0 3.pdf
Tessendorf: Simulating Ocean Water (Siggraph 2004 course notes):
http://www.finelightvisualtechnology.com/docs/coursenotes2004.pdf
Richard Lee (TCD) Introductory Chapters from PhD Thesis on Fluid Simulation and Rendering:
http://www.cs.tcd.ie/John.Dingliana/ET04/Fluids.pdf
Some Current Topics not detailed in the Course
Physically based sound synthesis
Real-time: Bonneel et al Fast Modal Sounds with Scalable Frequency-Domain Synthesis (SIGGRAPH 2008) Van-den Doel et al FOLEYAUTOMATIC: Physically-based Sound Effects for Interactive Simulation and Animation Siggraph 2001 Obrien et al, Synthesizing Sounds from Rigid-Body Simulations – Siggraph 2001
Realistic Fracture Patterns
O'Brien, J. F. and Hodgins, J. K. Animating fracture. Commun. ACM 43, 7 (Jul. 2000), 68-75. O'Brien, J. F. and Hodgins, J. K. Graphical modeling and animation of brittle fracture. Siggraph 1999 Müller, M., McMillan, L., Dorsey, J., and Jagnow, R. Real-time simulation of deformation and fracture of stiff materials. Symposium
- n Comptuer Animation, 2001
In Real-time:
Combining Mocap with dynamics
Demo based on this by Bogdan Bucur (IET 2008-09) http://www.youtube.com/watch?v=wHV3GN8WdFA
ZORDAN, V. B., AND HODGINS, J. K. Motion capture driven simulations that hit and react. Symposium on Computer Animation 2002
Controllable Dynamics
Interactive Manipulation of Rigid Body Simulations Popovic et al Siggraph 2008 Detail-Preserving Fluid Control – Thürey et al – Symposium on compute animation 2006 Many-Worlds Browsing for Control of Multibody Dynamics Christopher D. Twigg Doug L. James (Siggraph 2007)
Physical Interaction
(beyond just the rumblestick)
Novint Falcon apprx. US$ 200 (Gaming Device, 2007) http://www.youtube.com/watch?v=gjAxGVH1JOM
Sensable Phantom OMNI approx USD 5-10k Realistic haptic feedback from virtual simulation Demo available in GV2 of the PHANTOM (just drop by)