Physically-Based Simulation on the GPU Mark HarrisNVIDIA Developer Technology.

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.
CHAPTER 1: COMPUTATIONAL MODELLING
ECMWF Governing Equations 1 Slide 1 Governing Equations I by Clive Temperton (room 124) and Nils Wedi (room 128)
Introduction Irina Surface layer and surface fluxes Anton
Institut für Meteorologie und Klimatologie Universität Hannover
Realistic Simulation and Rendering of Smoke CSE Class Project Presentation Oleksiy Busaryev TexPoint fonts used in EMF. Read the TexPoint manual.
Christopher Batty and Robert Bridson University of British Columbia
SolidWorks Flow Simulation
Flame Animation Team : Fire! Lee, Ho-Jin Kim, Young Soo.
Simulation of Fluids using the Navier-Stokes Equations Kartik Ramakrishnan.
DEBRIS FLOWS & MUD SLIDES: A Lagrangian method for two- phase flow simulation Matthias Preisig and Thomas Zimmermann, Swiss Federal Institute of Technology.
William Moss Advanced Image Synthesis, Fall 2008.
Modified from: A Survey of General-Purpose Computation on Graphics Hardware John Owens University of California, Davis David Luebke University of Virginia.
University of North Carolina - Chapel Hill Fluid & Rigid Body Interaction Comp Physical Modeling Craig Bennetts April 25, 2006 Comp Physical.
Karin Erbertseder Ferienakademie 2007
Combined Lagrangian-Eulerian Approach for Accurate Advection Toshiya HACHISUKA The University of Tokyo Introduction Grid-based fluid.
Static vector fields Wind can be simulated using vector fields. The specific vectors in the field determine the direction and size of the wind force applied.
Modeling Fluid Phenomena -Vinay Bondhugula (25 th & 27 th April 2006)
Visual Simulation of Smoke SIGGRAPH’01 Ronald Fedkiw, Jos Stam and Henrik Wann Jensen Stanford University & Alias|wavefront.
Modelling Realistic Water & Fire Sérgio Leal Socrates/Erasmus student at: AK Computer Graphics Institute for Computer Graphics and Vision Technical University.
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.
Modeling, Simulating and Rendering Fluids Thanks to Ron Fediw et al, Jos Stam, Henrik Jensen, Ryan.
Fluid Simulation for Computer Animation Greg Turk College of Computing and GVU Center Georgia Institute of Technology.
Simulation and Animation
Numerical methods for PDEs PDEs are mathematical models for –Physical Phenomena Heat transfer Wave motion.
Instructor: André Bakker
Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly.
Conservation Laws for Continua
Fluid Animation CSE 3541 Matt Boggus. Procedural approximations – Heightfield fluids Mathematical background – Navier-Stokes equation Computational models.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Physically-Based Simulation on Graphics Hardware Mark J. Harris UNC Chapel Hill Greg James NVIDIA Corp.
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.
Cloud Kwang Hee Ko September, 27, 2012 This material has been prepared by Y. W. Seo.
COMPUTATIONAL FLUID DYNAMICS IN REAL-TIME An Introduction to Simulation and Animation of Liquids and Gases.
CS559: Computer Graphics Lecture 38: Animation Li Zhang Spring 2008 Slides from Brian Curless at U of Washington.
A Fast Simulation Method Using Overlapping Grids for Interactions between Smoke and Rigid Objects Yoshinori Dobashi (Hokkaido University) Tsuyoshi Yamamoto.
DEVELOPMENT AND VALIDATION OF MODEL FOR AEROSOLS TRANSPORTATION IN BOUNDARY LAYERS A.S. Petrosyan, K.V. Karelsky, I.Smirnov Space Research Institute Russian.
1 Discretization of Fluid Models (Navier Stokes) Dr. Farzad Ismail School of Aerospace and Mechanical Engineering Universiti Sains Malaysia Nibong Tebal.
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
GPU-Accelerated Surface Denoising and Morphing with LBM Scheme Ye Zhao Kent State University, Ohio.
Mathematical Equations of CFD
1 Discretization of Fluid Models (Navier Stokes) Dr. Farzad Ismail School of Aerospace and Mechanical Engineering Universiti Sains Malaysia Nibong Tebal.
Taming a Wild River Jeff Lander Darwin 3D
Introduction: Lattice Boltzmann Method for Non-fluid Applications Ye Zhao.
FPGA Based Smoke Simulator Jonathan Chang Yun Fei Tianming Miao Guanduo Li.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Physically-Based Visual Simulation on Graphics Hardware Mark J. Harris Greg Coombe Thorsten Scheuermann.
Pre-calculated Fluid Simulator States Tree Marek Gayer and Pavel Slavík C omputer G raphics G roup Department of Computer Science and Engineering Faculty.
Linear Algebra Operators for GPU Implementation of Numerical Algorithms J. Krüger R. Westermann computer graphics & visualization Technical University.
Geometry processing on GPUs Jens Krüger Technische Universität München.
Smoothed Particle Hydrodynamics Matthew Zhu CSCI 5551 — Fall 2015.
Dynamic Geometry Displacement Jens Krüger Technische Universität München.
November 2005 Center for Computational Visualization Institute of Computational and Engineering Sciences Department of Computer Sciences University of.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Water Computational Fluid Dynamics Volumes Lagrangian vs. Eulerian modelling Navier-Stokes equations.
SIGGRAPH 2005 신 승 호 신 승 호. Water Drops on Surfaces Huamin Wang Peter J. Mucha Greg Turk Georgia Institute of Technology.
Animating smoke with dynamic balance Jin-Kyung Hong Chang-Hun Kim 발표 윤종철.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Computational Fluid Dynamics.
Fluid Animation CSE 3541 By: Matt Boggus.
Chapter 4 Fluid Mechanics Frank White
Hydrodynamics of slowly miscible liquids
© Fluent Inc. 1/10/2018L1 Fluids Review TRN Solution Methods.
Space Distribution of Spray Injected Fluid
Jens Krüger Technische Universität München
Introduction to Fluid Dynamics & Applications
Physically Based Modeling -Overview-
David Marshburn Comp 259 April 17, 2002
Presentation transcript:

Physically-Based Simulation on the GPU Mark HarrisNVIDIA Developer Technology

Simulating the world Simulate a wide variety of phenomena on GPUs –Anything we can describe with discrete PDEs or approximations of PDEs –I will talk about boiling, reaction-diffusion, fluids, and clouds

Approximate Methods Several approximations for PDEs –Cellular Automata (CA) –Coupled Map Lattice (CML) –Lattice-Boltzmann Methods (LBM) I’ll talk briefly about CML

Coupled Map Lattice Mapping: –Continuous state  lattice nodes Coupling: –Nodes interact with each other to produce new state according to specified rules Extension of CA: –Continuous state at cells instead of discrete

Example: Boiling State = Temperature Three operations: –Diffusion, buoyancy, & latent heat Based on [Yanagita 1992] 3D Simulation –Stack of 2D texture slices –Sample from neighboring slices DEMO

PDE Simulations Floating-point GPUs open up new possibilities –Less Ad Hoc methods: real PDEs –Must be able to discretize in space and time I’ll discuss three examples: –Reaction-Diffusion –Fluid Dynamics –Cloud Dynamics

Reaction-Diffusion Gray-Scott reaction-diffusion model [Pearson 1993] State = two scalar chemical concentrations Simple: just Diffusion and Reaction ops U, V are chemical concentrations, F, k, D u, D v are constants

Demo: “Disease”

Fluid Dynamics Solution of Navier-Stokes flow eqs. –Stable for arbitrary time steps Means you can run it fast! –[Stam 1999], [Fedkiw et al. 2001] Can be implemented on latest GPUs –Quite a bit more complex than R-D or boiling See “Fast Fluid Dynamics Simulation on the GPU” –Harris, GPU Gems, 2004

Navier-Stokes Equations Describe flow of an incompressible fluid Advection Pressure Gradient Diffusion (viscosity) External Force Velocity is divergence-free

Fluid Simulator Demo

Cloud Dynamics Overview 3 components –7 unknowns Fluid dynamics –Motion of the air Thermodynamics –Temperature changes Water continuity –Evaporation, condensation Water vapor mixing ratio: q v Liquid water mixing ratio: q c Velocity: Pressure: p Potential temperature:  (see dissertation)

Thermodynamics Temperature affected by –Heat sources –Advection –Latent heat released / absorbed during condensation / evaporation  temperature = advection + latent heat release + temperature input

Water Continuity Water is conserved –Condensation balances Evaporation –  H2O vapor = -  H2O liquid –  = Phase changes + advection Liquid water is what is rendered –Convert water field to a “density” texture

Cloud Dynamics

Simulation Algorithm Advect quantities q, q v, q c and u –Similar to [Stam, 1999] Compute and apply accelerations –Buoyancy Compute condensation, evaporation, and temperature changes Enforce momentum conservation –Otherwise velocity dissipates, loses “swirls” –Projection step of “Stable Fluids” [Stam, 1999]

Simulation Algorithm Most steps are simple –Most use one fragment program, one pass –Programs come directly from equations Tricky parts: –Staggered grid discretization See dissertation (harris, 2003) –Stable Fluids projection step Vectorized solver (see earlier talks) –Boundary conditions (Static Branch Resolution – earlier talks) –3D Simulation

Flat 3D Textures

Advantages –One texture update per operation –Better use of GPU parallelism –Non-power-of-two Textures –Quick simulation preview Disadvantage –Must compute texture offsets

Conclusion GPUs are a capable, efficient, and flexible platform for physically-based visual simulation The possibilities are endless!

Acknowledgements Fellow UNC Students –Bill Baxter, Greg Coombe, Thorsten Scheuermann Anselmo Lastra and other UNC Faculty Sponsors: –NVIDIA Corporation –US National Institutes of Health –US Office of Naval Research –US Department of Energy ASCI program –US National Science Foundation

Selected References Chorin, A.J., Marsden, J.E. A Mathematical Introduction to Fluid Mechanics. 3rd ed. Springer. New York, 1993 Fedkiw, R., Stam, J. and Jensen, H.W. Visual Simulation of Smoke. In Proceedings of SIGGRAPH 2001, ACM Press / ACM SIGGRAPH Harris, M., Coombe, G., Scheuermann, T., and Lastra, A. Physically-Based Visual Simulation on Graphics Hardware.. Proc SIGGRAPH / Eurographics Workshop on Graphics Hardware Harris, Baxter, Scheuermann, Lastra. Simulation of Cloud Dynamics on Graphics Hardware. Proc. Graphics Hardware Harris, M. Real-Time Cloud Simulation and Rendering. Ph.D. Dissertation. Kaneko, K. (ed.), Theory and applications of coupled map lattices. Wiley, Nishimori, H. and Ouchi, N. Formation of Ripple Patterns and Dunes by Wind-Blown Sand. Physical Review Letters, Pearson, J.E. Complex Patterns in a Simple System. Science, Stam, J. Stable Fluids. In Proceedings of SIGGRAPH 1999, ACM Press / ACM SIGGRAPH, Turk, G. Generating Textures on Arbitrary Surfaces Using Reaction-Diffusion. In Proceedings of SIGGRAPH 1991, ACM Press / ACM SIGGRAPH, Witkin, A. and Kass, M. Reaction-Diffusion Textures. In Proceedings of SIGGRAPH 1991, ACM Press / ACM SIGGRAPH,

More References Gomez, M. Interactive Simulation of Water Surfaces. in Game Programming Gems. Charles River Media, p 187. Lengyel, E. Mathematics for 3D Game Programming & Computer Graphics. Charles River Media, Chapter 12, p 327. James, G. Operations for Hardware-Accelerated Procedural Texture Animation. in Game Programming Gems II. Charles River Media, p 497. Strzodka, R. Virtual 16 Bit Precise Operations on RGBA8 Textures. Proceedings VMV 2002, 2002 Strzodka, R., Rumpf, M. Using Graphics Cards for Quantized FEM Computations. In Proceedings VIIP 2001, Yanagita, T. Phenomenology of boiling: A coupled map lattice model. Chaos, Yanagita, T. and Kaneko, K. Coupled map lattice model for convection. Physics Letters A, Yanagita, T. and Kaneko, K. Modeling and Characterization of Cloud Dynamics. Physical Review Letters,

Extra Slides

3D simulation Lattice is now 3D –3D texture or stack of 2D textures –Or tile slices onto a large 2D texture Neighbor sampling is 3D –Texels in nearby slices –If it’s a 3D texture, just perturb the r texture coordinate to get slice neighbors –Otherwise bind neighbor slice textures

Fluid Simulation Details

Divergence-Free? In any element of fluid, inward velocity is balanced by outward velocity –No sources or sinks Ensures mass / momentum conservation

Algorithm Break it down [Stam 2000]: –Add forces: –Advect: –Diffuse: –Solve for pressure: –Subtract pressure gradient:

Algorithm Break it down [Stam 2000]: –Add forces:

Add Forces Scale force by time step, add to velocity In demo, we just “splat” –Color of splat encodes direction and strength of force (determined by mouse motion) –Simple fragment program adds gaussian splat to velocity texture

Algorithm Break it down [Stam 2000]: –Add forces: –Advect:

Advection Advection: quantities in a fluid are carried along by its velocity Want velocity at position x at new time t +  t Follow velocity field back in time from x : (x - w1  t) –Like tracing particles! –Simple in a fragment program u(x, t+  t) u(x’, t) Path of fluid Trace back in time

Algorithm Break it down [Stam 2000]: –Add forces: –Advect: –Diffuse:

Viscous Diffusion Viscous fluid exerts drag on itself –Causes diffusion of velocity Implicit, discrete form of –Explicit form is unstable Solution is just like the next step –Simpler to explain the next step…

Algorithm Break it down [Stam 2000]: –Add forces: –Advect: –Diffuse: –Solve for pressure:

Poisson-Pressure Solution Poisson Equation –Discretize, solve using iterative solver (relaxation) –Jacobi, Gauss-Seidel, Multigrid, etc. Jacobi easy on GPU, the rest are trickier Demo uses Jacobi iteration (15-20 iters.) –Boils down to repeated evaluation of:  = grid spacing u, v = components of w 3 i, j = grid coordinates n = solution iteration

Algorithm Break it down [Stam 2000]: –Add forces: –Advect: –Diffuse: –Solve for pressure: –Subtract pressure gradient:

Subtract Pressure Gradient Last computation of the time step –u is now a divergence-free velocity field Very simple fragment program  = grid spacing i, j = grid coordinates u, v = components of u u3,v3 = components of w 3 p = pressure

Fluid Simulator Demo (more)

Boundary Conditions Various types of BCs –No-slip, free-slip, outflow, inflow, periodic, etc. Demo uses “no-slip” velocity BCs –V = 0 at boundaries. Pressure: pure Neumann BCs –Have to set them each iteration of solver –p (boundary) = p (nearest non-boundary neighbor)

Cloud Details

Fluid Dynamics Incompressible Euler equations Same as previous fluid simulation –Viscosity = 0 Buoyancy term –Temperature, pressure, water changes induce motion

Projection Step Enforces divergence-free velocity –Iterative solution of Poisson-pressure eq. Poisson solver options –Conjugate Gradient –Multigrid –Fast Fourier Transform –Jacobi, Red-Black Gauss Seidel

Vectorized Solvers Pressure is scalar, texels are RGBA –Pack 4 pressure values in each texel –Process 4x fewer fragments each iteration

Simulation Amortization Simulation takes ~200 ms per step –64x64x64 volume, GeForce FX 5900 Ultra But simulation time step represents 3s of actual time –On the order of visual change in real clouds –So, faster than real time, but low frame rate

Simulation Amortization Non-interactive application: –Simulate as fast as possible –Frame rate suffers 20ms

Simulation Amortization Interactive frame rate! –Simulation still proceeds pretty fast 10 20ms