Page 1 of 1

Internet articles on Heightmap Generation

Posted: Mon Mar 15, 2010 4:16 pm
by Sanshin77
Hi I've been working on a heightmap project for quite some time now, and I have some trouble with creating algorithms for generating varied terrain and smoothing the heightmap...

I don't wanna bore you with all the details of my algorithms, I'm just wondering if anyone could point me to a website where I can learn about this. I haven't gotten into really advanced math in school yet, I'm 16yo. I want to be able to generate varied terrain for game maps in 3D. Note: I'm not making any 3D games, this is for learning-purposes.

So 2 questions:
1. Can I read about smoothing a heightmap somewhere, any site you've used? My smoothing algorithm creates a too blocky result...
2. Is there a pretty easy to understand article somewhere on generating heightmaps? I need to create a method that generates a complete heightmap with varied terrain, based on a single number, so that it will generate the same heightmap If I store this number for later. I've been able to create some decent peaks with my method, but I haven't been able to "randomize" their placement without using random number generators.

If somebody could point me to websites to read about this, or relevant websites to learn relevant math/calculus/whatever, I would be grateful.

Re: Internet articles on Heightmap Generation

Posted: Mon Mar 15, 2010 4:36 pm
by Falco Girgis
You know, that even though lots of engines have built-in Terrain brushes (like Unity) that generate height maps for you, they all load grayscale bitmaps as heightmaps as well. You could technically make one in paint with black and gray pixels.

As for smoothing algorithms, I haven't really played around with this kind of thing much, so I can't offer any advice.

Re: Internet articles on Heightmap Generation

Posted: Mon Mar 15, 2010 4:51 pm
by avansc
id probablly look into generating a a standard deviation of some sort, and making sure than adjacent points dont exceed that, also probably look at deltas of angles.

im sure if you multiple with some type of inverse of the averages of each of the neighboring points and do that for all points and perhaps do that iterativly you will smooth it out. if you do it enough you'll end up with a flay plane.

you could also tesselate/sub divide the mesh and interpolate the mid points, which would work.

Re: Internet articles on Heightmap Generation

Posted: Mon Mar 15, 2010 6:03 pm
by Sanshin77
GyroVorbis wrote:You know, that even though lots of engines have built-in Terrain brushes (like Unity) that generate height maps for you, they all load grayscale bitmaps as heightmaps as well. You could technically make one in paint with black and gray pixels.
Yeah, and my heightmap isn't really that far from a bitmap, its a 2 dimensional array of signed shorts. If I continued this project and started using it with 3D rendering and in games, I would of course find a way to load bitmaps. Algorithms and the idea of (randomly) computer generated content fascinates me and I want to learn more about this stuff, that's it. I've implemented 2D drawing with SDL, but the main reason why I started this was to try/learn about the generation part.
avansc wrote:id probablly look into generating a a standard deviation of some sort, and making sure than adjacent points dont exceed that, also probably look at deltas of angles.

im sure if you multiple with some type of inverse of the averages of each of the neighboring points and do that for all points and perhaps do that iterativly you will smooth it out. if you do it enough you'll end up with a flay plane.

you could also tesselate/sub divide the mesh and interpolate the mid points, which would work.
Thanks, I'll do some googling on the different methods you mentioned and see what I can find. :) :worship:

Re: Internet articles on Heightmap Generation

Posted: Mon Mar 15, 2010 6:46 pm
by Falco Girgis
Actually, a bitmap is a pretty goddamn simple datatype (that's why the file sizes are so large). With a bit of research (for parsing the header), you could write your own simple bitmap parser without any trouble at all. So then you can populate that 2D array of yours with the bitmap.

Re: Internet articles on Heightmap Generation

Posted: Mon Mar 15, 2010 7:13 pm
by eatcomics
Funny, as the book I've been using, Game Programming with OpenGL, has all this stuff in there :D

its not a bad book, but its very Windows oriented.