Home • Essays • Lost Articles • Loose Ends • Collections • Computing • Projects • Widdershins • Quotations • Links • Us


Fractal Landscapes

Once Upon a Time in the West...

I played around some years back trying to create realistic landscapes using fractal approaches. I did this stuff in MS QuickBasictm. The images here represent about the best that I got to, until finally I got bored with working on the program. I'm not too proud of the code, which has the consistency and appearance of overcooked spaghetti.

What I did was to randomly generate a 2-d topological map -- the method I used is itself a subject for another whole article -- then "tilted" it and drew small filled squares horizontally along "scanning lines" from the far rear to the very front of the map. The corners of each square were defined by points along each horizontal scan line; the top 2 corners from points on the previous line, and the bottom two corners defined on the next line. I twisted the squares by randomly changing the X-distance between the points along each scanning line, and of course the vertical location of the points on each line were also randomly varied around the "reference" topological elevation from the original map. The fill color was a function of the elevation. You can see that I jittered the fill colors to try to make it more realistic and tried to add "sparkles" to the water. I added a shading routine to squares that were going "downhill". I also tried for a "mistiness" gradient from the far horizon to the front of the image. (There are only a total of 16 colors used in this program.) Then I threw in some conifers, sized according to their distance from the front of the image, and limited them to appearing only on the lower topological elevations. There were a number of other tricks and routines that I used to obtain a more realistic sense of scenic perspective, like expanding the x-dimension and reducing the elevation height multiplier progressively as the scan lines got closer to the front. Overall, this was a real "hack" job with no sense of planning, order or elegance.

The images render from the back to the front, across each map scan line sequentially, and take maybe 5 minutes to finish. Each scene comes out a little different, but after awhile they all start looking the same. (Booooring...)

The 2-d, randomly generated "reference" topological map, with the various elevations represented by the 16-color palette, comes out looking something like this:

Topological Reference Map

Here are some screenshots of fully rendered landscapes:


Here is a variation using a different color palette and a little more magnification of the elevation heights:

Yet another variation I call "Icetown".  In this one, I caused the elevation heights to jump suddenly from one to the other, rather than transitioning them gradually.  Sort of like electrons jumping from one shell to the next, with no stops in between.

For kicks, I plotted the points on arcs to make an imaginary planet:


  Back to Recreational Computing... 




First-time visitors -- including you!

Free Web Counter

Free Hit Counter The Foggiest Notion The Foggiest Notion The Foggiest Notion The Foggiest Notion The Foggiest Notion


Luck Favors the Prepared Mind...

Essays • Lost Articles • Loose Ends • Collections • Computing • Projects • Widdershins • Quotations • Links • Us

Site contents Copyright 2004-2008 by Gary Cuba       Email: webmeister at thefoggiestnotion dot com