Download presentation

Presentation is loading. Please wait.

Published byKatelyn Ford Modified over 3 years ago

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

2
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

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

4
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

5
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

6
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

7
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

8
Demo: “Disease”

9
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

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

11
Fluid Simulator Demo

12
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)

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

14
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

15
Cloud Dynamics

16
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]

17
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

18
Flat 3D Textures

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

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

21
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

22
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. 2001. Harris, M., Coombe, G., Scheuermann, T., and Lastra, A. Physically-Based Visual Simulation on Graphics Hardware.. Proc. 2002 SIGGRAPH / Eurographics Workshop on Graphics Hardware 2002. Harris, Baxter, Scheuermann, Lastra. Simulation of Cloud Dynamics on Graphics Hardware. Proc. Graphics Hardware 2003. Harris, M. Real-Time Cloud Simulation and Rendering. Ph.D. Dissertation. http://www.markmark.net/dissertation Kaneko, K. (ed.), Theory and applications of coupled map lattices. Wiley, 1993. Nishimori, H. and Ouchi, N. Formation of Ripple Patterns and Dunes by Wind-Blown Sand. Physical Review Letters, 71 1. 197-200. 1993. Pearson, J.E. Complex Patterns in a Simple System. Science, 261. 189-192. 1993. Stam, J. Stable Fluids. In Proceedings of SIGGRAPH 1999, ACM Press / ACM SIGGRAPH, 121-128. 1999. Turk, G. Generating Textures on Arbitrary Surfaces Using Reaction-Diffusion. In Proceedings of SIGGRAPH 1991, ACM Press / ACM SIGGRAPH, 289-298. 1991. Witkin, A. and Kass, M. Reaction-Diffusion Textures. In Proceedings of SIGGRAPH 1991, ACM Press / ACM SIGGRAPH, 299-308. 1991.

23
More References Gomez, M. Interactive Simulation of Water Surfaces. in Game Programming Gems. Charles River Media, 2000. p 187. Lengyel, E. Mathematics for 3D Game Programming & Computer Graphics. Charles River Media, 2002. Chapter 12, p 327. James, G. Operations for Hardware-Accelerated Procedural Texture Animation. in Game Programming Gems II. Charles River Media, 2001. 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, 2001. Yanagita, T. Phenomenology of boiling: A coupled map lattice model. Chaos, 2 3. 343-350. 1992. Yanagita, T. and Kaneko, K. Coupled map lattice model for convection. Physics Letters A, 175. 415-420. 1993. Yanagita, T. and Kaneko, K. Modeling and Characterization of Cloud Dynamics. Physical Review Letters, 78 22. 4297-4300. 1997

24
Extra Slides

25
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

26
Fluid Simulation Details

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

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

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

30
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

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

32
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

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

34
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…

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

36
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

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

38
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

39
Fluid Simulator Demo (more)

40
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)

41
Cloud Details

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

43
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

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

45
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

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

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

Similar presentations

OK

By Michael Su 04/16/2009. Introduction Fluid characteristics Navier-Stokes equation Eulerian vs. Lagrangian approach Dive into the glory detail.

By Michael Su 04/16/2009. Introduction Fluid characteristics Navier-Stokes equation Eulerian vs. Lagrangian approach Dive into the glory detail.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on online registration system Ppt on off the job training methods Pdf to ppt online nitro Download ppt on telephone etiquette Ppt on saas business model Ppt on hard gelatin capsule composition Ppt on types of forest in india Ppt on cctv camera technology Ppt on wildlife conservation in india Ppt on power system