Water Simulation Incorporating Erosion

Water Simulation in games can be used to create vast oceans or winding rivers that dynamically react to boats, explosions and more, being able to showcase realistic water behaviors unlike any other method. Some examples of games that have included water simulation techniques are Sea of Thieves(2018) and Red Dead Redemption(2018) which are know for having stunning water visuals and interactions. Unfortunately very few games have been able to incorporate water simulation, with most being unable to sacrifice the performance necessary to run the simulation.

One way in which a water simulation could be more applicable is to include more realistic behavior of the real world such as hydraulic erosion. Hydraulic erosion is responsible for nearly all the terrain features present on earth and so it makes sense that terrain generation tools use hydraulic erosion as a basis to create very realistic terrain resembling real mountains and landscapes. By combining a water simulation with an erosion simulation, you create a tool that creates very high fidelity terrain while also creating natural rivers, beaches and oceans that the water can flow through, all in real time. This would be extremely useful in games like Cities Skylines 2 or as a Terrain Generation tool, as the user can interactively erode terrain in real time.

For my 4th Year Honours Project and Dissertation, I researched and investigated different methodology’s and on how to combine these two phenomenon using the GPU, where I implemented and compared the performance/visuals of 5 water simulation techniques and 2 different types of erosion(hydraulic and thermal).

Showcase of the Implementation

The application was built entirely using C++ and a DirectX 11 Framework. The water solvers mentioned previously are all algorithms derived from the shallow water equations (SWE), which are a simplified version of the Navier-Stokes equations where the vertical velocity is removed, and the water can be treated as a height field.

SWE are very applicable to modern games, as the simulation domain can be represented as a single texture and computed on the GPU, then the water can be visualized as a simple height map. In the implementation, the resolution can be changed during runtime, for varying level of details and performance.

The application was built so that water solver’s and erosion parameters could all be changed while the simulation is running, allowing for really dynamic interactions.

Below are some short videos showcasing the major elements present in my application:

Shallow Water Simulation

Water Realistically Interacting with the Terrain

Timelapse of hydraulic erosion in the form of rain on a complex terrain

Example of user controlled erosion where the user can place water, control the strength of hydraulic and thermal, or use evaporation or rain, all in real time

After eroding, the water follows the paths created by erosion in a natural way

Results.

Every step of the simulation was tested using Nvidia Nsight profiling tools to gather accurate performance metric of each step. This allowed solid comparisons to be made between the steps, and evaluate where bottle necks where in the implementation. For the erosion techniques, the visual difference of various erosion parameters and starting terrain were tested, and it was found that the model is able to create realistic and accurate terrain features such as rivers and waterfalls, regardless of initial terrain which other methods could normally struggle with.

Placeholder

A 4k terrain created using Fractal Perlin noise.

Before Erosion.

A 4k terrain created using Fractal Perlin noise.

After Erosion.

A difference map of the terrain, highlighting where the terrain has changed. Red = Increase in height, Blue = Decrease in Height