If you want to raytrace your favorite canyon or mountain with POV-Ray, you have to get the digitized data that represent the landscape. This is easy, if this landscape is located in the United States of America, because the elevation data for every of the US states including Alaska and Hawai'i are available on the WWW-server of the US Geological Survey. To raytrace a picture from these data, you have to do three steps:

STEP I : Find the appropriate file in the database and download it to your computer
STEP II: Find and download a software to convert the data file to a .gif or .tga heightfield
STEP III : Get or write a POV-Ray source and raytrace the height field.

To make it easier for you (and for me as well), I have written this description. If you find something that is wrong or difficult to understand, please send me a mail, and I will try to improve it.

Let me describe STEP III at first, because it is the easiest:

Download blue.pov here, which is a small POV-Ray source, and download grandcan.gif (600 kb), which is a .gif height-field of the eastern Grand Canyon. So you can immediately do:

STEP III: raytrace this picture:

The color map in my source is not really "scientific", but just chosen to make the picture more colorful.

You probably would like to trace another picture, so here is one more little POV-Ray source (canyon.pov). It should render the picture below, using the same grandcan.gif as in the upper picture:

If you want to raytrace a different landscape from somewhere else in the United States, you have to find the data on the server of the US Geological Survey. That is a bit more complicated, but it is the first step one normally has to do.

STEP I : Download the data from the WWW-Server of US Geological Survey. In fact, USGS keeps data of almost any place in the US including Alaska and Hawai'i, and the database is really huge. The numbers that represent a landscape are called a Digital Elevation Model. Keep the three letters DEM in mind. You will get lost in the database, if you don't know what you are looking for.

To find your way, choose, then click "mapping" on the homepage, and you will be on the "National Mapping Page". Look for "Downloadable Data" and click "US GeoData". You will see "1:250,000-scale DEM Data", and there you can chose between three possibilities for download: FTP via Alphabetical list, FTP via State and FTP via Graphics. A "search via state", where you can search for "Arizona", or "via Graphics", where you get a clickable map, will probably be the easiest way to get along.

After having made your choice, you should have a 1:250 000 DEM data file ready for download. The uncompressed versions have a size of about 9 MB. If that is too big, chose the compressed file.

(I chose to download the uncompressed data for Grand Canyon East, but nevertheless, it had the extension .gz, and that confused me a bit, but with an text editor I could immediately check that the data were not compressed.)

Now that you have the DEM data in some directory on your computer, you need to convert them to a heightfield. You need an appropriate software for that step.

STEP II: Download a conversion software and convert the data

On the US GeoData Page, there is a link to "Public Domain Software"

Option I: Using a .gif height field

If a .gif-heightfield is accurate enough for your purpose, you have little work to do:
You just have to download a ready-to-run conversion program and, additionally, make use of one of your graphics programs:

On the Public Domain Software page you will soon see a link to "USGS DEM to TGA Converter", where you can download a .zip-file that contains the C-source and the 92 kB dem2tga.exe file. Run it, and it converts the DEM data to a .tga-file. Though it has the extension .tga now, however, it is not possible to use this file as a POV-Ray heightfield. In a .tga heightfield POV-Ray uses the red and green color values of a pixel to encode the elevation, while this converter produces a "greyscale" .tga file. In this "greyscale" file the different colors of a pixel have the same value. But you can use one of the common graphics programs to open this .tga file and simply store it as a .gif file. You can raytrace that .gif file with POV-Ray immediately. To get correct views, you should mirror the .gif-file and compare your picture with a map to get the correct orientation.

The resolution is not so good as in the original DEM data, because the .gif has only 256 different values for the elevation. It looks somewhat better, if you add the "smooth" keyword to the height_field statement.

Option II: Using a .tga heightfield:

If you want to use the full double byte resolution of a .tga-file for POV-Ray, it is a bit more complicated to get the conversion software. You find more downloadable software on the page. Look for the directory "dem". I tried several of the programs, especially the FORTRAN sources, but I had the fastest success with "dem2pov.c" . I don't have a C compiler, but a friend compiled it for me and it worked immediately. So I could convert the DEM data to a true "red-and-green-encoded" .tga heightfield for direct use with POV-Ray. In case you want to use the .exe-file, I have stored the 56 kB dem2pov.exe here on our pages. It works fine on my system, but, of course, I cannot take any responsibility for what it does on your system.

Bright Angel Trail

We hiked down into Grand Canyon on the Bright Angel Trail in 1986. So I tried to render a picture which I could compare with a photo that I took during the hike, just to see the limits of the data. I had to move the POV-Ray camera very carefully to the place where we stood more than ten years ago:

You may need a while to see the corresponding features in the two pictures, but I think the results are not so bad. Only a very small part of the whole .tga file appears in the picture. Unfortunately the Bright Angel Trail starts near the corner of the .tga heightfield, and thus some of the mountains are missing in the right background of the raytraced picture. I should improve the color_map and download the adjacent DEM-data some day...

Bye for now, I hope you will have fun rendering landscapes, and if you detect any ground squirrels in your pictures, don't feed them.

Photo © Kurt Bangert