Classic Computer Magazine Archive COMPUTE! ISSUE 125 / JANUARY 1991 / PAGE A20

Mountains. (Amiga Resource) (evaluation)
by L.C. Haselman

One of the most fascinating things computers do is mimic reality. When workstation computers with powerful graphics became available, programmers took a break from simulating traffic lights and began to model the visual world. Mountains brings fractal landscapes to the most graphically powerful home computer--your Amiga.

Mountains is a complex program with many features, but it's easy to get started building landscapes with the program. Just run the program from the Workbench by double-clicking on the Mountains icon in the Mountains drawer or by typing RUN MOUNTAINS from the CLI. When the Mountains screen appears, select the first item in the first menu (Demo). Mountains will generate a random landscape (you'll see an overhead view) and then render that landscape in three dimensions.

The demo landscape isn't perfect; it fills only part of the screen. But it does show you the program's potential.

Impressed? The program can do much more. Mountains lets you draw your own landscapes with special tools. You can view your landscape from any direction. And if you'd like, you can save your scene as an IFF image.

Getting to Know Mountains

When you selected Demo, you saw a 100 X 100 rectangle in the upper left corner of the screen. This is the map area used in creating mountains. This map area is an overhead view with color-coded altitude information.

The first menu, Control, has six items: Demo, Interrupt, Save Image, Map Data, Clear All, and Undo.

Demo creates a sample landscape, and Interrupt halts Mountains while it's rendering a scene. You can save your scene to disk with Save Image; just type the full pathname (such as dh 1:images/TwinPeaks) and then click on Store. The Map Data option lets you load or save the point-by-point data of your scene so that you can later render your scene from a different angle. Type in the full pathname of the file you wish to save or load.

Clear All clears the screen and the map data, and Undo lets you correct mistakes or change your mind. (You can even Undo a Clear All if you'd like.) Undo won't be available unless you have enough free memory. If you find that you can't perform an Undo, you may wish to flip back to the Workbench screen (with Left Amiga-M) and close any memory-intensive programs you may be running. Finally, Quit exits Mountains.

Options Galore

The next menu, Options, also has six items: Create, Magnify, Lake, Base, Top, and ReScale.

Create lets you place your own peaks on the map. Selecting Create pops the map up onto the screen. The pointer changes into a small rectangle, and a gadget appears to the right of the map. This is the altitude gadget, which determines the height of the mountains that will be created. Adjust the altitude gadget to about half its maximum value. Draw a rectangle anywhere on the map by holding down the mouse button and dragging the pointer. Release the mouse button, and a mountain will be drawn.

Magnify lets you zoom in on part of your map. For instance, suppose that you've drawn a whole range of mountains but you decide that you'd like to just use one of them. Magnify lets you strip out the surrounding area. When you select Magnify, the map pops, and the mouse pointer turns into a small rectangle. Click on the upper left corner of the desired area and drag it to the lower right quadrant. The map will be redrawn when you release the left mouse button.

Lake lets you set sea level to any height you wish. When you select this item, the mouse pointer will turn into a crosshairs pointer. Click on the map at the point where you'd like sea level to be. All connected points at that level or lower will be rendered as water.

Base lets you set a low point for the land. It works much the same as Lake, except that it affects the entire map, not just adjacent areas. Use Base to create flat valleys or plains.

Top levels off the peaks of mountains. When you select this item, the mouse pointer will turn into a crosshairs pointer. Click on the map, and all points above the altitude you clicked on will be reduced to the level you've chosen. Use Top to create mesas.

ReScale lets you change the data in the map so that it ranges from minimum to maximum elevations (0 and 10,000 units, respectively). If you've used Zoom, Base, Top, or Create, you should try ReScale. The colors in the 3-D image are assigned according to the elevation. If you try ReScale and don't like the effect, select Undo to return to the previous map.

Flexible Viewpoints

The next menu, Display, has eight items, which control the screen display: Clear, Color, Scale, Frame, Mesh, Sky, Map, and 3D Plot.

Color lets you choose the color palette for your scene. There are three choices: Map makes the map easier to view, Day sets daytime coloration, and Night sets nighttime coloration. You can toggle Scale on and off. When Scale is on, the colors will be assigned so that the maximum elevation will have the maximum color. This does not effect the map data. If Scale is off, colors will be assigned according to the map elevations with 0 being the minimum and 10,000 the maximum. Note that it's possible for elevations to be greater than 10,000--unless the map has been ReScaled.

Frame can also be toggled on and off. When it's on, only the outlines of the polygons that make up the rendered scene will be drawn. When it's off, a filled polygon will be drawn. Use Frame for an interesting effect. Note that Frame works best when the polygons making up the scene are relatively large. Mesh is similar to frame, except that the polygon is drawn in the appropriate color and outlined in black. If you're using a high-resolution grid (that is, your polygons are small), most of the rendered image will be black.

Map brings up the overhead altitude map. This map will probably overlap your rendered image. Selecting 3D Plot or Clear will erase the map. Selecting Sky adds a simple blue swatch of color behind the scene.

3D Plot lets you render your scene. There are three types of 3D Plot. The first is lines, which gives you a quick preview of the coloration, rotation, and placement of your scene. Quads and Triangles use four- and three-sided polygons to render your scene. Quads is faster than Triangles, but Triangles sometimes produces a more detailed image.

Taking Control

The final menu is Parameters. Parameters contains four items: Rotation, Magnification, Scales, and Size-Light. Before trying these items, be sure you're comfortable with the other features of the program. Parameters gives Mountains its power. But it will take some experimenting to use that power wisely.

Using Rotation, you can control the angle and position from which you view the scene. When you select Rotation, a requester opens with four numeric gadgets: X-Angle, Z-Angle, X-Start, and Y-Start. X-Angle can range from 0 to 90. At 0, you're looking at the scene from the ground, edge on. At 90, you're looking from the air, straight down. Angles from 20 to 40 degrees are typical. Z-Angle lets you walk around the scene. An angle of 0 lets you look from the south end of the map, an angle of 90 lets you look from the west edge of the map, an angle of 180 lets you look from the north, and an angle of 270 lets you look from the east. The default value is 10, a number just far enough away from 0 to keep the image from looking square or boxish. X-Start and Y-Start let you center the scene on your screen. Since the screen in 320 pixels wide, 160 is the default X-Start value. Since the mountains come up from the base of the terrain, the default Y-Start is 120, about 20 pixels below the center of the screen.

Magnification controls the size of the rendered image. Magnification opens a requester with four numeric gadgets: X-Axis, Y-Axis, Z-Axis, and View-Pt. X-Axis controls the horizontal magnification. If you'd like to have the image fill the entire screen, increase this number. Similarly, Y-Axis controls the vertical magnification of the image. Z-Axis controls how steep the mountains are. If you want your mountains to be more jagged, increase this number. If you'd rather have rolling hills and gentle valleys, decrease this number.

Scales controls the look of your scene by controlling the low-level fractal creation engine. It opens a requester with four numeric gadgets. The changes you make here will be reflected the next time you use Demo or Create to build mountains. These numbers do not affect the display of mountains you've already built. The Form gadget affects the overall look of the mountains. A large number will create rounded, massive mountains. A small number will allow spires. Use a number in the range 100-900. F Dimn determines the fractal dimension of the map. The smaller the number, the more rugged your terrain; use a number in the range 0-100. Delta is the maximum change allowed in altitude from one point to the next. Scale is the maximum elevation that will be used by the ReScale option; 10,000 is the maximum allowed. For example, 5,000 would scale the map to half the maximum elevation.

The final menu item, Size-Light, controls the size of the map and the lighting. When you expand a scene to fill the entire screen, you'll find that the default size settings make for a rather chunky map. To increase the resolution of your image, increase the map size. X-Size and Y-Size default to 100 each. This makes a map with 10,000 points. If you'd like greater resolution, increase these values. But beware: Working with a 200 X 198 map will be about four times slower than working with a 100 X 100 map. The maximum X-Size is 300; the maximum Y-Size is 198. For reference, each map point requires three bytes of memory with a similar amount being needed by the undo buffer.

Light controls the angle at which the light strikes the scene. Use a number in the range 0-90. The default value is 45, which corresponds to about 9:30 a.m. A value of 0 places the sun at the horizon. A value of 90 puts the sun directly overhead.

Quad controls the direction from which the light is coming. The top of the map is 1, the right side is 2, the bottom is 3, and the left side is 4. Any other number makes the light overcast and diffuse.

Technical Information

Mountains is a multitasking program. To flip to the Workbench, press Left Amiga-M. To flip back, press Left Amiga-N. Mountains was written in J-Forth, a language known for its efficiency and quick integer arithmetic.


There are a few handy programs contained in the Amiga Resource Disk's C directory that some readers may not be familiar with.


A speedy program for reading text files, RD works from the Workbench or CLI. Copy RD to the C directory of your Workbench disk. To use it from the Workbench, use the Info menu item to change the Default Tool of your text file's icon to C:RD. From the command line, you just type RD filename(s), where filename(s) is the name or names of the files you wish to read. RD also supports both AmigaDOS- and ARP-style wildcards; typing RD *.info will allow you to read all files that don't end with the .info extension.

New in RD 1.1: Screen handling is up to two times faster. It no longer needs arp.library, so you can add it to almost-full Workbench disks. RD now handles complex escape sequences and supports Workbench 2.0-style scroll bars and system fonts.


This utility displays both standard IFF and Sliced HAM pictures. The stripped-down version included on this month's disk no longer requires the 17K arp.library file but only works from the Workbench.

To use V, copy it to the C directory on your Workbench disk and change the Default Tool of your picture's icon to C:V. Then just click on your picture's icon to show it.


This tiny utility adds an extra bitplane to your Workbench screen so you can utilize eight-color icons. Just copy it to the C directory of your Workbench disk and add the command COLORBENCH to your S:startup-sequence file.