Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Stephen Schmitt, posted on November 17, 2001

Image Description, by Stephen Schmitt

No, this is not showing off a real-time terrain renderer. The 3D visualizations were done in pov-ray and are purely for illustration. Now that that's out of the way.. :)

My hobby over the past half year has been improving the artificial nature of the terrain you get out of a basic subdivision/perlin noise terrain generation scheme. I've looked into a variety of methods including simple function transforms on the heightfield, multifractals, and several other schemes.

One method that has consistently produced nice results is the simulation of small-scale weather and fluvial erosion. My algorithm is based on the Monte Carlo method: In a nutshell, it drops running water randomly on the terrain, picking up or depositing soil as the stream flows. You can simply run until the desired level of erosion is achieved. With a bit more work, the creation of a river system and large-scale water channels should be possible. The algorithm is not suitable for real-time running, but it works fine as a backend/preprocessing step.

I'd be happy to provide more details if anyone is interested.

-The top 2 images show the same heightfield, in a before/after comparison of the erosion simulation.
-The overhead view shows 2 lightmaps created from another heightfield, again contrasting the results before and after applying erosion.
-The middle-right screenshot shows the basic terrain modification dialog box in my terrain tool.
-The bottom image is another Povray rendering of an eroded terrain.

As an aside, I had thought of trying to submit these techniques to GPG3, but I reconsidered after realizing from the lack of information on erosion methods on the Internet, that I may well be the only person who finds this stuff interesting. :)

I'd love to hear any comments or discussion on what other people do to improve their terrain heighfields.

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

November 17, 2001, 03:42 PM

quite natural looking after erosion, well done.
how about letting it snow again? the top don't have snow after erosion, doesn't look so well ( i want to snowboard from the top of the hill! ;) )

the bottommost looks very real, because of the cam-pos, too ( normally i dont fly like a bird over terrain:) )

well done

Neil Edelman

November 17, 2001, 03:58 PM

Your erosion method definately shows an improvement in the realism of the terrain, IMO. I like it.

Stefan Karlsson

November 17, 2001, 04:10 PM

nice... is it realmode?


November 17, 2001, 04:20 PM

Looks much better indeed.


November 17, 2001, 04:28 PM

looks realistic, beats those damn plasmacloud-landscapes anyday :)

dan ogles

November 17, 2001, 04:35 PM

Hm, I wish you'd reconsider submitting the techniques... I certainly would find them interesting! :)



November 17, 2001, 05:14 PM

I find this interesting, too.
Could you post a link on how to do this? Or maybe some code?

J Persson

November 17, 2001, 05:18 PM

Very nice work!

I was thinking about this techniqe a few weeks ago while driving home from work, I never had the time to implement it though. My idea was to have different kinds of rock (eg granite, sandstone) and also implement wind as a "erroder". I think this would give even more realistic terrain (even less realtime to).



November 17, 2001, 05:33 PM

Hey, that idea sounds exactly like what goes on in _REALITY_.

Warren Marshall

November 17, 2001, 05:36 PM

"No, this is not showing off a real-time terrain renderer."


November 17, 2001, 05:42 PM

Whats the deal with those pock-mark-lookin things in the bottom image on the lower right? Are these places where water was dropped?


November 17, 2001, 06:08 PM

Real nice! it's one of the most realistic terrains I've seen great job!


November 17, 2001, 06:41 PM

Very interesting. I worked on a similar technique a few years ago to res-up satelite elevation data and to attempt to turn painted blobs into mountain ranges. I never spent enough time to get it right, but did something very similar to your approach (random rain drops redepositing "material"). Very cool.


November 17, 2001, 07:23 PM

Yes. It is real-mode and requires a maximum of 540kb of memory.


November 17, 2001, 07:37 PM

This is very cool. I recall reading an article somewhere on the net about this, I believe it was called Hydrology. Very interesting stuff. If you would be so kind as to make an EXE available or maybe just a code snippit of the algo I doubt I would be only one that was grateful.


November 17, 2001, 08:38 PM

I looked into physically-based simulation of erosion a few months ago so I have some links that might prove yourself to the readership.

The latter zip file contains working source code for a program for simulating erosion. From what I remember (it's been a while) it uses Monte Carlo methods to approximate the erosion integrals so it might be similar to what Stephen is doing. The nice thing about this approach is that it is simple to implement. The bad thing is that it requires quite a lot of processing power. As with e.g. path tracing, you have to run the algorithm for quite a long time before getting results that could be termed acceptable--unlike radiosity where you gain a solution which is uniformly improving in quality as the processing time increases (and thus acceptable earlier). I suspect that similar results could be achieved with more empiric approaches. An appropriate filterbank might do the trick but I haven't given this much thought as of yet. Cheers.

zed zeek

November 17, 2001, 08:58 PM

a little bit about something similar in cgp&p section 20.7.4
this looks like fun to play around with, ie watching evolution at 100,000 years a second :)


November 17, 2001, 10:35 PM

Very nice -- it looks very pleasing to the eye as well as natural. Keep up the good work!


November 17, 2001, 11:30 PM

Hi all,

thanks for the comments. Some responses:

I'd love to write a little tutorial/article on my method, I just haven't had the time. If I do, I'll get some sort of notice out.

Different rocks types: Actually, this is already implemented. :) You can optionally specify a 2nd heightfield that gives the normalized soil hardness at that spot. Thus the artist/whoever is making the terrain can play with the amount of erosion at any given spot. (Hardness only effects the ability of water to pickup, not deposit, soil)

Those pock marks: They're actually an annoying artifact from the way povray handles unsmooth heightfields.. Adding more global lights fixes it but slows render, so for these example pics, I just let it be.

Here's the basic algorithm in psuedocode:

for (num of erosion iterations)
choose a point in the heightfield
keep track of suspended soil in this stream
while ( distance_traveled < max_travel )
determine gradient from 3x3 block sample at location
determine direction of max negative slope from gradient
if in a local minima, deposit any carried soil and break
if wandered off the playing field, break
determine step direction along gradient, fixup to grid

determine sediment saturation at this point from slope^2
if above saturation, drop off some of the soil in transit
if below saturation, pick up soil (modified by soil hardness) and carry it with
(optionally) smooth the effected area.
step along the gradient to the next spot and iterate

Some of the details are ignored and glossed over, but as you can see its fairly simple in concept -- finding the right parameter balance is the real battle.

There are several improvements that could be made : for example, the erosion algorithm could do actual sampling of the HF instead of simply quantizing the location to the grid. This would eliminate most of the need for the smoothing filter as well.

I'd post an EXE to play with but the erosion code is buried in my heightfield generator, which is buried in my game project's mapmaker tool. It WOULD be interesting to see run in realtime.

-- Stephen Schmitt


November 17, 2001, 11:37 PM

Very nice, man- and very useful. Congrats and i bet it feels good to have your hard work justified by all these interested people! Savour that feeling mate- it's rare enough these days.


Da Wolf

November 17, 2001, 11:39 PM

Realtime? Wow! what kind of FPS are you getting on this?



November 18, 2001, 12:57 AM

Would it be possible to concanate this algorithm into a simple modification of the perlin noice generation formula? or by simply running a second pass (like jsut once) over the terrain to smooth it out?


November 18, 2001, 01:08 AM

Some interesting links there, thanks.

Actually I've run across John Beale's erosion implementation before, from looking at his source I think we take the same idea and run with it in two slightly different directions. His idea generates very nice riversystems, while mine is more of a general-case eroder. Combining the two would give very nice results I think.


November 18, 2001, 01:16 AM

It's not possible to implement this in the actual noise generation function, because erosion is totally dependant on the context of the current location, which perlin noise in general is competely context free. There are definitely methods that can produce nice results from inside the noise function:

Lots of people use the ideas coined by Ken Musgrave to produce nice results. his homepage has a bit of info on it, and you can often find implementations (Heterofractal,Hybridfractal, etc) floating around on the net.

Of course nothing says you can't use this algorithm with a small iteration number to erode a heightfield. Depending on the source HF, I've found that often it converges pretty quickly to the "final" weathered look. (although lacking alot of the nicer details such as the water rivulets, etc).


November 18, 2001, 02:14 AM

Very nice.

But I would really like to see some rivers. Do you have a website?




November 18, 2001, 04:29 AM

the thing that's interesting here, is that you are "eroding" perlin noise, but the actual terrain is just a plain old perlin 99% of the time, what about algorithmic terrain generation to do something like actual terrain generation, take a plain and give it continental stresses, erosion levels, and water forces, and THEN see what comes out? would something like that be possible?


November 18, 2001, 05:32 AM

The dialog looks very much like Terragen. (Check it out at Your algorithm seems to do a good job with the eroding, but the initial noise routines seem a bit predictable. This is especially noticable in the top-down normal based lighing view. Notice that the majority of the ridges tend to be oriented north-south or east-west. I ran into something similar doing plasma clouds. It is an artifact of the subdivision algorithm. Try perhaps jittering the control points a bit at each iteration - that should disrupt the grid lines...
Also, I seem to recall a special tool you might find interesting that was designed specifically for POV-Ray. It was called GForge, and a later version was called HF-Lab. It was for generating and manipulating heightmaps. I found it to be utilitarian and a steep learning curve(unless you are a geek already), but very funtional. (Check it out here) You can also find other great terrain links at the POV-Ray Heightfiled links page.

Lion V

November 18, 2001, 01:52 PM

Rather nice.
The best landscape generator I`ve seen so far.

What I think would be a good method would be to have "slabs".
What I mean by this, is have say this perlin noise- it can be random, whatever, and blend it with a abs() function or a similar shape.
Then run this simulation.

What this would try to do is have some slabs of granite pushing up, then haveing that eroded with the noise, then have water running down it.

Maybe after my current project I`ll look into it...

See, actual mountain terrain is very locally chopped up, like in the top pic. But also in a greater view it is fairly smooth, like in the second pic.
A feature that would make it b more realistic would be to have drainages- all water on one side goes into a creek, which flows out of the valley, which flows out into the sea or a larger valley.
Thats kinda what i would try with my "Slabs" method.

Good luck !


November 19, 2001, 06:08 AM

Just for your information:

There is a process called erosion which you can apply on images of all sorts. It's part of the image manipulation operators called image morphology. Even if it has the same name it's not related to the geological erosion we discuss here.

So be aware: If you do a net search and find something called image erosion in conjunction with dilation you're at the wrong place.

The main use of this "other kind" of erosion is in the field of digital image analysis. Say you have a scaned typewriter text, and glyphs are connected together by dirt and wrong adjusted contrast you can seperate the images by digital erosion of that image. A powerfull tool for this job, and also damn easy to implement.

For those who wants to know more about this stuff I suggest the following book btw:

  Digital Image Processing
  Rafael C.Gonzales / Richard E. Woods
  Addison Wesley (who else?)
  ISBN 0-201-60078-1

Happy Coding,

  Nils Pipenbrinck


November 19, 2001, 10:31 AM

FINALLY! Somebody who's got some REALISTIC looking terrain! Personally, I'm a bit tired of the fake looking terrain in most games today. I mean, only the hand-crafted stuff or real-world data looks good. This is the first "generated" terrain I've seen that is very realistic looking. This adds tremindously to a simulation, IMO. Thanks and congrats!

This thread contains 30 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.