TerraGear Documentation: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
Line 39: Line 39:


=== hgtfit ===
=== hgtfit ===
hgtfit is responsible for taking the raw heightfield data for one bucket, and picking the most important points to generate a triangle mesh.  It uses [http://mgarland.org/archive/cmu/scape/terra.html Terra] to perform the work.  The output is not a triangulation, but rather a list of nodes that can be fed to a triangulation routine.  The quality of FlightGear's terrain is directly related to what parameters are fed into hgtfit.


=== ogr-decode ===
=== ogr-decode ===

Revision as of 16:10, 7 June 2012

There has been a lot of questions relating to scenery generation tools. This page is an attempt to document each of the tools I use. I will also document the design, and what each tool is actually doing.

My hope is to attract more developers to work on the tools to make it easier to create better scenery for FlightGear.

Toolchain

hgtchop

hgtchop is responsible for cropping height data files into SimGear buckets (or tiles). Most height data is published in fairly large data files that cover 1 square degree. For SRTM-1 data, there are 3601 x 3601 data points per file. For SRTM-3 data, there are 1201 x 1201 data points per file. SRTM datafiles are named by their southwestern most point.

When TerraGear tools need to query elevation data, they do so expecting the data to be located in a standard SimGear folder structure as follows:

Format Example
10 deg x 10 deg folder w070n10
1 degree by 1 degree subfolder w065n17
—— bucket file —— 1891048.arr.gz

hgtchop will create this directory structure in the work folder, and create sgbucket.arr.gz files within.

command options

hgtchop <resolution> <hgt_file> <work_dir>

resolution
Each file created contains ALL of the data points for the simgear tile. For SRTM-1 data, the resultant grid (for tiles near the equator) is 450 x 450 points. For SRTM-3 data, the grid is 150 x 150 points. The resolution parameter tells hgtcop the distance between sampled points. Note that tile width varies with latitude. So 'square' tiles really only exist between 22 degrees N - 22 degrees S. The tile widths are explained here: Tile Index Scheme

hgt_file
The source file. Usually, the source files are 1 degree by 1 degree, and have enough data to create 64 simgear buckets (near the equator).

work_dir
This is where hgt-chop will generate the elevation directory structure described above.

notes

  1. zip files : In TGHgt::open, if the file extension is '.zip', then unzip executable is executed through system(). If the host system doesn't have unzip, then hgtchop will fail. The unzip should be performed via SimGear - Investigation needed


hgtfit

hgtfit is responsible for taking the raw heightfield data for one bucket, and picking the most important points to generate a triangle mesh. It uses Terra to perform the work. The output is not a triangulation, but rather a list of nodes that can be fed to a triangulation routine. The quality of FlightGear's terrain is directly related to what parameters are fed into hgtfit.

ogr-decode

genapts / genapts850

design

Step 1 : Parse
Step 2 : Clip
Step 3 : Clean
Step 4 : Elevation
Step 5 : Output

fgfs-construct

Related content