Reply To: DEM Help

Home Forums AR Sandbox Forum DEM Help Reply To: DEM Help

Oliver Kreylos

The first step is to prepare a digital elevation model (DEM) in the (very simple) file format read by the AR Sandbox. I might add support for standard file formats at some later point, but there’s no funding right now.

The format is binary, with little-endian (Intel) byte order. The first two entries are the number of columns and rows in the DEM, stored as 4-byte signed integers.

The next four entries are the spatial extents of the DEM represented as a rectangle using some arbitrary units and coordinate system. More precisely, they are the left, bottom, right, and top edges of the DEM, stored as 4-byte IEEE 754 standard floating-point numbers.

After that follow the DEM’s elevation postings, as numRows x numColumns 4-byte IEEE 754 floating-point numbers in row-major order. The AR Sandbox assumes that the elevation values are in the same unit of measurement as the DEM’s spatial extents.

To load a DEM in this format into the AR Sandbox, press any key while it’s running, and select “Show DEM” from the tool selection menu. In the file selection box that appears, select a DEM file. If the file could be read correctly, pressing the same key afterwards will toggle the AR Sandbox into DEM mode, where blue indicates an excess of sand, and red indicates a lack of sand. Move sand from the blue to the red areas until everything is white (ideally). Pressing the bound key again will toggle back to regular mode.

The DEM mapping tool can be configured to adjust the DEM’s vertical level (to make the DEM match the total amount of sand in the box), its vertical exaggeration, and the tolerance level when the sand is colored white. To adjust these settings, it is easiest to assign a DEM tool as above, and then save the current tool setup by selecting “Save Input Graph” from the “Devices” sub-menu of the Vrui system menu. This creates a text file with the settings for the DEM tool inside. After adjusting the settings, the complete tool setup can be loaded back from inside the AR Sandbox by selecting “Load Input Graph,” or at startup by passing -loadInputGraph <your input graph file name> on SARndbox’s command line.

Comments are closed.