Erosion and Hydrology

One thing missing from a lot of landscapes is rivers. The fractal construction algorithms don't take water flow into consideration, and there really isn't any good way known to make them consider it. To get realistic rivers, you have two choices: calculate the erosion and water flow patterns after the terrain has been built, or build the terrain around the rivers.

Calculating the rivers first

Under construction

Since rivers are expensive to derive from altitudes, calculate where your rivers should be first. There's at least one article in a past SIGGRAPH on this technique.

Disadvantages: The example in the paper only looked at a single watershed/valley; no good hints were given on how to link them together into a coherent terrain.

Calculating the rivers afterwards

This really falls into two basic areas: calculating water flow patterns and erosion, and calculating the resulting watersheds (rivers, lakes, etc.)

Calculating Erosion

Erosion is typically calculated for each cell in a heightfield. Water is dropped on a cell at some rate, flows in directions defined by the gradient (or slope) of a cell, and either removes or deposits material depending on speed and volume of flow.

As far as I know, there aren't any analytic solutions of the resulting erosion integral, so you need to simulate it. John Beale has written code to erode heightfields, in conjunction with his HF-Lab program. To quote from an e-mail message on the subject:

I don't advertise it because it's dismally hard to use and doesn't necessarily work properly, but I do have code that does erosion of heightfields (fluvial,ie. hydraulic erosion) and you don't need a workstation to run it, even. Just lots of time.

I generated an animation using [that code], on my homepage. The C source code is er1u.tar.gz... DOS .exe in er1u.zip. You want to start with a ".mat" Matlab format heightfield (matrix) created from HF-Lab or Gforge; the erode program carves away on this for as much time as you have patience for; then you convert the .mat format back to something useful using HF-Lab and have a look at it. Just don't expect any visible results short of, say, a day or two...

There seem to be some similarities between erosion calculations and advection equations, which implies that you could calculate erosion using the same types of programs that weather forecasters use. I haven't seen anyone take that approach, though, so I don't know how effective that may be.

Calculating watersheds

Under construction

: > What I would like to do is have rivers FLOW, not just exist like in
: > Civilization.  Water levels could vary from season to season -- rivers
: > would dry up at times and flood the player's cities at other times.
: > Snow would accumulate during the winter and melt in the spring.
: > Erosion (accelerated by farming?) could be interesting too.  The
: > player could build dams, which would create lakes.  Earthquakes or
: > player-built structures might alter the flow of a river.

I don't know if this is a viable option for you or not, but there is a
program called GRASS which is in the public domain.  The Army Corp of
Engineers wrote it.  GRASS will take various maps and handle altitudes,
etc.  It is possible to hook it with another program called HEC-5 which
does river flows, including sediments, reservoirs (also lakes), variations
by seasons, etc.  I know that they have PC versions of the stuff, but I
personally have only seen the workstation stuff.  I was working on a larger
water modeling project, but the stuff could be adapted.  What's best is
that all the routines already exist (some of it is in Fortan though I
think), and is the public domain, so all you have to do is adopt the
sections you want.

Some hydrology links

Hydrology Webhttp://terrassa.pnl.gov:2080/EESC/resourcelist/hydrology.html
RiverTools home page


Up to the terrain synthesis page

© 1996, 2011 cburke@mitre.org