Diamond Square Algorithm for random heightmap generation


since this is my first post here, wanted to say hi :wink:
I’ve been reading these forums for a while now and finally decide to post something.

Since I’ve played with Terrain recently I decided to try and write some random terrain generators. I was looking in the web for a decent algorithm for the beginning and found this here:

So I thought I should give it a try and I added the algorithm to jMonkey, here are some results:


The splat texture mapping is pretty crappy though :stuck_out_tongue:

Overall the terrain isn’t very useful if you take it as whole, but it might be able to build some decent looking mountains if you use the generator for maybe a part of the terrain grid.

Here is the class, it extends from AbstractHeightMap, so very easy to use.
Just make a size power of 2 and call the load method.

Feel free to use it for what ever you like.


I just found out that JME already implemented this algorithm:


Better stick with that! :slight_smile:
Sorry for the post, but I still learned something :smiley:

1 Like