Presentation is loading. Please wait.

Presentation is loading. Please wait.

Fast Hydraulic Erosion Simulation and Visualization on GPU

Similar presentations


Presentation on theme: "Fast Hydraulic Erosion Simulation and Visualization on GPU"— Presentation transcript:

1 Fast Hydraulic Erosion Simulation and Visualization on GPU
Xing Mei1 Philippe Decaudin2 Bao-Gang Hu1 1. CASIA (China) INRIA (France) Pacific Graphics’07

2 Outline Introduction Hydraulic Erosion on GPU Results
Existing Methods Hydraulic Erosion on GPU Method Overview Simulation Steps Multi-pass Implementation on GPU Results Conclusion & Future Work Outline.

3 Introduction - Hydraulic Erosion
Process Water flow takes away (dissolves) the soil and relocates (deposits) it somewhere else Effect Changes terrain appearance Creates interesting geo-morphological structures Process Effect Examples Some gullies were created by rainfall on the slope. Some beautiful eroded mountains in Maui Gullies Eroded landscape on Maui Island

4 Introduction - Erosion Simulation (Why?)
Enhance realism A useful complement to fluid simulation Topographical changes affect the water flow [Chiba’98] Simulation brings great realism to synthesized terrains A useful complement to fluid simulation. When the terrain changes under erosion, it affect the distribution of the river flow. In this example, the river channel changed due to the erosion. [Beneš’06]

5 Introduction - Existing Methods
Procedural [Kelly’88, Prusinkiewicz’93] Ad hoc rules with fractal terrain generation Fast and efficient; No water flow involved Limited control on the erosion results Physically Based Simulation [Musgrave’89, Chiba’98, Neidhold’05…] Simulation on already-existing terrains Controllable Erosion Process, but computationally expensive 4 fps on 256x256 grids [Neidhold’05] 5 fps on 300x300 grids [Beneš’07] Many methods have been proposed for creating eroded terrains. Procedural Physically based. Limited for interactive applications

6 Erosion on GPU - Motivation
A novel hydraulic erosion simulation method Effective produces the important features in the erosion process Gullies, water catchments, deposited sediment… Efficient Well mapped to GPU Interactive frame rates for large size terrains So our motivation is that…

7 Erosion on GPU - Method Overview
5 steps in one cycle of the simulation (1) Water Increment (2) Water Movement (flow simulation) water (3) Erosion or Deposition (4) Sediment Transportation Rainfall & River Source (5) Evaporation Water Movement Erosion Evaporation Terrain We divide one cycle of the simulation into 5 steps. First, some water will appear on the terrain due to rainfall or river sources. We call this step “water increment” (2) Second, the water will move on the terrain under gravity. We call this step “Water Movement or flow simulation” (3) Then, in the 3rd step, the flow will pick up some soil from the ground, which we call “erosion”,or drop some suspended sediment onto the terrain, which we call “Deposition”. In this step, the terrain surface is changed. (4) In the 4th step, the suspended sediment will be transported by the flow. (5) Finally, some water catchment(or Lakes, a better word) and deposited sediment will form at some low places. And some water will be lost due to evaporation. We repeat this cycle to get dynamic simulation results. Step 2,3,4 are most important steps for the simulation. Sediment Transportation Deposition Catchment Deposited Sediment

8 Erosion on GPU - Data Structure
Layers of 2D arrays Each step should update the cell data in parallel No scattering operations on the data array involved cell Suspended Sediment Outflow flux Velocity Water Height - Terrain Height - Arrays Before describing each step, we have a look at the data structure. We use several layers of 2D arrays to store the data. For each cell, we store…. Outflow flux is important for flow simulation. While velocity field is critical erosion step and the sediment transport step. (2) We require that each step should…. And we don’t want to have scattering operations when updating the data. What is scattering operation? Simply speaking, when update one cell, you do not update its neighboring cells. This operation on data arrays is still not suitable for pure GPU computation. cell

9 Erosion on GPU (1) Water Increment
Two kinds of sources River sources – fixed location, radius, intensity Raindrops – random location, radius, intensity For the first step, we define two kinds of water sources. One is the river sources (left pic). The other one is the raindrops. For both sources, we need to specify the radius and the intensity. The only difference is the location. For river sources, the location is fixed, while for raindrops, we need a random distribution. In this step, we simply add the increment to the original water height. Water increment

10 Erosion on GPU (2) Water Movement (Flow Simulation)
Possible Models? GPU friendly Grid-based methods > Lagrangian methods Efficient Shallow water model > 3D Navier-Stokes Equation Suitable for Erosion-Deposition Velocity field is necessary Previous models on shallow water framework Simplified Newtonian physics model [Neidhold’05] hard to parallelize Kass&Miller’s implicit method [Beneš’07] many iterations over the grid, not efficient for large size terrain Our choice The Virtual Pipe model [O’Brien’95] The second step is to simulate the water flow on the terrain. There are a lot of work on flow simulation. So we want to take a proper model. We want the model to be… GPU-friendly..so….Efficient….so…. Suitable for …so… There have been some erosion models on shallow water framework. Neidhold….Benes…. We choose the virtual pipe model by ….

11 Erosion on GPU (2) Water Movement (Flow Simulation)
Virtual Pipe Model Water is exchanged between cells through virtual pipes How much water exchanged through each pipe? Flux – accelerated by the hydrostatic pressure difference Cell Two-Step Process Update Flux Update Water Height A simple explicit method P0 P0 We briefly introduce the virtual pipe model. In this model, the water is store in each cell. And the water is exchanged…(shown in left image) (2) How much water will be exchanged through each pipe. We call this value as “Flux”(denoted by capital“F”). It is calculated with Newtonian formula, using the hydrostatic pressure difference at each end of the pipes.(right image) (3) Two step process A explicit method. No linear system to solve. P1 P2

12 Erosion on GPU (2) Water Movement (Flow Simulation)
Two “problems” about the original model Cell Staggered grid water height (d) – cell center flux (F) – cell border 2. Non-negative water update A scaling back process scattering operations are involved Both are not GPU-friendly Two “Problems” appear when porting the model to GPU application: Each pipe and the flux value will be used by two neighboring cells, which means the flux value should be stored at cell borders, while the water height is stored at each cell. A staggered grid (where the flux grid is half grid size offset from the water grid) would be necessary for efficient implementation. However staggered grid is hard to maintain for GPU computation. 2. Second, there is a critical post-processing step for the virtual pipe model. To avoid the water height becoming negative (bringing numerical error, and no physical meaning), a scaling back process is needed. If the water height becomes negative, some water will be drawn back from its neighbors until it becomes positive. This scaling process needs scattering operations on the data array. Both problems are not GPU-friendly.

13 Erosion on GPU (2) Water Movement (Flow Simulation)
Adaptation to the original model the outflow flux for each cell Flux (F) and outflow flux (f) Water height update (d) - send away the outflow flux - collect inflow flux from neighbours Outflow flux Inflow flux Cell(x,y) (1) We solve the two problems by defining a new quality“Outflow Flux”, denoted by lowercase “f”, which is the amount of the water that will be send away from the current cell to its neighbors. For each cell, we compute the 4 outflow flux value to its 4 neighbors. The difference between outflow flux and flux: 1. The 4 outflow flux are stored for each cell. Not on cell boundaries. While Flux value doesn’t belong to one cell, it is shared and used by the neighboring cells. 2. Flux can be positive and negative. However outflow flux is always positive. If no water is sent sway from the cell to its neighbor, or the cell is receiving water from its neighbors, the corresponding outflow flux should be set to zero. (2) So what’s the connection between the original Flux and outflow flux Take the cell (i,j) and its left neighbor (i-1,j) for example: “F” is computed by the difference of the f^L of cell (i,j) and f^R of its left neighbor. (3) Now how to update the water height? send away…collect… The inflow of the current cell are the outflow from its neighbors.

14 Erosion on GPU (2) Water Movement (Flow Simulation)
Non-negative water update Outflow flux Cell Inflow flux omitted, strengthened condition Now how to guarantee that the water height won’t be negative after the update? We know the change of the water height is delta_d, the original water height is d, which means d+delta_d >=0 after the update. So for a proper solution, we need to scale both f_in and f_out to satisfy this condition. But following our outflow flux definition, this means we have to adjust the outflow value of the cell’s neighbors, which is not possible. So we use a strengthened condition, we omit the f_in term and requires the sum of the f_out should be less than the original water height. In this case, we only need to use a factor K to limit the outflow flux of the current cell. In this way, it is guaranteed that no water height will be positive after the update. Although this procedure might not physically-correct and bring some numerical errors on the fluid computation, but it works fine in practice. a scaling factor K limiting the outflow flux

15 Erosion on GPU (2) Water Movement (Flow Simulation)
3-step process Update outflow flux Update water height Update (horizontal) velocity field From Flux (f) to Velocity (V) No-Slip Boundaries set outflow flux to 0 for boundary cells Limitation for time step Cell Boundary cell (1) Now the water movement simulation has three steps: 1…2… 3. We need to compute the velocity field from the flux value. The velocity field is necessary for following steps. We take the velocity in the X direction for an example. Vx is defined as the amount of the water that passed through the cell in X direction in unit time. So the amount of the water that passed through the cell in X direction can be computed with Vx. On the other hand, this amount can be computed with the flux values from left and right boundaries. So we can compute Vx with this connection. (2) No-slip boundary: Another convenient thing about outflow flux is that you can easily set boundary cells. For the boundary cell in the image, you just set its left outflow flux to 0. (3) Since it is a explicit method, the time step should be limited with the CFL condition.

16 Erosion on GPU (3) Erosion & Deposition
Sediment transport capacity Current suspended sediment How to compute for each cell ? We adapt a classic model from soil science [Julien’85] Erosion Deposition The erosion & deposition process is most determined by the sediment transport capacity of the flow. The sediment transport capacity is how much sediment the flow in the current cell can carry, denoted by C. We compare this value with the current suspended sediment in the water, denoted by S. If S>C, some suspended sediment will deposit on the ground, otherwise the flow will pick up more soil from the terrain. The key problem is how to compute C? Different from previous methods, we employ a classic model from soil science. In this model, the sediment transport capacity is limited by two factors: the velocity and the local tilt angle. The original model has a lot of parameters, we simplify the formula for our application. Details can be found in the paper (and the hidden slide if necessary).

17 Erosion on GPU (4) Sediment Transportation
Suspended sediment (S) is advected by the velocity field Many GPU-friendly schemes to solve the equation Stable semi-Lagrangian method [Stam’99] Upwind differencing scheme More mass-conservative methods such as BFECC [Kim’05, Selle’07] (advection dominated, no diffusion considered) Suspended sediment then is transported by the velocity field. This process is described with the advection equation. We do not consider the diffusion process. Many GPU-friendly schemes have been proposed to solve the equation, We use the semi-lagrangian method by Stam. But you can also use other advection methods, for exmaple, BFECC (Back and Forth Error Compensation and Correction), which is more mass-conservative. We skip the evaporation step since it is quite straightforward. More info on the paper.

18 Erosion on GPU - Multi-pass Implementation on GPU
General computation framework on GPU [Harris’03, Owens’07] To update a 2D array in parallel: Multi-pass process pack data into textures draw a screen-aligned quad update texture in pixel shader Simulation (1) Water Increment Outflow (2) Flow Simulation Water Height Initialization After discussion about each step, we come to the implementation part. To update one 2D array in parallel, we follow the framework by Harris. First…then…finally…. In one such pass, we can update the array in parallel. Our simulation method is implemented as a multi-pass process. First in a initialization pass, we pack all the necessary data into several textures. The terrain height(b), water height(d) and suspended sediment (s) are packed into the R, G, B channels of one texture. And outflow flux has four components, packed into one texture. And velocity field is stored in another texture. Then we begin the simulation. For each step, we implement it with one or several passes. For the flow simulation step, we need three passes. Finally, we take the updated textures, and use them for visualization. What we need is the updated water height and terrain height. In the vertex shader, we use it as a vertex texture for efficient height field rendering. In the pixel shader, we use the traditional phong lighting. Visualization Velocity (3) Erosion-Deposition VS: Vertex Texture PS: Phong Lighting (4) Sediment transport (5) Evaporation

19 Results Video 512x512 grids for video demos
Platform: Pentium IV 2.4GHz + 2Gb RAM + Nvidia 8800 GTX 512x512 grids for video demos water suspended sediment in the flow deposited sediment We present our experimental results. The test platform is… In the demo, we use color blue to represent… green…red… We show some examples on artificial height fields. The first example is a “PG” shaped mountain scene in the rainfall. Note the erosion, suspended sediment, deposited sediment… Video “PG scene” in the rain

20 Results Deposited sediment in a basin Video
The bottom of the basin is flattened by the deposited sediment In the second example, we show the effect of deposition process. ..Note the flattened bottom of the basin. Video

21 Results River flow in a drained channel Video
Part of the original river bank get eroded Then we see some examples on the irregular terrains. We show an example about river flow in a dry channel. Some water follows the original channel, while some water gets out of the channel and erodes part of the river bank, creating a new way for the flow. Video

22 Results Mountain scene eroded by rainfall Video
In the fourth example, we show a mountain eroded by rainfall and river source respectively. The rainfall creates interesting gullies on the mountain slopes. And water source creates stream beds. Two lakes at the bottom. And deposited sediment. Video

23 Results Final example:
the combination of the rainfall and the river source Finally, we show an example which combines the rainfall and the river source together in a mountain scene. Video

24 Results Performance results for the final example at different grid size 1 cycle = 1 simulation + 1 visualization All the examples shows similar performance results, so we only present the performance for the last example with different grid size. We define one cycle is one simulation process plus one visualization process. First we show how many cycles we can do per second with increasing grid size. For small grid size like 256x256, 512x512, our method can do several hundred of cycles per second, which is very fast and efficient. Interactive frame rates can be achieved for terrain up to 1024x1024 ST,VT, CT scale well with the grid size VT takes most part of the time for large size terrain Improvements? ST – Simulation Time in each cycle VT – Visualization Time in each cycle CT – Cycle Time = ST + VT Interactive frame rates for terrain up to 1024x1024!

25 Results ST, VT, CT at different grid size ST : Simulation Time
VT : Visualization Time CT : Cycle Time = ST + VT 1. ST, VT, CT scales well with grid size ~ linear with # of cells 2. VT takes more time for large size terrain 3. Further Improvements 1. ST, VT, CT scale well with the grid size 2. VT takes most part of the time for large size terrain 3. Improvements? - several simulation + one visualization - different grid for simulation and visualization: use a smaller grid for visualization for large size terrain, details are enhanced with normal maps.

26 Conclusion & Future Work
A novel simulation method for hydraulic erosion Effective – proper model selection and adaptation for each step Produces dynamic erosion process and realistic results Efficient - well designed for complete GPU implementation Interactive frame rates for large size terrain Future work Further improvements on models: Fluid solver - Limitation for time step Erosion Model - Little erosion on flat terrain Extension to non-height-field scene (general 3D objects, structures with caves) More erosion process – thermal weathering, wind erosion… Conclusion and Future work.

27 Thanks! More info on

28 Erosion on GPU - Erosion & Deposition
For each cell sediment transport capacity related to two factors - local tilt angle - velocity Simplified formula: Problem? Little erosion on flat terrain! ( approaches zero) Possible solution Extra slide: Sediment transport capacity model. According to Julien’s model, the sediment transport capacity is related with two factors. The local tilt angle, the bigger this value, the bigger C. The velocity. We use a simplified formula which combines the two factors. But this is a small problem about the formula. Little erosion on very flat terrain. One possible solution - we use a minimum threshold to limit the angle value.

29 Erosion on GPU - Data update
Summary: the data update in five steps (1) Water Increment: water height (2) Water Movement: water height, outflow flux, velocity (3) Erosion – Deposition: terrain height, suspended sediment (4) Sediment Transportation: suspended sediment (5) Evaporation: water height Extra slide: Summary. For each step, what kind of data should we update

30 Results Performance results for the final example at different grid size ST – Simulation Time in each cycle VT – Visualization Time in each cycle CT – Cycle Time = ST + VT Interactive frame rates for terrain up to 1024x1024 ST,VT, CT scale well with the grid size VT takes most part of the time for large size terrain Improvements? Extra slide: Perf details.


Download ppt "Fast Hydraulic Erosion Simulation and Visualization on GPU"

Similar presentations


Ads by Google