#### Archived

This topic is now archived and is closed to further replies.

# Random terrain!

This topic is 5899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

How dow I generate random terrain. Ive tried different loops to place vertices at random y position but it always ends up kinda.....screwed. Please help!
http://www.shakazed.tk

##### Share on other sites
Try this
http://www.gamasutra.com/features/20000403/turner_01.htm

Good luck
Kevin

##### Share on other sites
Hi

My terrain engine is based on this tutorial, definitely worth a look

##### Share on other sites
at first, before i managed to load heightmaps, i would just make it random. they sucked though, becuase one height point would be a mile higher than the one next to it. so what i did is make a smooth routine, that goes through, and averages all the heights out, so i ended up with small rolling hills

##### Share on other sites
Hi,

Yeah random heights at the Y point can be pretty ugly, but there are many algorithms out there to generate beautiful looking terrain. The tutorial mentioned by finny generates pretty nice looking terrain (rolling hills, lots of variation) and my terrain renderer is based on it too.

There are also many other ways of generating terrain: perlin noise, faulting (is this what its called?), diamond-square algorithm, even some simple plasma. A search on google for any one of those should yield some good tutorials and websites.

##### Share on other sites
I used an algorithm similar to perlin noise to make my terrian. If your graphics card supports bilinear interpolation, you can get the rasterizer to generate the heightmaps for you, alot faster than the CPU can And if it supports per pixel alpha blending, you can even get the graphics card to generate the texture maps too!

##### Share on other sites
Would you mind elaborating anon?

##### Share on other sites
(I was the anon poster above). I'm not sure if this is actually called Perlin noise, but this is what I've done (after trying to immitate tutorials on the web, and failing):

Say, you want a heightmap of 256 by 256 pixels. Start with a small number, say 2 by 2 or maybe 4 by 4 pixels, and just fill the pixels with random data (when I say pixels, they don't have to be, they could be just floating point numbers or single bytes representing height data, but for my project I wanted to use the graphics card to do the interpolation work). Then, using bilinear interpolation for texture filtering (available on most graphics cards), stretch this small heightmap over the entire 256 by 256 pixel heightmap. This gives a very smooth and blurry height map. Now repeat, but use a larger map of random data, such as 8 by 8 pixels, and, when you fill in the random data, use smaller values this time (I half the magnitude each time), and stretch this over the final 256 by 256 map (using a blending operation that adds the pixels, you don't want to completely overwrite your old data). Repeat this process several times, and you'll have a new random height map in the time it takes for your graphics card to blend 6 or 7 polygons.

I may be able to post some screenshots of the results soon... if I can get my webspace working.

[edited by - bazee on July 30, 2002 9:40:32 PM]

##### Share on other sites
Hehe thanks everyone! THe answers are overwhelming

http://www.shakazed.tk

##### Share on other sites
Anyone have some working code that I can look at? Something with heightmaps would be interesting.

http://www.shakazed.tk

1. 1
2. 2
3. 3
4. 4
Rutin
13
5. 5

• 12
• 15
• 9
• 14
• 10
• ### Forum Statistics

• Total Topics
632655
• Total Posts
3007675
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!