Digital Elevation Models

"DEM" redirects here. For the .dem extension, see demo file.
==Overview==
Digital Elevation Models (DEMs) are special files that store elevation information. This tutorial shows how to convert these files into a format that can be used in Hammer, allowing for highly realistic terrain with minimal effort. Sample DEM and VMF files are included at the bottom.
==Getting the DEMs==
There is a large database with the entire USA here: http://data.geocomm.com/catalog/
The site requires a free registration, and downloads will be restricted at 5 kb/s, but each DEM is only 3 MB max. Ensure you get the 10 meter resolution version whenever possible, as they are more detailed. There are usually 30 meter options as well, but they provide lesser results.
You can get the first file you see, or look for a specific place. You will need to know the state and county in that case. Topozone is a useful service to find places with geographic data, if you do not know the county you wish to find. Use it to find the exact place by typing its name, then take note of state/county/USGS Quad and latitude/longitude. Now you have all you need to find your DEM. Start digging into the geocomm database, and sooner or later you should find it.
==Converting DEMs==
Terragen is a nice app to create terrains with very realistic atmospheric effects (You don’t need Terragen for this tutorial.) but before you can see your DEM in Terragen, you need to convert it with 3DEM. The process is simple.
*Load Terrain model: Choose USGS DEM file type (Can be viewed in 3D at any time by pressing F2.)
*Select zone. The zone can be resized by dragging while left-clicking on a corner. Take in consideration that DEM size is much bigger than the max distance supported by Source, so you need to crop smaller areas or your terrain will look scaled in-game. There is no problem if you plan to use it for 3dskybox.
*Export it: File/Save Terragen Terrain/ Entire or Zone, whatever you want.
===Merging DEMs===
3DEM is also capable of another interesting operation: you can merge several DEMs. If the zone you are interested is split in two or several DEMs, you will need to merge them. This is what 3DEM's help has to say about merging:
USGS 7.5 Minute SDTS DEMs in tar-gzip (*tar.gz or *.tgz) format can be directly merged by 3DEM. Choose “File - Load Terrain Model” and select “USGS DEM.” Then you can select multiple DEM files from a common directory to be merged into one Overhead View. That is, all of the DEMs to be merged must be contained in the same file directory. To select multiple files, highlight each file required using the mouse, and then click OK to load all files into 3DEM. The only limit to the number of DEMs that can be merged is memory in your computer.
DEMs to be merged must be adjacent to each other. Note that merged DEMs do not always match perfectly at their boundaries since the quality and accuracy of each DEM can vary widely. 3DEM makes the best match possible with the selected DEMs.
Please note that 7.5’ DEMs to be merged must be all of the same resolution. That is, 10-meter and 30-meter resolution DEMs cannot be mixed. Mixing DEMs of different resolution will result in an error message “DEMs Have Different Grid Resolutions.”
Please note that 7.5’ DEMs cannot be merged across UTM zone boundaries. You can check the UTM zone of each DEM by selecting “Operation - Show DEM Specs” from the Overhead View menu. Attempting to merge DEMs across UTM boundaries will also result in the error message “DEMs Are From Different UTM Zones.”
==Create .Tif==
We have a Terragen format landscape but we don’t need Terragen to manipulate it. Just use this little app to convert your .ter to .tif: TerraConv
Select “Load Terrain” and export it as 16-bit .tif (or .pgm, also supported by DispGen).
As mentioned, Terragen is not required. However, should you want to preview your landscape, tweak it or create a 2D skybox, you can find more information about it here: Terrasource (general info)
Skybox (2D) with Terragen
The render within Terragen using the sample files is below.
==Create Terrain==
Cannonfodder’s DispGen is an app to build complex 3d terrains in VMF format from gray scale bit maps like we have now. Download it here.
It’s very straight forward, but here are some tips:
*Brush generation parameters: maintain the proportion with your DEM, though keep in mind the max size is 31000x31000. Be careful with X and Y triangles, too much resolution could result in unusable maps.
*Displacement ajustment: try with and without, maybe you will not like it
*Run smoothing: not recommended, will destroy details of our precious 16-bit grayscale.
*Create Skybox: take care with that, a gigantic map with a gigantic skybox is not the best way to make maps. More height=more BSP size and more compile time. A hand made skybox with proper height for every map zone is better (if you have large height variations)
*Create VIS nodraws: useful to make a full VIS compile, will reduce overdraw and big FPS gain could be obtained if your terrain has canyons/walls that reduce visibility. Advice: compile time can be larger than your own life if terrain is very complex.
==Sample Files==
Updated link here (courtesy of R_Yell)
==Screenshots==
	
Category:TutorialsCategory:Glossary
Category:Displacements