Results 1 to 4 of 4

Thread: First Experience With Fractal Terrain Generation

  1. #1

    Default First Experience With Fractal Terrain Generation

    Hi,
    I've been a programmer for a couple of years now, and a long time lurker of this website. I decided to combine the two interests and came up with a Fractal based Terrain Generator in C#. I thought I might share my results with you all!

    Click image for larger version. 

Name:	Island Blend and Noise.png 
Views:	170 
Size:	934.8 KB 
ID:	67286

    Click image for larger version. 

Name:	Island.png 
Views:	47 
Size:	912.9 KB 
ID:	67287

    A rough outline of the process used:
    I first generate two Plasma Fractals, using the Diamond-square algorithm. One will be the actual map image, whereas the other will be used as a shader of sorts to add some variance to the colours of the map.

    Click image for larger version. 

Name:	Island.png 
Views:	47 
Size:	46.2 KB 
ID:	67288

    I take one of the images and colour it based upon the RGB value of each pixel. This gives me the basic map, unshaded. This isn't as slow as it sounds when you edit the raw Bytes of the image.

    Click image for larger version. 

Name:	Island.png 
Views:	47 
Size:	65.4 KB 
ID:	67289

    I then go through the image and multiply the RGB value by a coefficient calculated from the corresponding pixel on the shader map, to give some variance to the colour.

    Click image for larger version. 

Name:	Island.png 
Views:	45 
Size:	104.4 KB 
ID:	67290

    Finally, I randomly displace each pixels RGB values by a small amount - Adding 'noise'

    Click image for larger version. 

Name:	Island.png 
Views:	51 
Size:	891.7 KB 
ID:	67291

    Sorry I had to use a different map for each image, the way I programmed it is such that it does all the colouring at once to speed things up. It would be a fair rewrite to get a different image for each stage of the same map!

    And finally, a shot of the program:

    Click image for larger version. 

Name:	Screenshot 2014-09-13 01.15.46.png 
Views:	61 
Size:	954.1 KB 
ID:	67294

    Overall, the generation time is pretty darn quick - around 1 second for a 600x600 pixel map. Times *should* linearly scale, too: ie, a 1200x1200 map will take approx. 2 seconds to complete. I could speed things up (and clean up the code a lot ) in a later rewrite.

    I'm not 100% pleased with the results, overall - there is often unrealistic features, and everything looks a bit fractal-ly. I won't post the .exe file here as most browsers are convinced it's a virus, and I'd rather not have to deal with that. I can however post it's github page, if anyone is interested

    Thanks,
    Tom

  2. #2

    Default

    add erosion

  3. #3

    Default

    Quote Originally Posted by xoxos View Post
    add erosion
    I've started looking into more realistic mapping, and while it looks quite complex, it also looks like a lot of fun The aim of this was just to create pretty looking terrain using a top down approach, it's obviously not really realistic Really starting to get interested in the bottom up style as described here: Blobs in Games: Teleological vs. ontogenetic map generation Anyone have any pointers as to where I could look to get started?

  4. #4
    Administrator waldronate's Avatar
    Join Date
    Mar 2007
    Location
    The High Desert
    Posts
    3,549

    Default

    https://www.google.com/?gws_rd=ssl#q...n%20generation is an excellent starting point. Ultimately, it will depend on your goals (fast generation for in-game world generation, realistic generation, artistic generation, learning new programming techniques, etc.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •