Welcome to Fractal Forums

Fractal Math, Chaos Theory & Research => Landscape/Terrain Generation => Topic started by: claude on May 25, 2017, 05:52:50 PM




Title: diamond-square midpoint displacement algorithm
Post by: claude on May 25, 2017, 05:52:50 PM
I found this a good introduction to the diamond-square midpoint displacement algorithm for 2D terrain heightmap (or cloud texture) generation:

http://www.gameprogrammer.com/fractal.html

I implemented an extension to 3D.  C99 source code attached.

Here it is rendered in slices, thresholded with edge-detection on the histogram-equalized voxel space, perhaps could be useful for generative cave systems or similar worlds:

roughness factor 0.3
(https://mathr.co.uk/misc/2017-05-25_diamond_square_3d_03.gif)

roughness factor 0.5
(https://mathr.co.uk/misc/2017-05-25_diamond_square_3d_05.gif)

roughness factor 0.7
(https://mathr.co.uk/misc/2017-05-25_diamond_square_3d_07.gif)