MOUNTAIN.TXT

Another fractal experiment from Matt McIrvin...

MORE FRACTAL MAYHEM:  MOUNTAINS

Atari 520ST/1040ST/MEGA
Version 2.1 - Color monitor required


     This program creates pictures of fractal mountains.  It is
capable of producing DEGAS-compatible uncompressed picture files. 
This manual is divided into two big sections; Section I explains
a little about what fractals are and what this program is doing,
and Section II explains how to use this program.  If you already
know all about fractal landscapes, you can skip straight to
Section II.  Otherwise, read on.
     If you've read the manual to the first FRACTAL MAYHEM (a
completely different program which displayed the Mandelbrot set
[end of commercial]), you might still want to read the first
section; it doesn't overlap much with the explanation contained
in that document, and it introduces some new concepts,
particularly that of fractal dimension.  It's also mathematically
less involved than the other manual, since we don't have to deal
with complex numbers here.
     (A note to people who've got a pre-2.0 version of MOUNTAINS: 
This version has several new enhancements, including data
smoothing, the ability to put clouds in the sky of your
landscape, terrain files, variable lighting, and some bug fixes
and speed improvements.  Be sure to read about them.  Appendix B
contains a fairly complete revision history.)

I. Fractal landscaping

A. Crinkles

     Fractal landscapes have shown up in several movies, crunched
with elaborate animation on supercomputers.  The most famous such
sequence is the "Genesis device training film" viewed by Captain
Kirk in STAR TREK II:  a science-fictional bomb hits a barren,
cratered planet, covers it with strange flickering flames, and
turns it into a green paradise.  The animation was produced by
Lucasfilm using fractal geometry.
     The variety of geometry taught in high school deals with
highly idealized things:  polygons with straight edges, spheres,
cones, and so forth.  In our largely artificial world, we
encounter such things (or good approximations to them) quite
often.  However, nature does not share our enthusiasm for the
smooth and the hard-edged.  Perhaps the universe evolves
according to simple laws, but the results of those laws often
have the distinguishing characteristic that they are crinkly. 
Furthermore, these crinkles cannot be easily brought under
logical control.  Suppose I want to completely describe the shape
of a mountain, or (following the mathematician Benoit Mandelbrot)
a coastline.  I run all over the landscape with a surveyor's
transit and a tape measure, measuring things.  Finally, I have an
immense number of measurements at the scale measurable by the
equipment, and if they are accurate, I can reconstruct a map of
the landscape.  However, the map is only accurate down to a
certain scale; the representation of the mountain is smoother
than the mountain itself; the coastline meanders on a scale I
haven't measured.
     Suppose I add up the coastline numbers to find the length of
the coastline between two points.  I want to check how close that
is to the actual length of the coastline, so I go back with a
ruler and make finer measurements.  To my surprise, I was way off
the first time:  the small crinkles are sufficiently crinkly to
increase the measurement by a large amount.  So I correct the
value.  But I'm still suspicious of my numbers, so I take a pair
of calipers and spend years mapping the smallest wiggles I can
find.  Finally I add up all of those numbers, and find that the
number I get is once again several times larger than the last
one.  Clearly I can't measure the coastline with any accuracy
unless I specify what scale I'm measuring on.  There's a
fundamental roadblock to measuring the absolute length of the
coastline, one that would get me in the end even if the waves
stopped moving and messing up my measurements.  I might have to
measure the perimeters of individual atoms to get a good number. 
If the crinkles existed at arbitrarily small scales (which they
well might, if matter is infinitely divisible), I could say that
the length of the coastline is infinite.  Using Mandelbrot's
terminology, the coastline is a fractal.
     If I were to attempt to measure the surface area of the
mountain, I would be similarly frustrated:  the mountain is also
a fractal.
     It turns out that fractals are the rule rather than the
exception in nature.  Coastlines and mountains are fractal, and
so are leaves, clouds, and clusters of galaxies, at least over a
certain range of scales.  Just about anything that looks crinkly
over many scales of size is a fractal.  They all have the
distinguishing feature that they look about the same when
magnified.  A small part of a cloud has a similar shape to that
of the whole cloud.
     How CAN we describe these objects?  One way is with the idea
of fractal dimension.

B. Fractal dimension

     My enthusiasm dampened by my unpleasant experience measuring
the coastline, I return there with a set of measuring devices of
different sizes.  I will try to study how the lengths increase
with the precision of my measurements; perhaps there's a pattern
to the growth.
     I take the tape measure and measure the distance along the
coast from point A to point B in units of 10 meters.  I get an
answer of 100 units, or 1 km.
     Now I take a meter stick and measure in units of 1 meter.  I
get 1580 units, or 1.58 km.  The little crinkles in the coast, as
before, have added quite a bit to my number.  If the coastline
were straight, I would have found a length of only 1000 units.
     If I measure in 1-centimeter units, I get 251,000 units, or
2.51 km.
     The numbers mount as my units get smaller, as before.  But
now I make a graph:  I plot length in units versus the size of
the units.  If the coastline were straight, I would get a simple
1/x relationship:  I would measure ten times as many units for a
unit one tenth as big.  Instead, my graph looks more like the
function
                              1
                         -----------
                                1.2
                              x

     where x is the size of the unit.  As the unit gets smaller,
the length gets bigger at a rate faster than 1/x.  (My imaginary
example is close to the equation one often gets for an actual
coastline.)
     Suppose I were to do the same thing with the surface area of
the mountain.  If the land were flat, my numbers would increase
as my unit of square area got smaller with the relation

                              1
                         -----------
                                2
                              x


     where x is the width of my area unit; but since the mountain
is also a fractal, the exponent is larger, around 2.15 instead of
2.
     A curve is an inherently one-dimensional thing, and a
surface is two-dimensional.  The exponents for ordinary curves
and surfaces are also 1 and 2, respectively.  So this exponent is
often called the dimension, and fractal objects are said to have
dimensions that are not whole numbers.  The coastline in my
example has a fractal dimension of 1.2, and the mountain has a
fractal dimension of 2.15.
     This terminology may not seem very natural, but look at what
would happen to a coastline if we could increase the fractal
dimension.  A coastline with dimension 1 is a straight line or a
smooth curve.  Coastlines with larger dimensions are more
crinkly.  A coastline with dimension 1.5 has many complicated
inlets.  Dimensions closer to 2 belong to mazelike coastlines,
which fill a big area with a mixture of land and water.  When the
dimension hits 2, the coastline has become so convoluted that it
entirely fills the available space:  land and water are mixed
homogeneously in a two-dimensional marsh.  So, in a way, the
fractal dimension does measure how far along the shape is to
becoming two-dimensional.
     This program creates mountains with dimensions between 2 and
3.  Real mountains have dimensions between about 2.1 and 2.2.  If
you lower the dimension, the mountain will get smoother (the
program can't actually hit 2, but it can approach it from above),
and if you raise the dimension, the mountain will turn into a
forest of spikes which, near a dimension of 3, nearly fills the
imaginary space in which the mountain lives.
     Here's another neat result.  If we were to flood the region
surrounding a mountain of dimension 2.15, creating a coastline
where the mountain stuck out of the water, and measured the
dimension of that coastline, we would find that the dimension is
1.15 -- the dimension of the mountain minus one.  (With this
program you can actually do the flooding!)
     The method that this program uses is called recursive
midpoint division with successive random additions.

C.  What THAT means

     This program's algorithm is from the book THE SCIENCE OF
FRACTAL IMAGES (see the brief bibliography below).  It produces
crinkles with a random-number generator, first on mountain-size
scales, then at smaller and smaller scales.  You can imagine the
mountain as being represented by a network of squares.
     The program starts out with one big square, the size of a
mountain.  The corners of the square are displaced randomly from
zero, so that it ends up bent and tilted in a random manner.
     Then, the program divides the square by defining the center
as another point.  All the points get displaced again by another
random amount, with a slightly smaller scale.  The resulting
surface gets divided further into four squares and displaced
again.  The program proceeds in this manner, dividing up the
array on a smaller and smaller scale and adding smaller and
smaller displacements until the squares get as small as the
resolution of the array in the computer's memory.  The result is
something that looks like a mountain.  All that is left is to
display it on the screen, which is another story; suffice it to
say that the brightness of a point is determined by the extent to
which that part of the mountain tilts from the imaginary sun
direction.
     The generation is a little more complicated than that.  For
best results, the random numbers should have a Gaussian bell-
curve distribution, which takes some trickery.  The way the scale
of the random numbers varies depends on the fractal dimension.
     This algorithm improves on some earlier ones in that it adds
random numbers to every currently defined corner point at every
step, not just the newly defined ones.  This reduces the
unsightly "creases" produced by earlier algorithms, as explained
by Dietmar Saupe in THE SCIENCE OF FRACTAL IMAGES.
     The results are very pretty.

II.  Using MOUNTAINS

A.  In general

     This archive should contain the following files:

     MOUNTAIN.TXT     This file
     MOUNTAIN.PRG     The program
     MOUNTAIN.RSC     The program's resource file
     MOUNTAIN.PI1     An example picture
     PLAYBACK.PRG     A simple animation utility

     Put them (with the possible exception of this file) in the
same directory or on the same disk.  Go into low resolution
(it'll run in medium, but there's no point), and execute
MOUNTAIN.PRG to start up MOUNTAINS.  You should get a
typical-looking GEM screen with six menus in the menu bar.
     Creating a picture with MOUNTAINS is basically a three-step
process.  You generate data, perform operations on that data, and
display it onscreen.  The Make, Mod, and Show menus control those
three steps, respectively.  The Palette menu controls the color
palette used to display the mountains, and the File menu lets you
create and load in DEGAS uncompressed picture files.  The menu
with good old "Bob"'s face peeking over it lets you display a
title box and access your desk accessories.  (Puzzlin'.)
     For a preview of what your results can look like, select
Picture Load on the File menu.  You'll get the classic File
Selector box.  Pick MOUNTAIN.PI1.  After the disk stops spinning,
select Look on the Show menu.  Wow!  The picture you see was
generated ex nihilo by this program.  (Hit any key or click the
left mouse button to get back to the menus.)
     Now that you're anxious to generate your own, let's try. 
Select Make on the Make menu.  Now the program is producing a
mountain array.  It puts up not just a bee, but a whole HIVE to
inform you of this (what a bargain!)  This step takes about three
minutes.  If you've used my Mandelbrot set program, you will
realize how mercifully fast this is.
     When the beehive disappears, you have a mountain in memory. 
Let's look at it.  Select Quick on the Show menu.  If there's
something above water, it will appear as a fairly crudely
rendered mountain.  Since I didn't tell you to select Randomize
or Random Seed on the Make menu, and since you haven't modified
it with the Mod options, I know what your mountain looks like: 
not much is above sea level.  You can change that by lowering the
sea level.  Left-click or hit a key, then select Water on the
Show menu.  Click on the minus sign, type 6000 in the text field,
and click on OK.  Then select Quick again.  More of the mountain
will be above water.
     Left-click or hit a key.  Now select Fancy on the Show menu. 
The mountain will appear fully shaded and colored on the screen. 
     If you were to select Make again, you would get the same
mountain.  You can change the mountain in a predictable manner by
entering a new number in the Random Seed box, or have the
computer pick one for you by clicking on Randomize.  If you find
a landscape you like, you can write down the number in the Random
Seed box and regenerate the array later by entering that number
for the seed.
     Use the Mod (short for Modify) menu to do interesting things
to the mountain data between Making and Showing.
     Once you have a picture you like, you can save it with the
Save option on the File menu.
     The options are described in detail below.

B. The menus

i. "Bob"

     I just had to be original somewhere.  Only Atari would put
Mr. Dobbs in its character set.  Selecting Mountains brings up
the title box, including version number.  Your desk accessories
should also appear on this menu.

ii. File

Load Picture

     This option loads in a DEGAS-format uncompressed picture. 
It has to be uncompressed and in the proper resolution.  You get
a file selector dialog which works in the normal manner.
     The color palette used to display the picture changes to the
picture's, so it may no longer match with the palette check-
marked in the Palette menu (see below).

Save Picture

     This option saves the current picture as a DEGAS
uncompressed picture file.  You get a file selector dialog which
works in the normal manner.  The picture can be loaded back in
later with Picture Load, or it can be imported into DEGAS and
played with there.  You can therefore incorporate pictures
generated with Mountains into DEGAS artwork.

Load Terrain

     This loads in the terrain data from a .TER file created with
Save Terrain.  Pick the file you want with the file selector.

Save Terrain

     You can save the terrain array with this option in a file
with the suffix .TER.  The file selector works as usual.  The
terrain file is large (about 130k), so this option is a bit
impractical if you're working from floppies.  I find it useful
with a RAMdisk installed:  after generating a terrain array I can
save it on the RAMdisk, play around with it, and then bring it
back in seconds if I mess it up badly.

Quit

     As continuing proof of my herd morality, I have once again
followed the nonsensical standard and put this option under File. 
You get my name and address before quitting.

iii.  Make

Make

     This is how you start generation going.  Generation takes
about three minutes.

Randomize

     Make uses a random number generator which determines the
shape of the resulting mountain.  It seeds the generator with a
value at the beginning of the run.  This option puts a number
from the system clock in the Random Seed window and has Make seed
its random number generator with that value.

Random Seed

     Random Seed lets you enter your own seed for the generator. 
Make will behave in a fixed manner for a given Random Seed value.

Dimension

     This puts up a dialog which lets you change the fractal
dimension of the surface, which is always between 2 and 3.  This
number is approximate:  entering 2.0 actually yields a dimension
slightly above 2.

Pin Front Edge, Pin Back Edge

     The landscape is abruptly cut off by the four edges of the
array, and the front edge can reveal large, sometimes unsightly
cross sections.  Turning on Pin Front Edge forces Make to set the
front edge of the landscape at zero to eliminate this effect. 
Pin Back Edge does the same thing to the rear of the array, which
can be useful to avoid the appearance of unnaturally gigantic
mountains on the horizon in conjunction with Zone Tilt.  However,
neither is quite statistically legitimate, and they can cause
strange cliff-like effects and pointy grass at the relevant edges
(in version 2.1, this effect is less pronounced due to a bug
removal).  They work best if you raise the water level a little
to cover this.

iv.  Mod

Invert

     This option turns the whole array upside down:  undersea
valleys become mountains and vice versa.  If your whole landscape
is far underwater, this might be a good idea.  It takes a few
seconds to complete.

Absolute Value

     This inverts only the negative parts of the array.  This can
produce really nice valleys, which (if you raise the water level
a little above zero) become nice rivers.  It takes a few seconds.

Grow, Shrink

     Grow and Shrink rescale the data vertically:  you can
magnify or compress the mountain by an integer factor or divisor. 
This has been implemented along with Real Rescale because it is
much faster, taking only a little longer than Invert.  Grow is
the slower of the two, because the routine has to check for
possible integer overflow.

Real Rescale

     This lets you enter an arbitrary real number (nonnegative
and less than 10) by which all the altitude values are
multiplied.  It's slower than Grow and Shrink, but if you want to
stretch the data by, say, a factor of 1.639, it's easier to deal
with.

Power Law

     This option gives you a window with four buttons indicating
possible operations:  Square, Square Root, Cube, and Cube Root. 
These functions all work on real numbers, with the maximum
possible height scaled to 1.  Therefore, they can be rather slow. 
In particular, Square Root takes about three minutes, and Cube
Root takes more like five minutes.  (Mandelbrot set fans will
laugh at the puny amount of waiting necessary.)

     Square squares every height in the array.  The maximum is
scaled to 1, so the mountains will probably get smaller after you
do this; use Grow to get them back to a reasonable height.  This
makes peaks pointier and valleys gentler, and it also turns
negative heights into positive ones.  If you then raise the water
level to flood the area near zero, you can get islands with
gently sloping beaches.

     Cube cubes every height in the array.  The effect is the
same as Square, only more extreme, and negative holes are not
inverted.  The landscape will look quite unearthly after you've
Grown it back to visibility.  Try displaying it with a weird
color palette.

     Square Root and Cube Root have similar effects; Square Root
actually finds the negative of the square root of the absolute
value of negative numbers, so the two treat negative numbers
similarly.  They both turn ordinary landscapes into rock
formations straight out of Monument Valley, Arizona (thanks to
Edward Prados for that comparison) or your favorite cowboy movie. 
Try lowering the water level to a very negative value.

Smooth

     Sometimes the fractal roughness of the data is a little
excessive for what you want to do with it.  If so, you can use
this feature to smooth the data out by averaging altitude values
with their neighbors.  This is particularly useful for removing
the needle-like peaks that can mar an otherwise natural-looking
landscape.  It also turns noisy areas into more solid blocks of
color, which can be good or bad depending on your intentions.

Flip Back/Front, Flip Left/Right

     These options mirror-reverse the landscape.  Doing both
rotates the landscape through 180 degrees.

v.  Show

Quick

     This puts up a relatively fast and crude wireframe rendering
of your mountain.  It's useful when you're manipulating the data
with the Mod options or deciding where to put the water level.
     When the rendering is done, you can return to the menu bar
by left-clicking or hitting a key.  You can interrupt the
rendering by pressing Esc.

Fancy

     This displays the mountain with the works:  hidden-surface
removal, solid shading, and altitude zones (you can put in a
treeline and snow caps; see Zone Alt below).
     When the rendering is done, you can return to the menu bar
by left-clicking or hitting a key.  You can interrupt the
rendering by pressing Esc.
     Fancy rendering is slowed down a little by the combined use
of Zone Tilt and Zone Wander (see below).  Otherwise it should
take about two minutes to finish rendering.

Fancy Bkgd

     This is exactly the same as Fancy rendering, except that it
doesn't clear the screen before it begins, so that you can
customize the background of your picture.  In particular, you can
display a cloud backdrop with the Cloud option, then display a
landscape in front with this feature.  See the description of the
Cloud option for more details.

Map

     You can see an overhead map of the current terrain by
selecting this option.  Instead of the shading otherwise used,
this colors by altitude, scaling brightness values between the
edges of the altitude zones.  Zone Wander has no effect on the
map.

Wide Map

     This is just like Map, except that the picture has been
stretched to fill the whole screen.  

Cloud

     Cloud allows you to generate clouds that you can put in the
sky above a landscape.  This is different from the Cloud option
on the Palette menu of version 1.2, which has been renamed Map
Cloud.
     In order to use this option, you should first have a
landscape generated in memory.  (You might want to raise the
dimension before generating.  Fractal dimensions around 2.5 seem
to work well.)  Pick one of the two "...Cloudy" options from the
Palette menu; these are the same as the palettes listed above
them, but modified so they work better with clouds included.
     Now you can start rendering a cloud.  Select Cloud, and the
cloud will start to appear on the screen.  What this really is is
a modified version of the Wide Map mode which uses only the
light-blue-to-white colors in the top of the palette.  Therefore,
the water level controls the extent of cloud cover.  When the
screen is full of clouds, click on the left mouse button or press
a key to get out (you can also stop the rendering with Esc).
     When the cloud is done, you can generate a landscape
normally and use the Fancy Bkgd option to render it without
erasing the cloudy background.  You might want to save the
screenful of clouds first, so that you can experiment with the
landscape until you get the effect you want, then reload the
clouds, then re-render the landscape in front for the finished
picture.

Look

     Look shows you the current picture.  You can return to the
menu bar by left-clicking or hitting a key.

Zone Alt

     Points on the landscape in a Fancy rendering can be colored
according to their altitude, with up to three different colors
(this is in addition to shading).  The three zones can represent
trees, bare rock, and snow, for instance.  The two numbers in
this dialog box are the altitudes at which the bottom and middle
zones end; anything above the higher value is in the top zone. 
These altitudes are given in units of the array numbers; they are
measured up from the water level.

Zone Wander

     The zones look a little artificial set at a constant level,
especially if they represent snow and trees.  This option makes
them wander randomly from the set values for greater realism.

Zone Tilt

     Zone Tilt was inspired by a comment from Brian Kaiser, a
neighbor of Alan Farmer's (see acknowledgements) who looked at a
picture created by Alan's fractal mountain generator and insisted
that some faraway mountains were being colored with low altitude
zones where they should have been covered with snow.  It
certainly did look that way, and the reason was that Alan's
program, like mine, did no perspective projecting:  mountains on
the horizon were rendered as large as nearby ones.  You can get
away with this.  After all, the landscape is fractal, and there
is no preferred scale for an object.  However, things on the
horizon will appear bigger to our brains, which are used to
perspective, than nearby things if they are rendered at the same
size; perhaps you have seen popular optical illusions based on
this fact.  Zone Tilt seeks to exploit this effect rather than
conflicting with it.  It tilts the altitude zones toward the
horizon in the rear, so that a mountain doesn't have to be as
tall to get covered with snow if it's far away.  This option
slows down rendering, and you may have to increase the altitude-
zone heights to get it to work well.  However, it can create a
convincing imitation of a picture generated with true
perspective.

Water

     Selecting this option puts up a dialog box with a number
field you can edit and two buttons marked + and -.  The buttons
control the sign of the water level altitude, and the number
controls the absolute value.  The water level starts out at zero,
and you can raise or lower it, with maximum and minimum at +32767
and -32767.  Putting in numbers beyond that range will cause them
to be clipped to that range.  Rendering the data will cause it to
be displayed with the new water level.
     Making the water level higher doesn't really raise the
apparent water level on the screen; it lowers the mountains.  It
also changes the levels at which altitude zones appear relative
to the mountains, because those numbers are measured relative to
the water level.

Horizon

     The Horizon option brings up a dialog box containing the
horizon height.  This is measured in scan lines from the bottom
of the screen; 0 is at the bottom and 199 is at the top. 
Changing this number changes the apparent height of the
observer's vantage point the next time you render the data.  A
high horizon makes the picture look like an aerial photo, and a
low horizon make it look more like a picture taken from the
ground.  This number affects both Quick and Fancy rendering, so
you can experiment with it easily before making it final with a
Fancy rendering.

Sun

     This changes the lighting direction.  The new position will
take effect the next time you render the data.  The default
setting puts the sun off to the left, so that the left sides of
hills and bumps are illuminated.  When you select the Sun option,
a dialog box appears which displays eight possible sun positions. 
Select the one you want; you can put the sun to the left, to the
right, in front, in back, or at four diagonal positions.
     
vi.  Palette

     The palette options give you the ability to select from
several color sets to use when displaying the mountain.  The one
currently selected is marked with a check.  If you've just loaded
a picture off disk, the palette may not actually be the one
checked in this window; the next time you select a palette,
things will return to normal.
     My personal favorite is Alps.  Map Cloud is a special case: 
if you display a landscape in Map or Wide Map mode, then look at
it with the Map Cloud palette, it should look more like a cloud
than a landscape.  These clouds are more luxuriously shaded than
the clouds produced by the Cloud option, but they can't be
combined with landscapes.
     The special Cloudy palettes listed under Rockies and Alps
are for use with the Cloud option.  They are the same as Rockies
and Alps, except for the snow, which shades to blue rather than
dark gray; this is so that some of the same colors can be used
for cloud shading.

Flip

     This reverses the dark and light colors in the palette.  It
can create the effect of a repositioned light source.  It also
messes up clouds and makes front-edge cross sections look weird,
and the uppermost "snow" zone isn't shaded exactly the same way
it would be if you actually reversed the light source.
     The Sun option, followed by a re-rendering, is really a
better way to change the light source position, but Flip can give
you a quick and dirty preview without re-rendering in certain
situations.

C.  Suggestions

     Here are some things you can try to get neat-looking
landscapes:

     - The data fresh out of Make is often a bit too pointy. 
Shrinking by a factor of 2 can increase realism.

     - The default dimension of 2.15 is pretty good for
landscapes, but dimensions around 2.4 or 2.5 work better for
clouds.

     - If the data you generate is all under water, try Invert.

     - Absolute Value often gives a landscape a remarkable extra
dose of realism.  This is because it creates valleys with a
triangular profile, similar to what you will often see in a
mountainous region eroded by water.  Flooding the valleys creates
credible rivers.

     - To flatten out the beaches, use Square.  This will also
invert the undersea areas, so you may have to raise the water
level.  Use the Island palette with a water level a few hundred
units above zero and a small first color zone (for the beaches). 
You'll get some South Pacific-looking islands.

     - Use Cube and lower the water level to below zero for a
really strange effect.  Remember, you may have to scale up the
landscape with Grow after using Square or Cube.

     - As I said before, Square Root and Cube Root can create
remarkable rock formations such as those found in the American
West.  Try Square Rooting a landscape, Shrinking by a factor of
2, then lowering the water level and displaying with the Desert
palette.

     - Changing the palette can have a drastic effect on the
appearance of a picture.  Often, certain combinations of altitude
zones work best with certain palettes (see my comments about the
Island palette above).  Changing the altitude zones with the Mars
palette varies the local climate, as the lowest altitude zone
contains a bit of frost in the shadows, in accordance with Viking
photographs.

     - Try turning on Zone Tilt, raising the horizon to about 150
or 160, and Fancy rendering a landscape.  That's how the
demonstration picture, MOUNTAIN.PI1, was generated.

     - Using Smooth several times in succession can produce a
blotchy, Cezanne-ish effect, due to the limited color resolution
of the ST.

Appendix A. Using PLAYBACK.PRG

     If you have a lot of disk space to waste, you can experiment
with animation using PLAYBACK.PRG.  It's a very simple utility
which loads a series of pictures from disk into RAM, then flashes
them on the screen in succession.  It will work with any low- or
medium- rez DEGAS uncompressed pictures, so it has uses outside
the Mountains world, but I wrote it for use with Mountains.
     To produce an animation sequence, you must generate some
pictures which vary slightly from one to the next.  These will be
the frames of the movie; you can have up to 26 frames, which is
sufficient for a pretty nice-looking animation lasting a couple
of seconds.  Try gradually flooding a landscape, or rescaling the
mountains, or varying the fractal dimension.  Save the pictures
to the same directory.  They should all have the same name except
for the eighth character in the filename, which should be A for
the first file, B for the next, and so on through the alphabet. 
Each picture takes up 32k, and you need to be able to fit all of
them on the same disk and (when you run PLAYBACK) in RAM. 
PLAYBACK is therefore most effective on a machine with a lot of
memory and a double-sided or hard drive, but it will run on a 520
as well.
     Run PLAYBACK in the same resolution as the pictures.  You
will see a File Selector dialog.  Get into the directory or disk
containing the files, and select any one of them; PLAYBACK will
start with A, no matter what.  PLAYBACK will load files until it
runs out of either files or memory.  Then, the show will start. 
The pictures flip past, creating the illusion of motion (one
would hope).  The cycle repeats when it ends.
     You can do a few things while the movie is running.  The up
arrow speeds up the display, and the down arrow slows it down. 
The D key changes the direction of the movie, cycling from
forward to backward to a back-and-forth mode.  Space pauses the
movie; press any key to resume.  Esc and Undo exit the program.
     (To animation fans who own the CAD-3D/Cybermate package from
ANTIC:  Mountains pictures also make great backgrounds for your
CAD-3D movies!)

Appendix B. History, and coming attractions

     This program was born in April 1989.  Version 1.0 was
packaged separately from PLAYBACK.  All subsequent archives
include PLAYBACK, with pause and direction control added.  A bug
in the original PLAYBACK which crashed the machine if you tried
to load void was removed with 1.1.
     Mountains 1.1 proper also had some changes from 1.0:  the
Map and Wide Map viewing modes, some new color palettes (Mars,
Io, and Cloud [later Map Cloud]), and a bug fix (you no longer
have to click on the Zone Alt text fields to get a cursor).
     Version 1.2, released several days after 1.1 in late April,
added bug fixes for Map and Wide Map (the altitude zones now
appear where you tell them to appear in the Map modes).  Normal
Fancy rendering became slightly faster.  Pin Back Edge, the Flip
Front/Back and Left/Right options, the Zone Tilt perspective-
faking option, a movable horizon, and the Palette menu's Flip
option were new to version 1.2.
     Version 2.0, released in late May, is a major revision which
improves the speed of Fancy rendering with Zone Tilt (but not
Zone Wander) activated.  A sometimes unsightly bug in Pin Front
Edge and Pin Back Edge is gone, and Zone Wander works more
sensibly.  Cloud production can still be done with Wide Map and
the Map Cloud color set, but the new Cloud feature allows you to
produce clouds that can be put in the background with the new
Fancy Bkgd option.  Color sets to accomodate the combination have
been added.  The lighting direction can now be set to one of
eight positions.  2.0 supports the filtering of terrain data with
the Smooth option; terrain can also be saved and loaded in .TER
files.
     2.1, released September 1989, improves the user interface
slightly; pressing Cancel on a dialog causes the dialog to revert
to its earlier state.  I've added space for buttons for
reflective water in the Water dialog, but they're not implemented
yet.  This advance may come in months to follow, depending on how
busy I am... I'm working on my bachelor's thesis.
Appendix C.  Acknowledgements and bibliography

     Thanks to:

     Edward Prados, for harassing me into writing this program.
     Alan Farmer, for once again providing heated competition in
the early stages of the game.  He had Absolute Value and altitude
zones implemented before I did.  (He's revamped his MS-DOS
fractal-mountain program completely, as of September 1989; look
for it someday.)
     Brian Kaiser, for inspiring the Zone Tilt option with a
well-timed complaint.
     Phil Wherry.  Not only did he urge me to put in Pin Front
Edge and Cloud, he actually ported my code into Microsoft C on
his Northgate 80286 machine, where it runs incredibly quickly. 
He hasn't got the rendering quite working yet, but when he does,
it should be spectacular; he has VGA graphics.  His product may
yet see the light of day.
     Ron Hunt, for providing free advertising on a local bulletin
board after Version 1.0 was posted.
     John Trindle, aka the Bluesman, for running the
aforementioned BBS (the Blues Exchange in Williamsburg, VA,
(804)220-0533).
     Everybody else who stared at the screen and gave me
suggestions, solicited and unsolicited, and everybody in
Williamsburg and around D.C. and elsewhere who has downloaded
earlier versions and spread 'em around.  Keep it up.

     Invaluable advice (and the generation algorithm) came from
the following indispensable book, a must for anyone planning to
seriously mess around with fractal graphics:

Peitgen, Heinz-Otto, and Saupe, Dietmar, eds.  THE SCIENCE OF
     FRACTAL IMAGES.  New York:  Springer-Verlag, 1988.