A little tech demo by @DetectiveLosos.

Demo workflow overview:

  1. Create some 512x512 rendertextures (two of some textures are needed to switch between them and process data from one to another):
    1. Two for terrain (R - terrain height, G - soil height, B - suspended soil, A - grass cover).
    2. One for terrain normals (RGB - terrain normal).
    3. One for terrain ambient occlusion (R - terrain occlusion, and it's actually 256x256).
    4. One for terrain flow (RGBA - flow left, right, up, down).
    5. Two for water (R - water height, GB - water velocity, A - clouds).
    6. Two for water flow(RGBA - flow left, right, up, down).
  2. Generate terrain height values with couple octaves of Simplex noise and couple octaves of Voronoi noise. Here is a very useful page about noises in general. And here is a page about voronoi noise.
  3. Add water, evaporate water: Water height is growing under the clouds (wich are invisible in this demo). Still water with lower values of velocity (in the middle of lakes) evaporates.
  4. Calculate water flow: Water flow is amout of water needed to be transported from current cell to it's neighbors. Water flow is calculated based on the previous value + (terrain height + water height difference between current cell and left, right, top, bottom neighbor).
  5. Apply water flow: Change water height based on the previously calculated water flow values.
  6. Calculate terrain flow: Terrain flow is a terrain smothing but only in the cell with some eroded soil in them. Terrain flow is calculated based on a terrain height difference between current cell and it's left, right, top, bottom neighbor. It only occures if there is water in the current cell.
  7. Apply terrain flow: Change terrain height and soil amount based on the previously calculated water flow values.
  8. Calculate and apply terrain erosion: If there is water above the current cell, then based on it's velocity and amount turn some of the rock to soil.
  9. Calculate and apply soil pickup, transport and drop: Calculate water carry capacity based on water velocity, water amount and terrain normal in relation to the flow direction. If water carry capacity is higher then suspended soil amount in the current cell, then turn some soil into suspended soil, else turn some suspended soil into regular soil. Change terrain height accordingly.
  10. Recalculate terrain normals and ambient occlusion.
  11. Render terrain and water.
  12. Go to step 3.

The technique used in general is similar to the one described here, but there is quite a difference regarding an approach to erosion, water flow and terrain processing, wich are based on this paper instead. In my opinion that web demo produces far better results than the one I came up with, but oh well, what are you gonna do.

Alongside dynamic water and terrain erosion systems this demo features custom adaptive LOD system for terrain and water rendering. 

Leave a comment

Log in with itch.io to leave a comment.