Water S
Water S
Nuttapong Chentanez
NVIDIA Research
2
3
Overview
• Approaches to realtime water simulation
• Future
3
4
“2D” “3D”
4
“2D” Simulations
• Water represented by height above an
underlying terrain
5
6
“2D” Simulations
• Grid
NVIDIA DirectX 11, Island Demo Hilko et al. 09 Brodtkorb A. R. et al. 11,
• Particle
6
7
“2D” grid
• Water depth (and terrain
Z
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
9
10
FFT
• Pros
• Fast
• Great results for ocean wave, open water
• Cons
• No interaction with objects
• No boundary
10
11
11
12
Hilko et al. 09, “Real-Time Open Water Scenes with Interacting Objects”
12
13
13
14
14
15
• Cons
• No vortices
• No large flow
• Not unconditionally stable
15
16
16
17
Brodtkorb A. R. et al. 11, “Efficient Shallow Water Simulations on GPUs: Implementation, Visualization, Verification, and Validation”
17
18
• 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
19
20
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
22
23
23
24
• 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 Hilko et al. Brodtkorb A. R. et al. 11,
FFT Wave sim Shallow water sim
Pipe sim
• But no 3D effects
• Can get away with Yuksel et. al.
Wave Particle
Solenthaler et al. 11
Shallow water SPH
good procedural
approaches!
25
26
“3D” Simulations
• Grid
• Particles
SPH
26
27
3D grid
• Water states stored in 3D array
• Velocity
• Distance to surface
• Density
• etc.
27
28
28
29
29
30
• 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
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
34
35
SPH Simulation
35
36
SPH Simulation
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.
• Can’t afford to do
large scene with small NVIDIA GF100 Fluid NVIDIA PhysX Fluid
26
38
39
Overview
• Approaches to realtime water simulation
• Future
39
40
• 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
41
42
Chentanez N. and Mueller M. 2010, “Real-time Simulation of Large Bodies of Water with Small Scale Details”
42
43
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
47
48
Waterfall
48
49
49
50
50
51
51
52
52
53
53
54
More results
54
55
More results
55
56
Overview
• Approaches to realtime water simulation
• Future
56
57
• Computation increase
with volume of water
• Foam
• Spray
57
58
Chentanez N. and Mueller M. 2011, “Real-Time Eulerian Water Simulation Using a Restricted Tall Cell Grid”
58
59
59
60
60
61
Discretization
• Tall cell grid
• Each column consist of
• Constant number of regular cells
• One tall cell
• Terrain
61
62
Discretization
∆x
• Tall cell grid
• Heights are multiple of ∆x
• Physical quantities u, ϕ 4∆x
• At cell center for regular cells
• At top and bottom of tall cells
6∆x
62
63
Discretization
• Tall cell grid
• Quantity q at world position(x∆x, y∆x, z∆x)
denoted by q(x, y, z)
• Hide tall cell structure of the grid
“Air value”
Direct lookup
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
68
69
Time integration
Extrapolate u to air
69
70
Time integration
Extrapolate u to air
70
71
Time integration
Extrapolate u to air
71
72
Time integration
Extrapolate u to air
72
73
Time integration
Extrapolate u to air
73
74
Time integration
Extrapolate u to air
74
75
Time integration
Extrapolate u to air
75
76
Time integration
Extrapolate u to air
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
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 2
= −u · ∇u − ∇p + µ∇ u + f
∂t
∇·u=0
85
86
∂u f ∇p
= −(u · ∇)u + −
∂t ρ ρ
• Subject to ∇·u=0
86
87
• Subject to ∇·u=0
87
88
• Subject to ∇·u=0
88
89
• Subject to ∇·u=0
89
90
• Subject to ∇·u=0
90
91
91
92
∂φ
= −u · ∇φ
∂t
92
93
∂t
93