TerraGear Documentation: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:
== Toolchain ==
== Toolchain ==
If you just want see every options/arguments available for each tool you can use this command line in the terragear/bin directory : (only for linux user)
If you just want see every options/arguments available for each tool you can use this command line in the terragear/bin directory : (only for linux user)
   terragear/bin $ for file in *; do echo "" && echo "###################################" && echo $file && echo "###################################" && ./$file -h; done
   for file in *; do echo "" && echo "###################################" && echo $file && echo "###################################" && ./$file --help; done


=== hgtchop ===
=== hgtchop ===

Revision as of 19:03, 18 February 2013

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

If you just want see every options/arguments available for each tool you can use this command line in the terragear/bin directory : (only for linux user)

 for file in *; do echo "" && echo "###################################" && echo $file && echo "###################################" && ./$file --help; done

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


terrafit

terrafit 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 terrafit.

command options

terrafit [options] <file | path>

Option Default Description
-m or --minnodes 50 smallest number of nodes to produce. For a mostly flat tile, more nodes are wasteful.
-x or --maxnodes 1000 largest number of nodes to produce. For a very complex tile, limiting this will reduce the detail of the resulting mesh.
-e or --maxerror 40 While picking points, and we have at least minnodes, but not yet maxnodes, the mesh will be completed if any of the remaining points maximum elevation error drops below this value.
-f or --force If you have an already fitted work directory, and want to regenerate with different parameters, be sure to use force. Otherwise, the work directory is checked for updated height data and merged with current data

As you can see, the default parameters are pretty conservative. At most, we will output 1,000 nodes. The input data for SRTM-1 contains 202,500 nodes, so we are only keeping 0.5% of the source data (or for SRTM-3, with 22,500 nodes, we keep ~5% of the source data)

For my experiments, I've increased maxnodes to 20,000, and decreased max error to 10 meters, and didn't see a major frame rate hit).

If you consider the number of nodes added when using detailed landclass, it's unfortunate that the height lookup for these points will be based on such an inaccurate mesh.

ogr-decode

genapts / genapts850

design

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

fgfs-construct

Related content