How To Render California

This is a description of how I generated the picture of California. I don't expect many people will actually go out and do this, but you might find this interesting anyways.

Virtually all of these steps were automated by a small Tcl script. It's not in any shape to distribute, but the code isn't complicated. If you really want to do this writing a similar script won't be much of a hurdle.

Be forewarned -- fiddling with this stuff will eat lots of disk space quickly. The raw data for California is 139MB, and you'll probably need another 50MB or so for tiles etc.

  1. Get the raw data for California from the USGS. Here's a list of the dem files you'll need:
    crescent_city-e weed-w weed-e alturas-w alturas-e vya-w vya-e mcdermitt-w mcdermitt-e wells-w wells-e
    eureka-e redding-w redding-e susanville-w susanville-e lovelock-w lovelock-e winnemucca-w winnemucca-e elko-w elko-e
    ukiah-w ukiah-e chico-w chico-e reno-w reno-e millett-w millett-e ely-w ely-e
    santa_rosa-w santa_rosa-e sacramento-w sacramento-e walker_lake-w walker_lake-e tonopah-w tonopah-e lund-w lund-e
    san_francisco-e san_jose-w san_jose-e mariposa-w mariposa-e goldfield-w goldfield-e caliente-w caliente-e
    "" monterey-w monterey-e fresno-w fresno-e death_valley-w death_valley-e las_vegas-w las_vegas-e
    "" san_luis_obispo-w san_luis_obispo-e bakersfield-w bakersfield-e trona-w trona-e kingman-w kingman-e
    "" "" santa_maria-e los_angeles-w los_angeles-e san_bernardino-w san_bernardino-e needles-w needles-e
    "" "" "" long_beach-w long_beach-e santa_ana-w santa_ana-e salton_sea-w salton_sea-e
    "" "" "" "" san_clemente_island-e san_diego-w san_diego-e el_centro-w el_centro-e
           
    The tiles are listed by their position in the final rendering. "" is used to indicate there's no DEM tile for that position (i.e. it's the Pacific Ocean.)

  2. The raw data is distributed as gzip'ed text files in this special format. Uncompressed each tile takes up about 8MB and covers a 1-degree square area. You need to convert each file to a format that a raytracer can use. I've got a program demto.c that can convert these tiles to various formats. For POV you can convert to PPM and (later) use ppmtotga to create a height field. Do this for each of the tiles, and while you're at it you might as well scale them down to a reasonable size. I used 186x186 pixel tiles. Each one ends up being around 60-70k (compressed) in size.

  3. Now you'll need to concatenate the tiles into 1 larger one. I did it by first creating 10 rows with pnmcat -lr, and then concatenating the 10 rows together and converting to TGA format (for use the POV's height_field construct) with pnmcat -tb -jright -black | ppmtotga -rgb. Each row was between 200-700k in size (compressed), and the final composite height field (in TGA format) was 5.1MB (compressed).

  4. Now you're finally ready to start rendering. I used this input file. It took about 4 hours on my 486/66 linux box. The end result was this (5.5MB compressed PPM) image.

Sam Shen <slshen@lbl.gov>
Last modified: Thu Jun 8 23:37:53 1995