1/32 Real Time Fluids in Games Matthias Müller-Fischer, ageia.

Slides:



Advertisements
Similar presentations
Stable Fluids A paper by Jos Stam.
Advertisements

My First Fluid Project Ryan Schmidt. Outline MAC Method How far did I get? What went wrong? Future Work.
Formal Computational Skills
Christopher McCabe, Derek Causon and Clive Mingham Centre for Mathematical Modelling & Flow Analysis Manchester Metropolitan University MANCHESTER M1 5GD.
Navier-Stokes.
Matthias Müller, Barbara Solenthaler, Richard Keiser, Markus Gross Eurographics/ACM SIGGRAPH Symposium on Computer Animation (2005),
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
Mode-Splitting for Highly Detail, Interactive Liquid Simulation H. Cords University of Rostock Presenter: Truong Xuan Quang.
Advanced Computer Animation. Group Behaviors Group Behaviors : Motivation Many animations require natural-looking behavior from a large number of characters.
An Introduction to Multiscale Modeling Scientific Computing and Numerical Analysis Seminar CAAM 699.
1Notes. 2 Building implicit surfaces  Simplest examples: a plane, a sphere  Can do unions and intersections with min and max  This works great for.
1Notes  Textbook: matchmove 6.7.2, B.9. 2 Match Move  For combining CG effects with real footage, need to match synthetic camera to real camera: “matchmove”
1Notes  Text:  Motion Blur A.3  Particle systems 4.5 (and 4.4.1, 6.6.2…)  Implicit Surfaces  Classic particle system papers  W. Reeves, “Particle.
Intro to Fluid Simulation (I) Jeff Pool COMP
Particle Systems 1 Adapted from: E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012.
Acoustic Modeling of Reverberation using Smoothed Particle Hydrodynamics Thomas Wolfe.
Particle-based fluid simulation for interactive applications
Navier-Stokes. Pressure Force  Each volume element in a fluid is subject to force due to pressure. Assume a rectangular boxAssume a rectangular box Pressure.
1 MECH 221 FLUID MECHANICS (Fall 06/07) Tutorial 6 FLUID KINETMATICS.
Point Based Animation of Elastic, Plastic and Melting Objects Matthias Müller Richard Keiser Markus Gross Mark Pauly Andrew Nealen Marc Alexa ETH Zürich.
An Introduction to Stress and Strain
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
Modeling Fluid Phenomena -Vinay Bondhugula (25 th & 27 th April 2006)
Particle-Based non-Newtonian Fluid Animation for Melting Objects Afonso Paiva Fabiano P. do Carmo Thomas Lewiner Geovan Tavares Matmidia - Departament.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Intro to Computational Fluid Dynamics Brandon Lloyd COMP 259 April 16, 2003 Image courtesy of Prof. A.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Introduction to Modeling Fluid Dynamics 1.
By Michael Su 04/16/2009.  Introduction  Fluid characteristics  Navier-Stokes equation  Eulerian vs. Lagrangian approach  Dive into the glory detail.
Fluid Simulation for Graphics
Modeling, Simulating and Rendering Fluids Thanks to Ron Fediw et al, Jos Stam, Henrik Jensen, Ryan.
Simulation and Animation
Computer graphics & visualization Rigid Body Simulation.
Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly.
Scientific Computing Partial Differential Equations Explicit Solution of Wave Equation.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Fluids.
Fluid Animation CSE 3541 Matt Boggus. Procedural approximations – Heightfield fluids Mathematical background – Navier-Stokes equation Computational models.
Physically Based Animation and Modeling
GG 450 March 19, 2008 Stress and Strain Elastic Constants.
Simple and basic dynamical ideas…..  Newton’s Laws  Pressure and hydrostatic balance  The Coriolis effect  Geostrophic balance  Lagrangian-Eulerian.
Partial Differential Equations Introduction –Adam Zornes, Deng Li Discretization Methods –Chunfang Chen, Danny Thorne, Adam Zornes.
CEE 262A H YDRODYNAMICS Lecture 5 Conservation Laws Part I 1.
A Hybrid Particle-Mesh Method for Viscous, Incompressible, Multiphase Flows Jie LIU, Seiichi KOSHIZUKA Yoshiaki OKA The University of Tokyo,
Animation of Fluids.
Chapter 9: Differential Analysis of Fluid Flow SCHOOL OF BIOPROCESS ENGINEERING, UNIVERSITI MALAYSIA PERLIS.
Introduction to Fluid Mechanics
COMPUTATIONAL FLUID DYNAMICS IN REAL-TIME An Introduction to Simulation and Animation of Liquids and Gases.
Smoothed Particle Hydrodynamics (SPH) Fluid dynamics The fluid is represented by a particle system Some particle properties are determined by taking an.
使用波動方程式的擬真 和互動式水面模擬 吳金龍 Advisor: Damon Shing-Min Liu.
A conservative FE-discretisation of the Navier-Stokes equation JASS 2005, St. Petersburg Thomas Satzger.
A Unified Lagrangian Approach to Solid-Fluid Animation Richard Keiser, Bart Adams, Dominique Gasser, Paolo Bazzi, Philip Dutré, Markus Gross.
A particle-gridless hybrid methods for incompressible flows
Software for the Games Industry 9 November 2004 Fluid Gaming: Particle Methods for Fluid Mechanics and Visualisation Graham Wynn James Gray Richard West.
Simplified Smoothed Particle Hydrodynamics for Interactive Applications Zakiya Tamimi Richard McDaniel Based on work done at Siemens Corporate.
Detail-Preserving Fluid Control N. Th ű rey R. Keiser M. Pauly U. R ű de SCA 2006.
1996 Eurographics Workshop Mathieu Desbrun, Marie-Paule Gascuel
Particles Paul Taylor Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes.
Matthew Zhu. At each time step calculate each particle’s acceleration and use Verlet numerical integration to update its position, velocity, and grid.
Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory # Discretization Methods Topics Equations and The Goal Brief overview.
Perpetual Visualization of Particle Motion and Fluid Flow Presented by Tsui Mei Chang.
Smoothed Particle Hydrodynamics Matthew Zhu CSCI 5551 — Fall 2015.
Game Technology Animation V Generate motion of objects using numerical simulation methods Physically Based Animation.
Particle-based Viscoelastic Fluid Simulation Simon Clavet Philippe Beaudoin Pierre Poulin LIGUM, Université de Montréal.
Point Based Animation of Elastic, Plastic and Melting Objects Mark Pauly Andrew Nealen Marc Alexa ETH Zürich TU Darmstadt Stanford Matthias Müller Richard.
Dynamics. Motion with Regard to Mass Particle Dynamics Mass concentrated in point Newton’s Equation Governs Motion f = M x.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Water Computational Fluid Dynamics Volumes Lagrangian vs. Eulerian modelling Navier-Stokes equations.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Computational Fluid Dynamics.
Great Innovations are possible through General Understanding …. P M V Subbarao Professor Mechanical Engineering Department I I T Delhi Thermodynamic View.
Fluid Animation CSE 3541 By: Matt Boggus.
Wave Physics PHYS 2023 Tim Freegarde.
Introduction to Fluid Mechanics
Presentation transcript:

1/32 Real Time Fluids in Games Matthias Müller-Fischer, ageia

2/32 ageia PhysX accelerator chip (PPU) PhysX SDK (PPU accelerated) –rigid bodies + joints –cloth simulation –fluid simulation (SPH)

3/32 Real Time Fluids in Games Fluids in Games Heightfield Fluids A very simple program Mathematical background Particle Based Fluids Simple particle systems Smoothed Particle Hydrodynamics (SPH)

4/32 Game Requirements CHEAP TO COMPUTE! fps of which fluid only gets a small fraction Low memory consumption Must run on consoles Stable even in non-realistic settings Visually plausible

5/32 Solutions Procedural Water Unbounded surfaces, oceans Heightfield Fluids Ponds, lakes Particle Systems Splashing, spray, puddles

6/32 Procedural Animation Simulate the effect, not the cause No limits to creativity E.g. superimpose sine waves: meshuggah.4fo.de, [2],[3] See Splish Splash session! Difficult but not impossible: Fluid – scene interaction

7/32 Heightfield Fluids

8/32 Heightfield Fluids Represent fluid surface as a 2D function u(x,y) Pro:Reduction from 3D to 2D Cons:One value per (x,y)  no breaking waves u x y u i j continuousdiscrete

9/32 Heightfield „Hello World“ loop v[i,j] +=(u[i-1,j] + u[i+1,j] + u[i,j-1] + u[i,j+1])/4 – u[i,j] v[i,j] *= 0.99 u[i,j] += v[i,j] endloop Clamp on boundary e.g. def. u[-1,j] = u[0,j] A trivial algorithm with impressive results! Initialize u[i,j] with some interesting function, v[i,j]=0

10/32 The Math Behind It u x xx+dx A u Vibrating string fufu f u(x) displacement normal to x -axis Assuming small displacements and constant stress  Force acting normal to cross section A is f =  Infinitesimal element

11/32 PDE for the 1D String u x xx+dx A u Vibrating string fufu f Force acting normal to cross section A is f =  Component in u -direction f u  u x  ( u x derivative w.r.t. x ) Newton’s 2 nd law for an infinitesimal segment  dx)u tt =  u x  x+dx -  u x  x   u tt =  u xx Infinitesimal element

12/32 The 1D Wave Equation For the string we have  u tt =  u xx Standard form: u tt = c 2 u xx, where c 2 =  General solution: u(t) = a · f (x + ct) + b · f (x - ct) for any function f. Thus, c is the speed at which waves travel

13/32 Intuition Positive curvature is accelerated upwards Negative curvature is accelerated downwards u tt = c 2 u xx

14/32 The 2D Wave Equation The wave equation generalizes to 2D as u tt = c 2 (u xx + u yy ) u tt = c 2  2 u u tt = c 2  u

15/32 Discretization Replace the 2 nd order PDE by two first order PDEs u t = v v t = c 2 (u xx + u yy ) Discretize in space and time (semi-implicit Euler, time step  t, grid spacing h ) v t+1 [i,j]= v t [i,j] +  tc 2 (u[i+1,j]+u[i-1,j]+u[i,j+1]+u[i,j-1]-4u[i,j])/h 2 u t+1 [i,j]= u t [i,j] +  t v t+1 [i,j] We are where we started! (without damping)

16/32 Remarks on Heightfields The simulation is only conditionally stable –Courant-Friedrichs-Lewy stability condition: c  t < h Mirror: Reflection Periodic: Wrap around Boundary conditions needed

17/32 Particle Based Fluids

18/32 Particle Based Fluids Particle systems are simple and fast With particle-particle interaction –Small puddles, blood, runnels –Small water accumulations Without particle-particle interaction –Spray, splashing

19/32 Simple Particle Systems Particles store mass, position, velocity, external forces, lifetimes mimi vivi fifi xixi Integrate d/dt x i = v i d/dt v i = f i /m i emitter Generated by emitters, deleted when lifetime is exceeded

20/32 Particle-Particle Interaction No interaction  decoupled system  fast For n particles n 2 potential interactions! To reduce to linear complexity O(n) define interaction cutoff distance d d

21/32 Spatial Hashing Fill particles into grid with spacing d Only search potential neighbors in adjacent cells Map cells [i,j,k] into 1D array via hash function h(i,j,k) d d

22/32 Lennard-Jones Interaction For simple fluid-like behavior: Equilibrium Attraction Repulsion k 1, k 2, m, n control parameters

23/32 Solving Navier-Stokes Eqn. How formulate Navier-Stokes Eqn. on particles? We need continuous fields, e.g. v(x) Only have v 1, v 2,.. v n sampled on particles Basic idea: –Particles induce smooth local fields –Global field is sum of local fields

24/32 SPH Smoothed Particle Hydrodynamics Invented for the simulation of stars [5] Often used for real-time fluid simulation in CG [6] Use scalar kernel function W(r) –Symmetric: W(|x-x i |) –Normalized:  W(x) dx = 1 xixi x r

25/32 Density Computation Global density field Density of each particle Mass conservation guaranteed

26/32 Smoothing Attributes Smoothing of attribute A Gradient of smoothed attribute

27/32 Equation of Motion The acceleration a i of particle i is, thus f i is body force evaluated at x i Because particles follow the fluid we have:

28/32 Pressure The pressure term yields Symmetrize (SPH problem: actio  reactio) where p i = k  i and k gas constant

29/32 Remaining Forces Gravity as in simple particle systems Viscosity (simmetrized)

30/32 Remarks on SPH Incompressibility –Pressure force reacts to density variation (bouncy) –Predict densities, solve for incompressibility [8] Rendering –Marching cubes of density iso surface [6] –Sprites, depth buffer smoothing Combine particles and heightfields [7]

31/32 References 1/2 [1]AGEIA: physx.ageia.comwww.ageia.comphysx.ageia.com [2]A. Fournier and W. T. Reeves. A simple model of ocean waves, SIGGRAPH 86, pages 75–84 [3]D. Hinsinger, F. Neyret, M.P. Cani, Interactive Animation of Ocean Waves, In Proceedings of SCA 02 [4]A. Jeffrey, Applied Partial Differential Equations, Academic Press, ISBN

32/32 References 2/2 [5]J. J. Monaghan, Smoothed particle hydrodynamics. Annual Review of Astronomy and Astrophysics, 30:543–574, [6]M. Müller, D. Charypar, M. Gross. Particle-Based Fluid Simulation for Interactive Applications, In Proceedings of SCA 03, pages [7]J. O’Brien and J. Hodgins, Dynamic simulation of splashing fluids, In Computer Animation 95, pages 198–205 [8]S. Premoze et.al, Particle based simulation of fluids, Eurographics 03, pages