How to open large-format DEMs in Bryce

Tom Patterson, US National Park Service

For a more recent method for importing large-format 16-bit DEMs into Bryce 6.1 on Mac and PC, see: www.shadedrelief.com/NED/ned.html

Introduction

Bryce is an intriguing program for cartographers. It combines an innovative and easy-to-use interface, powerful 3D visualization tools, and a rendering engine that yields landscapes of exceptional quality. However, despite these advantages, it has lacked the ability to merge multiple Digital Elevation Models (DEMs) and to import DEMs larger than 1024 x 1024 pixels -- until now.

Large DEMs can be imported into Bryce thanks to an undocumented feature in Bryce 4 and the help of freeware and shareware utilities. The key to the technique is saving a DEM in PGM (Portable Grayscale Map) format with one of the following quadratic file sizes: 2048 x 2048, 4096 x 4096, or 8192 x 8192. When these conditions are met, Bryce will import a DEM as a seamless terrain comprised of tiled 1024 x 1024 pieces. For example, a PGM-format DEM measuring 4096 x 4096 pixels would have 16 interlocking tiles when imported into Bryce.

The process for converting a DEM to PGM format is indirect, requiring multiple applications and translating to intermediate formats along the way. BSmooth shareware is the critical link in the chain, since it is the only application, other than Bryce and KPT 6, that can read or write to the PGM format. To import a DEM into BSmooth, the DEM first must be formatted to one of the quadratic file sizes mentioned above and saved in 8-bit grayscale PICT or 16-bit PSD format. The following tutorial briefly explains the procedure.
 

The left image shows a Bryce rendering of Mt Rainier from a DEM in 8-bit PICT format. The right image was rendered from the same DEM, but in 16-bit PGM format.
 

Tutorial

To complete the tutorial you will need:

--A Macintosh with lots of RAM
--DEMs
--Bryce 4
--BSmooth shareware
--MacDEM freeware
--Adobe Photoshop

Step 1 - MacDEM: Use MacDEM to open, merge, and save a large DEM in binary (.bin) format. MacDEM is very easy to use and comes with thorough documentation, so I won't get into the particulars of using it here. IMPORTANT: Before exiting MacDEM note the size of the binary DEM you just saved -- this critical information is needed in the next step.


DEM size in MacDEM.

Step 2 - Photoshop: Launch Photoshop. Go to File/Open. In the Open dialog select the "show all files" option and RAW from the format pop-up menu. Open the .bin DEM you saved from MacDEM. The "Raw Options" dialog appears next. Enter the dimensions of your DEM in pixels and duplicate the other information shown below:

When the grayscale DEM opens in Photoshop it probably will appear too dark. This can be fixed by adjusting "input levels" in the Levels dialog (Image/Adjust/Levels). The trick is not to touch the midtone slider and not to pull the highlight or shadow sliders into the body of the histogram itself -- doing so will truncate elevation values! The tones should range from nearly black to nearly white.


Adjusting the shadow (left) and highlight (right) of a DEM in Photoshop.

Next, draw a square selection measuring 2048 x 2048, 4096 x 4096, or 8192 x 8192 pixels -- depending on the size of the DEM and the amount area you want to show. The rectangular marquee selection tool with the fixed "style" option selected is the best way to do this. Use the Edit/Crop command to crop to the DEM. Finally, save the file in Photoshop (.psd) format. The resulting Photoshop file will contain 16-bits of grayscale data.

Tip 1: Padding the area around a DEM with empty data (usually black) is necessary when formatting a rectangular-shaped DEM to fit inside a quadratic square without resampling the resolution. Unfortunately, the Canvas Size command in Photoshop is disabled with 16-bit files, as are many other functions. The Rotate Canvas command can be used as a crude alternative, however. Set the background color to black at the bottom of the tool bar, go to Image/Rotate Canvas/Arbitrary and enter 45 degrees. Rotate the canvas twice to place a wide black buffer around the DEM.

Tip 2: Deep-Bit Filters, a suite of Photoshop plug-ins, bring Unsharp Mask, Gaussian Blur, High Pass, Despeckle, Median, and Dust and Scratches to 16-bit files.

Tip 3: Click here for a tutorial about opening 16-bit GTOPO30 files in Photoshop.

Step 3 - BSmooth:

BSmooth is another exceptional utility that is easy to use and well documented, so I will list only the steps you need to follow for completing the tutorial. When time allows, I encourage you to explore BSmooth carefully. There are many useful tools to be discovered.

A) Launch BSmooth. Select the "pixel layer' operation from the "ops" tool bar (right side, third icon from top).

B) Load the DEM saved from Photoshop in the pixel layer by clicking on the "default" label.

C) Click on the icon on the left side of the pixel layer.  Select the invert option in the dialog that appears. This is to counteract a bug in BSmooth that causes exported PGM files to be inverted and upside down when imported into Bryce.

D) Click on the "Terrain" label in the "Go" layer and set the terrain size to the same pixel size as the file saved from Photoshop.

E) Go to File/Preferences. Set the output format to PGM and the terrain size to match the file size from Photoshop.

F) Click the "Go" button. BSmooth will export the DEM in PGM format, if you have enough RAM!


A Photoshop DEM loaded in BSmooth ready for translation to PGM format.

Step 4 - Bryce:

You are in the home stretch. Launch Bryce, go to File/Import Object, and select the PGM file exported from BSmooth. If all goes correctly Bryce will automatically tile the imported DEM. However, as is typical with Bryce, there are quirks. Bryce imports PGM files upside down. This can be fixed by grouping all terrain tiles and using the rotate widget to flip the DEM 180 degrees on the X axis. When the imported DEM is rendered, you will undoubtedly notice narrow gaps between the tiled terrains. This is because Bryce tiles to a bounding box surrounding each terrain and not to the terrain edge itself. To remove the gaps: ungroup the terrains, go to top view, zoom in close to the intersecting terrains, and use the object attributes dialog box to reposition each terrain tile by 0.1 Bryce unit on the x and/or y axis so that the edges touch. After repositioning, the rendered DEM should appear almost seamless and the few remaining  artifacts can be easily removed in Photoshop during post-rendering touch-up.


Use the Object Attributes dialog to reposition terrain tiles precisely. In the example above, changing the z value from 51.2 to 51.1 or 51.3 nudges the terrain up or down when in top view. Changing the x value nudges the terrain left or right.
 
 


Wireframe view of a 2048 x 2048 PGM DEM imported into Bryce and automatically tiled as four 1024 x 1024 terrains.
 

Note: A DEM saved in PGM format is about three times larger (in megabytes) than a comparable DEM saved in PSD format. However, after importing a bloated PGM file into Bryce, the resulting Bryce file reverts to a smaller size.

Acknowledgments

My thanks go out to Klaus Busse for writing BSmooth and Jerry Farm for writing MacDEM. Without their carto-friendly utilities the procedures outlined above would not be possible. In addition, Bryce's hidden ability to import tiled PGM files was first noted by Klaus at his BSolutions website.

Return to the relief shading homepage