Realtime Water Simulation on GPU. Nuttapong Chentanez NVIDIA Research

Similar documents
CGT 581 G Fluids. Overview. Some terms. Some terms

Overview of Traditional Surface Tracking Methods

Fluids in Games. Jim Van Verth Insomniac Games

Fluid Simulation. [Thürey 10] [Pfaff 10] [Chentanez 11]

Navier-Stokes & Flow Simulation

PHYSICALLY BASED ANIMATION

Interaction of Fluid Simulation Based on PhysX Physics Engine. Huibai Wang, Jianfei Wan, Fengquan Zhang

Realistic Animation of Fluids

Navier-Stokes & Flow Simulation

Navier-Stokes & Flow Simulation

CS-184: Computer Graphics Lecture #21: Fluid Simulation II

Adarsh Krishnamurthy (cs184-bb) Bela Stepanova (cs184-bs)

Shape of Things to Come: Next-Gen Physics Deep Dive

2.7 Cloth Animation. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter 2 123

Particle-Based Fluid Simulation. CSE169: Computer Animation Steve Rotenberg UCSD, Spring 2016

Smoke Simulation using Smoothed Particle Hydrodynamics (SPH) Shruti Jain MSc Computer Animation and Visual Eects Bournemouth University

Ship in a Bottle. 1 Modeling and Rendering the Water. Saket Patkar and Bo Zhu

Height Filed Simulation and Rendering

CUDA. Fluid simulation Lattice Boltzmann Models Cellular Automata

Interactive Fluid Simulation using Augmented Reality Interface

Water. Notes. Free surface. Boundary conditions. This week: extend our 3D flow solver to full 3D water We need to add two things:

A Geometric Approach to Animating Thin Surface Features in SPH Water

Introduction to Computer Graphics. Animation (2) May 26, 2016 Kenshi Takayama

Realistic Animation of Fluids

Support for Multi physics in Chrono

CS 231. Fluid simulation

Abstract. Introduction. Kevin Todisco

Divergence-Free Smoothed Particle Hydrodynamics

Hardware Accelerated Real-Time Fluid Surface Simulation

Particle-based Fluid Simulation

Interactive Fluid Simulation Using Augmented Reality Interface

Acknowledgements. Prof. Dan Negrut Prof. Darryl Thelen Prof. Michael Zinn. SBEL Colleagues: Hammad Mazar, Toby Heyn, Manoj Kumar

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

Real-Time Volumetric Smoke using D3D10. Sarah Tariq and Ignacio Llamas NVIDIA Developer Technology

Lagrangian methods and Smoothed Particle Hydrodynamics (SPH) Computation in Astrophysics Seminar (Spring 2006) L. J. Dursi

Ocean simulation and rendering in War Thunder. Tim Tcheblokov, NVIDIA

FLUID SIMULATION. Kristofer Schlachter

Multiresolution volume processing and visualization on graphics hardware van der Laan, Wladimir

GPU Particles. Jason Lubken

Simulation of Swirling Bubbly Water using Bubble Particles

Solidification using Smoothed Particle Hydrodynamics

An Adaptive Sampling Approach to Incompressible Particle-Based Fluid

Dynamical Simulation 1: Particle Systems and ODEs

Comparison between incompressible SPH solvers

3D Fluid Simulation Sample

SPH: Why and what for?

T6: Position-Based Simulation Methods in Computer Graphics. Jan Bender Miles Macklin Matthias Müller

Applications of ICFD /SPH Solvers by LS-DYNA to Solve Water Splashing Impact to Automobile Body. Abstract

IMPROVED WALL BOUNDARY CONDITIONS WITH IMPLICITLY DEFINED WALLS FOR PARTICLE BASED FLUID SIMULATION

Example 13 - Shock Tube

Real-time Breaking Waves for Shallow Water Simulations

The 3D DSC in Fluid Simulation

Permeable and Absorbent Materials in Fluid Simulations

Technical Report TR

Continued Investigation of Small-Scale Air-Sea Coupled Dynamics Using CBLAST Data

An Efficient Adaptive Vortex Particle Method for Real-Time Smoke Simulation

Animation of Fluids. Animating Fluid is Hard

Adaptive Particles for Incompressible Fluid Simulation (Technical Report tamu-cs-tr )

STYLISTIC CONTROL OF OCEAN WATER SIMULATIONS. A Thesis CHRISTOPHER WAYNE ROOT

Fluid Simulation. Dhruv Kore, Giancarlo Gonzalez, and Jenny Sum CS 488: Introduction to Computer Graphics Professor Angus Forbes

AN ADAPTIVE SAMPLING APPROACH TO INCOMPRESSIBLE PARTICLE-BASED FLUID. A Dissertation WOO-SUCK HONG

NVIDIA. Interacting with Particle Simulation in Maya using CUDA & Maximus. Wil Braithwaite NVIDIA Applied Engineering Digital Film

Computer animation for fluid simulation of a high viscous fluid melting

REAL-TIME WATER WAVES WITH WAVE PARTICLES. A Dissertation. Cem Yuksel

A Framework for Real-Time Animation of Liquid-Rigid Body Interaction

CS205b/CME306. Lecture 9

Real-Time Rain Rendering in City Environments

Modeling of Granular Materials

BCC Particle System Generator

Texture Advection. Ronald Peikert SciVis Texture Advection 6-1

Attention to Detail! Creating Next Generation Content For Radeon X1800 and beyond

CNM 190, pt 2 Advanced Digital Animation Lec 03 : Art Direction on Madagascar / Effects 1

Level set methods Formulation of Interface Propagation Boundary Value PDE Initial Value PDE Motion in an externally generated velocity field

MOTION CONTROL FOR FLUID ANIMATION: FLOW ALONG A CONTROL PATH

About Phoenix FD PLUGIN FOR 3DS MAX AND MAYA. SIMULATING AND RENDERING BOTH LIQUIDS AND FIRE/SMOKE. USED IN MOVIES, GAMES AND COMMERCIALS.

Surface Tension. Liquid Effects in The Last of Us. Eben Cook Lead Visual Effects Artist, Naughty Dog Inc. Wednesday, March 19, 14

CFD MODELING FOR PNEUMATIC CONVEYING

Fluid Simulation Quality with Violated CFL Condition

Theodore Kim Michael Henson Ming C.Lim. Jae ho Lim. Korea University Computer Graphics Lab.

A High Quality, Eulerian 3D Fluid Solver in C++ A Senior Project. presented to. the Faculty of the Computer Science Department of

Coupling of STAR-CCM+ to Other Theoretical or Numerical Solutions. Milovan Perić

Supplemental Material Deep Fluids: A Generative Network for Parameterized Fluid Simulations

FLUID SIMULATION BY PARTICLE LEVEL SET METHOD WITH AN EFFICIENT DYNAMIC ARRAY IMPLEMENTATION ON GPU

Institutionen för systemteknik

Constraint fluids in Sprinkle. Dennis Gustafsson Mediocre

6.1 Rendering Wet Sand

Lattice Boltzmann with CUDA

CS 378: Computer Game Technology

Cloth Hair. and. soft bodies

CUDA/OpenGL Fluid Simulation. Nolan Goodnight

A Multigrid Fluid Pressure Solver Handling Separating Solid Boundary Conditions

Modeling of Granular Materials

Computational Study of Laminar Flowfield around a Square Cylinder using Ansys Fluent

FLUID MECHANICS TESTS

Fluid-structure Interaction by the mixed SPH-FE Method with Application to Aircraft Ditching

A study of Jumper FIV due to multiphase internal flow: understanding life-cycle fatigue. Alan Mueller & Oleg Voronkov

Ocean Wave Simulation in Real-time using GPU

Three Dimensional Numerical Simulation of Turbulent Flow Over Spillways

2.11 Particle Systems

Simple and Fast Fluids

Transcription:

1

Realtime Water Simulation on GPU Nuttapong Chentanez NVIDIA Research 2

3 Overview Approaches to realtime water simulation Hybrid shallow water solver + particles Hybrid 3D tall cell water solver + particles Future 3

4 Realtime Water Simulation 2D 3D 4

2D Simulations Water represented by height above an underlying terrain 5 5

6 2D Simulations Grid NVIDIA DirectX 11, Island Demo FFT Hilko et al. 09 Wave sim Pipe sim Brodtkorb A. R. et al. 11, Shallow water sim Particle Yuksel et. al. 07 Wave Particle Solenthaler et al. 11 Shallow water SPH 6

7 2D grid Water depth (and terrain height) stored in 2D array Z Water depth is updated in each time step X 7

8 FFT Fast Fourier Transform (FFT) Represent waves as sum of sinusoids Wave length, speed, amplitude from statistical models Update height and derivatives in frequency domain Use ifft to transform back to spatial domain for rendering 8

9 FFT NVIDIA DirectX 11, Island Demo 9

10 FFT Pros Fast Great results for ocean wave, open water Cons No interaction with objects No boundary 10

11 Wave equation / Pipe model Wave equation Assumptions: Water surface is a height field, velocity constant vertically, water is shallow, pressure gradient is vertical, ignore non-linear terms Discretize temporally and spatially Result in water height stored in 2D array + update rules 11

12 Wave equation / Pipe model Hilko et al. 09, Real-Time Open Water Scenes with Interacting Objects 12

13 Wave equation / Pipe model Pipe model Water heights stored in 2D array Neighbors are connected by pipe Flow rate in pipes updated by heights Heights changed by flow rate 13

14 Wave equation / Pipe model Stava et al. 08, Interactive Terrain Modeling Using Hydraulic Erosion 14

15 Wave equation / Pipe model Pros Still fast Interaction with objects Boundary Cons No vortices No large flow Not unconditionally stable 15

16 Shallow water equation Assumptions: Water surface is a height field, velocity is constant vertically, water is shallow, pressure gradient is vertical, with non-linear term Discretize temporally and spatially Result in water height + velocity stored in 2D array + update rules 16

17 Shallow water equation Brodtkorb A. R. et al. 11, Efficient Shallow Water Simulations on GPUs: Implementation, Visualization, Verification, and Validation 17

18 Shallow water equation Pros Still fast Interaction with objects Boundary Vortices Cons Not unconditionally stable No splash, foam, spray 18

19 Wave Particles Particle based wave simulation Each particle stores a waveform Particles form wave front Yuksel et. al. 07, Wave Particles Either bounce off or leave domain boundary 19

20 Wave Particles Yuksel et. al. 07, Wave Particles 20

21 Wave Particles Pros Interaction with objects Open boundary is easy Unconditionally stable Cons Still require grid for rendering No vortices No large flow 21

22 SPH Shallow Water Simulation Use Smoothed Particles Hydrodynamics (SPH) to solve shallow water equation Particles store mass and velocity Kernels are centered around particles SPHERIC - SPH European Research Interest Community Volume computed by summing kernel values Density = Mass / Volume interpreted as height 22

23 SPH Shallow Water Simulation Solenthaler et al. 11, SPH Based Shallow Water Simulation 23

24 SPH Shallow Water Simulation Pros Interaction with objects Open boundary is easy Vortices and Flow Cons Still require grid for rendering Not unconditionally stable Still no 3D effect! 24

25 2D Simulations Generally fast Interaction with solids Used in many games NVIDIA DirectX 11, Island Demo FFT Hilko et al. Wave sim Pipe sim Brodtkorb A. R. et al. 11, Shallow water sim But no 3D effects Can get away with good procedural approaches! Yuksel et. al. Wave Particle Solenthaler et al. 11 Shallow water SPH 25

26 3D Simulations Grid Long B. and Reinhard E. Keenan C. et al. 2007 Discrete Sine/Cosine Transform Regular Grid Particles NVIDIA GF100 Fluid Demo NVIDIA PhysX Fluid Demo SPH 26

27 3D grid Water states stored in 3D array Velocity Distance to surface Density etc. States are updated in each time step 27

28 Discrete Sine/Cosine Transform Use cosine and sine transform Instead of FFT To be able to enforce boundary condition Do physics in frequency domain Transform back to spatial domain 28

29 Discrete Sine/Cosine Transform Long B. and Reinhard E. 09, Real-Time Fluid Simulation Using Sine/Cosine Transforms 29

30 Discrete Sine/Cosine Transform Pros Relatively fast Unconditionally stable Cons No interaction with object Box shape domain No small scale details for coarse grid 30

31 Regular grid Commonly used in offline production simulation Store water states in dense 3D grid Solve fluid dynamics PDE by discretizing spatially and temporally States in the next time step determined by state in the current time step and external forces Brute Force 31

32 Regular Grid Keenan C. et al. 2007, Real Time Simulation and Rendering of 3D Fluids 32

33 Regular Grid Pros Good result Unconditionally stable Cons Box shape domain Very computationally intensive Mass loss No small scale details for coarse grid 33

34 SPH Simulation Use Smoothed Particles Hydrodynamics (SPH) to solve fluid dynamic PDE Particles store mass, velocity, Kernels are centered around particles Mueller et al. 03, Particle-Based Fluid Simulation for Interactive Applications Reconstruct surface from particle or render particles directly 34

35 SPH Simulation NVIDIA PhysX Fluid Demo 35

36 SPH Simulation NVIDIA GF100 Fluid Demo 36

37 SPH Simulation Pros Arbitrary domain Interaction with object No mass loss Cons Noisy surface Not unconditionally stable 37

38 3D Simulations At high resolution, produce great results Widely used in movie industry Long B. Keenan C. Discrete Sine/Cosine Transform Regular Grid Can t afford to do large scene with small scale details NVIDIA GF100 Fluid SPH NVIDIA PhysX Fluid 26 38

39 Overview Approaches to realtime water simulation Hybrid shallow water solver + particles Hybrid 3D tall cell water solver + particles Future 39

40 Shallow water equation Missing Splashes Sprays Small Waves Foams Use particles! Brodtkorb A. R. et al. 11, Efficient Shallow Water Simulations on GPUs: Implementation, Visualization, Verification, and Validation 40

41 Shallow Water Solver + Particles Large bodies of water Pond, River, Beach, Open Ocean Small scale details Splashes, Sprays, Small Waves, Foams 41

42 Shallow Water Solver + Particles Chentanez N. and Mueller M. 2010, Real-time Simulation of Large Bodies of Water with Small Scale Details 42

43 Shallow Water Equations Simplify from 3D Fluid Equation to 2D Water depth, h 2D velocity, v Terrain height, H Discretized with staggered grid Cell center : Store h and H X-Face and Z-Face : x and z component of v Z X 43

44 Particles Simulation Particles sources Waterfalls Terrain height discontinuity, create spray and splash Breaking waves When wave about to overturn, create spray and splash 44

45 Particles Simulation Particles sources Falling splash Create spray and foam Solid interaction Create spray and splash 45

46 Waterfall We treat a face as a waterfall face if Terrain height change is greater than a threshold and Water height in the lower cell has not yet reached the terrain height in the higher cell 46

47 Waterfall Particles generation Sample uniformly within red dotted box Total mass should be the same as mass flow across the face Velocity found by interpolation Jitter initial position and velocity 47

48 Waterfall 48

49 Adding small scale waves Simulation cannot resolve waves with wave length Decreasing may not be an option Still want small waves with the following properties Advected with the velocity field Not distorted excessively over time Disappear if being stretched too much Cheap to compute 49

50 Adding small scale waves Algorithm Generate texture using FFT simulation Advect 3 set of texture coordinates Fetch texture and blend to get displacement map Regenerate after some time 50

51 Adding small scale waves So far, waves will never disappear Wave persist even when being stretched a lot Can have lava-like look Need to suppress in region with too much stretch Without suppressant With suppressant 51

52 Adding small scale waves Measure of deformation Use maximum eigenvalue of the Green Strain of the texture coordinates Modulate the final displacement With an exponential decay Without suppressant With suppressant 52

53 Adding small scale waves 53

54 More results 54

55 More results 55

56 Overview Approaches to realtime water simulation Hybrid shallow water solver + particles Hybrid 3D tall cell water solver + particles Future 56

57 Grid based 3D water simulation Small domain Computation increase with volume of water Also want small scale details Splash Foam Spray Keenan C. et al. 2007, Real Time Simulation and Rendering of 3D Fluids 57

58 3D Tall Cell Water Solver + Particles Chentanez N. and Mueller M. 2011, Real-Time Eulerian Water Simulation Using a Restricted Tall Cell Grid 58

59 3D Tall Cell Water Solver + Particles 59

60 3D Tall Cell Water Solver States of water u - Velocity field ϕ - Level Set (Signed distance function) Positive inside water Negative outside water Zero on surface Store states on grid points Interpolate to get value everywhere http://en.wikipedia.org/wiki/file:signed_distance2.png Simulation == Rules to update these states 60

61 Discretization Tall cell grid Each column consist of Constant number of regular cells One tall cell Terrain 61

62 Discretization Tall cell grid Heights are multiple of Physical quantities u, ϕ x At cell center for regular cells At top and bottom of tall cells x 4 x 6 x 62

63 Discretization Tall cell grid Quantity q at world position denoted by q(x, y, z) Hide tall cell structure of the grid Air value Direct lookup (x x, y x, z x) Linear interpolation Terrain value 63

64 Time integration Extrapolate u to air 64

65 Time integration Extrapolate u to air 65

66 Time integration Extrapolate u to air 66

67 Time integration Extrapolate u to air 67

68 Time integration Extrapolate u to air Make ϕ a signed distance function Because ϕ will no longer be a signed distance function, as we update the states 68

69 Time integration Extrapolate u to air Make ϕ a signed distance function 69

70 Time integration Extrapolate u to air Make ϕ a signed distance function 70

71 Time integration Extrapolate u to air Make ϕ a signed distance function 71

72 Time integration Extrapolate u to air Make ϕ a signed distance function Move u and ϕ along velocity field u 72

73 Time integration Extrapolate u to air Make ϕ a signed distance function Move u and ϕ along velocity field u 73

74 Time integration Extrapolate u to air Make ϕ a signed distance function Move u and ϕ along velocity field u Adjust tall cell heights 74

75 Time integration Extrapolate u to air Make ϕ a signed distance function Move u and ϕ along velocity field u Adjust tall cell heights 75

76 Time integration Extrapolate u to air Make ϕ a signed distance function Move u and ϕ along velocity field u Adjust tall cell heights Make u divergence free The most difficult and time consuming step 76

77 Particles Spray Seed particles inside grid cells whose ϕ are positive but small (near water surface) Move them along velocity field u After we update ϕ, for each particle Check if ϕ at the current location is negative (outside water) If so, generate spray particles otherwise, ignore Move ballistically Foam Generate when spray particle falls into water Move with u, projected to water surface 77

78 More result Chentanez N. and Mueller M. 2011, Real-Time Eulerian Water Simulation Using a Restricted Tall Cell Grid 78

79 Future Hybrid 3D + 2D + Particles + Procedural? 3D + Particles near camera 2D + Particles further away 2D even further Procedural far from camera 79

80 Future Thuerey N. et, al, 2006 Animation of Open water Phenomena with coupled Shallow Water and Free Surface Simulation 80

81 Future Thuerey N. et, al, 2006 Animation of Open water Phenomena with coupled Shallow Water and Free Surface Simulation 81

82 Future Hybrid 3D + 2D + Particles + Procedural? 3D + Particles near camera 2D + Particles further away 2D even further Procedural far from camera Dynamic LOD Best quality within budget 82

83 Q&A Thank you very much! 83

84 References Tessendof SIGGRAPH Course 99, Simulating Ocean Wave Enright et al. SIGGRAPH 02, Animation and Rendering of Complex Water Surfaces Mueller et al. SCA 03, Particle-Based Fluid Simulation for Interactive Applications Thuerey N. et, al, SCA 06 Animation of Open water Phenomena with coupled Shallow Water and Free Surface Simulation Keenan C. et al. GPU Gems III 07, Real Time Simulation and Rendering of 3D Fluids Yuksel et. al. SIGGRAPH 07, Wave Particles Stava et al. SCA 08, Interactive Terrain Modeling Using Hydraulic Erosion Hilko et al. Eurographics workshop on natural phenomena 09, Real-Time Open Water Scenes with Interacting Objects Long B. and Reinhard E. I3D 09, Real-Time Fluid Simulation Using Sine/Cosine Transforms Chentanez N. and Mueller M. SCA 10, Real-time Simulation of Large Bodies of Water with Small Scale Details Brodtkorb A. R. et al. Computer & Fluid 11, Efficient Shallow Water Simulations on GPUs: Implementation, Visualization, Verification, and Validation Chentanez N. and Mueller M. SIGGRAPH 11, Real-Time Eulerian Water Simulation Using a Restricted Tall Cell Grid 84

85 Math u t = u u p + µ 2 u + f u =0 85

86 3D Tall Cell Water Solver Solve Inviscid Euler Equations u t = (u )u + f ρ p ρ Subject to u =0 Inside region φ < 0 φ = u φ t 86

87 3D Tall Cell Water Solver Solve Inviscid Euler Equations Change in velocity u t = (u )u + f ρ p ρ Subject to u =0 Inside region φ < 0 φ = u φ t 87

88 3D Tall Cell Water Solver Solve Inviscid Euler Equations Change in velocity Velocity moves itself u t = (u )u + f ρ p ρ Subject to u =0 Inside region φ < 0 φ = u φ t 88

89 3D Tall Cell Water Solver Solve Inviscid Euler Equations Change in velocity Velocity moves itself u t = (u )u + f ρ p ρ External force such as gravity Subject to u =0 Inside region φ < 0 φ = u φ t 89

90 3D Tall Cell Water Solver Solve Inviscid Euler Equations Change in velocity Velocity moves itself u t = (u )u + f ρ p ρ External force such as gravity Pressure gradient Subject to u =0 Inside region φ < 0 φ = u φ t 90

91 3D Tall Cell Water Solver Solve Inviscid Euler Equations Change in velocity Velocity moves itself u t = (u )u + f ρ p ρ External force such as gravity Pressure gradient Subject to u =0 Incompressibility - What come in must go out Inside region φ < 0 φ = u φ t 91

92 3D Tall Cell Water Solver Solve Inviscid Euler Equations Change in velocity Velocity moves itself u t = (u )u + f ρ p ρ External force such as gravity Pressure gradient Subject to u =0 Incompressibility - What come in must go out Inside region φ < 0 φ = u φ t Implicit function that represent water body 92

93 3D Tall Cell Water Solver Solve Inviscid Euler Equations Change in velocity Velocity moves itself u t = (u )u + f ρ p ρ External force such as gravity Pressure gradient Subject to u =0 Incompressibility - What come in must go out Inside region φ < 0 φ = u φ t Implicit function that represent water body Implicit function moved by water velocity 93