Skip to content
Wumpf edited this page Nov 30, 2013 · 23 revisions

Some experiments with realtime water & erosion simulation on heightfield terrains, using OpenGL 4.3.

Technology, How stuff works

Basics

  • C++11 (using mainly Visual Studio 2013
  • OpenGL 4.3

Dependencies

  • trunk version of ezEngine (also taking a minor part into its development) ** Used for File IO, Memory Management, Basic Math, Window creation, Input, ...
  • GLU
  • AntTweakBar

Simulation

  • The most of the sources were already GPU orientated, but almost none of them used the features of modern hardware. I rearranged nearly everything and make very often use of Compute Shader, Indirect Draw and other modern features.
  • Simulation in fixed timesteps - each frame the simulation steps n times, number of steps per second is constant.

Water Simulation

Heightfield water: "Column base Water simulation" Water in column, each column connected to 4 neighbors with "virtual pipes". Outgoing flow in each of the 4 directions is saved per heightfield-pixel.

Idea relatively good explained and why the outgoing-flow thing is so important can be found here. While being not very detailed Theses slides can give a very good overview what this is all about.

Erosion Simulation

(todo: Short explanation, give some references)

Rendering

  • Simple Forward renderer
  • The definite Fog
  • One directional light atm

Terrain Rendering

  • Texture Blending
  • Fresnel is great everywhere!
  • Screenspace Tesselation inspired by this. Solved crack problem with triangle patches instead, no fine displacement map as described in the paper. Uses instancing, only 3 draw calls (one per Patch - full, one transition, two transisions)

Water Rendering

(todo: Short explanation, give some references)

Sky Rendering

Cheap gradient rendered with fullscreen triangle after everything else (todo)

Notes on Code

  • Using some fancy C++11 feature
  • Renderer is based on some gl wrapper classes that are not meant to abstract OpenGL but just to make things easier

Todo/Planned Features

(List not complete, mostly a memory aid to my self)

Rendering

  • Implement visible Waterflow like described here
  • Athmospheric Scattering

Simulation

Misc

  • Moar sliders
  • More OpenGL wrapper stuff

Clone this wiki locally