Importing Geo-Referenced Environments
- 1 Introduction
- 2 Downloading Heightmap Data
- 3 Using Google Earth Pro
- 4 Editing the Saved Images
- 5 Creating the Environment
- 6 See Also
This tutorial discusses the process of modeling a real-world location for use in ANVEL, using heightmaps and satellite images. The heightmap influences ANVEL’s environment mesh, raising and lowering polygons, to match real-world height information. The satellite images generate surface textures (e.g., grass, mud, dirt, etc.) to apply on top of the environment mesh to provide realism to the visuals and simulation.
This tutorial will provide guidance on:
- Downloading relevant heightmap and satellite images
- Converting the images into an ANVEL usable format
- Generating the ANVEL environment with the images
Disclaimer: Environments generated in this fashion may only be used for noncommercial purposes.
This tutorial uses external programs. Users should have access to and be familiar with:
- Image editing software (e.g., Adobe Photoshop or GIMP)
- Google Earth (GE) Pro (Free)
Downloading Heightmap Data
After defining a location, download the relevant heightmap data which can be found on the U.S. Geological Survey (USGS) website. The site has a feature called Earth Explorer where users can download an image that represents the heightmap information for a given location on Earth. To use this feature, create a USGS account.
1. Under the Search Criteria tab, navigate to the desired location to convert the heightmap data, then click on the map. A single red pin appears to pinpoint the location. USGS generates maps within the location of the pin.
2. Select Data Sets > Digital Elevation > SRTM 1 Arc-Second Global.
3. Under the Results tab, click on the Download Options and then download the heightmap data file. There may be different resolutions/file types provided. It is recommended that the user downloads the highest resolution image possible.
Note: The heightmaps available for download are very large (approximately 100 km), users may need to pare them down later.
4. To gain access to relevant information about the heightmap image, select Show Metadata and Browse. Record the latitude and longitude values of each of the four corners of the image for use in the next step.
Using Google Earth Pro
GE Pro accurately aligns the previously downloaded heightmap data and Google’s satellite imagery together. Having the two images aligned is crucial for making a realistic and accurate environment in ANVEL.
Using GE Pro, produce the following:
- Correctly aligned heightmap
- Correctly aligned satellite image
- The size of the chosen area
In GE Pro, complete the following steps to add the heightmap data as an overlay to ensure both texture maps are aligned correctly.
1. Select Add Image Overlay.
2. Select Browse and import the heightmap.
3. Under the Location tab, select Convert to LatLonQuad.
4. Populate the text fields appropriately.
Note: “1st corner” is the southwest corner, “2nd corner” is the southeast corner, “3rd corner” is the northeast corner and “4th corner” is the northwest corner.
The result should be a large black and white heightmap overlaid onto the Earth in a layer that the user can toggle on and off. Adding a Bounding Box
Implementing an Image Overlay Bounding Box
Next, it is recommended to add an image overlay bounding box. This box should be used as a guide to:
- Display the area that will be imported into ANVEL
- Obtain the correct length of the environment for use in ANVEL
In GE Pro, complete the following steps.
1. Download and save the "BoundingBox.png" File:BoundingBox.png
2. Select Image Overlay.
3. Select Browse to add the “BoundingBox.png” file.
Note: If the bounding box is not the correct size, hold down Shift, select a corner and drag to scale the overlay until it is an acceptable size. Holding down Shift will ensure that the overlay image remains square and is not distorted.
It is important to measure the length of the guide in meters. Without this measurement, ANVEL cannot accurately represent the size of the heightmap.
In GE Pro, complete the following steps.
1. Select Tools > Ruler.
2. Click on two adjacent corners of the red square.
3. Record the distance in meters.
Saving the Screenshot
Next, save the color satellite image and the heightmap data.
1. In GE Pro under the Layers tab in the bottom left corner of the screen, uncheck Primary Database to remove all markers that may interfere with the heightmap.
2. Select View > Reset > Tilt and Compass to ensure that the screenshots taken from GE Pro will not be skewed in any way.
Note: Any adjustment to the camera in GE Pro will cause the globe to turn slightly. It is recommended to reset the tilt and compass after any movement to verify the screenshots are not distorted.
3. Save a screenshot of the desired area with the heightmap turned on (location accurate heightmap).
4. Save a second screenshot of the desired area with the heightmap turned off (location accurate color heightmap).
Editing the Saved Images
Import the screenshots taken from GE Pro in an image editing software to properly crop and edit them for use in ANVEL. This example uses Adobe Photoshop.
1. Open Photoshop and import the two images (satellite and heightmap).
2. Crop the size of the image down to a square. The size must be a power of two plus one (e.g., 257x257, 513 x 513, 1025 x 1025 px).
Preparing the Heightmap
Save the heightmap file modified in the image editing software with the following features:
- 16 bit
- .raw file
Note: If working in Photoshop, save the image with IBM PC selected in the save options, otherwise the heightmap exports incorrectly. The heightmap is now complete and ready for use.
Preparing the Surface Layers
ANVEL’s environment mesh supports the use of four surfaces: one base surface, and three layers on top. Each surface is driven by a black and white texture map, where white displays the texture and black displays nothing.
Using the color information from the satellite image as a guide, paint masks in Photoshop to represent each of the materials in the environment (e.g., grass, concrete, asphalt, dirt, sand, etc.). For example, follow the steps for an easy and quick way to create a grass surface layer in Photoshop.
1. Select Select > Color Range.
2. Select a color (green for grass) with the eyedropper.
3. Select Create a New Layer.
4. Use the Paint Bucket tool and fill the new layer with white.
The user may want to clean up the default results. For additional surface layers, repeat the steps using the appropriate color for the environment materials.
After cleaning the various surface layers, save each surface layer as a separate image file with the following settings:
- 8 bit
- .raw file
Make a new folder in the ANVEL Environments directory %LOCALAPPDATA%\Anvel\Environments. Save the heightmap and the surface layer files in this location.
Creating the Environment
Input the correct file names into the ANVEL .env file using a text editor in order for ANVEL to detect the appropriate heightmaps and correctly display the environment.
1. Open ANVEL.
2. Select File > New Environment.
3. Modify the Cell Size to match the number of meters recorded earlier.
4. Modify the HeightMapSize to reflect the resolution chosen earlier.
Adding Surface Layers
Add a few surface layers to generate the necessary files to input custom surface and heightmap information.
1. Select Terrain Editor Mode.
2. Click on the Surface button.
3. Select Add Layer to add as many layers as desired.
Note: ANVEL can only support three surface layers.
4. Click on the drop-down menu next to the layer name and change the material as desired.
5. Select File > Save Environment.
Implementing the Surface Layers
Modify the ANVEL-generated heightmap/surface layers with the custom ones.
Note: “UserEnvironment” is a placeholder for the environment name.
1. Open the .env in a text editor.
2. Replace the line below with the custom-generated heightmap:
3. Replace the line below with the custom-generated surface layer:
Note: layer_0 is the layer directly on top of the base, ‘1’ is on top of that layer, and so on.
4. Repeat the above steps to modify layers 0 – 2 to reflect the customized heightmap.
5. Save and close the .env file.
6. Open ANVEL and load the custom environment to test it.
The environment should now accurately represent its real-world counterpart.
Note: If the environment appears too rough to be drivable in ANVEL, blur the heightmap in Photoshop. The image may be slightly less accurate, but it will be much smoother to drive and test on.