Random terrain!
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
Try this
http://www.gamasutra.com/features/20000403/turner_01.htm
If you need more info then perhaps a search on google/gamedev/gamasutra/etc.
Good luck
Kevin
http://www.gamasutra.com/features/20000403/turner_01.htm
If you need more info then perhaps a search on google/gamedev/gamasutra/etc.
Good luck
Kevin
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
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.
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.
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!
(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]
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]
Anyone have some working code that I can look at? Something with heightmaps would be interesting.
http://www.shakazed.tk
http://www.shakazed.tk
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement