<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Psadro+gm</id>
	<title>FlightGear wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Psadro+gm"/>
	<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/Special:Contributions/Psadro_gm"/>
	<updated>2026-04-09T14:13:49Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107408</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107408"/>
		<updated>2017-03-18T15:00:06Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Trying it out */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== Tools to created LOD tile hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
demconvert can create highest LOD based on .HGT files from viewfinderpanorama&amp;lt;/br&amp;gt;&lt;br /&gt;
demconvert can create lower levels of detail based on higher LODs ( simplifies via gdalwarp API )&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== pagedLOD (.SPT) hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
pagedLOD database is created at subsystem init time in Scenery/terrain_pgt class&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|20}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
&lt;br /&gt;
The entire scenegraph is loaded before FDM initialization, and the database pager is traversing the pagedLOD nodes, but the viewpoint is such that all of the pagedLOD nodes are culled.  &lt;br /&gt;
It looks like aircraft final positioning ( or a switch to cockpit view ) is starting the actual terrain loading.  I'll need to move up the camera positioning to start terrain loading before fdm is initialized.&lt;br /&gt;
&lt;br /&gt;
Ugh - the original altitude was a hack I added to get moving...  I can get a more accurate position by querying the DEM, but this isn't accurate enough - I'm still to high off the ground for a good trim, and I bounce off the ground on init - breaking new Cessna's gear.&lt;br /&gt;
&lt;br /&gt;
I will try to implement the following:&amp;lt;/br&amp;gt;&lt;br /&gt;
# get rough estimate to position the aircraft viewPos - DONE!&lt;br /&gt;
# use scenery_available() to wait for the highest level pagedLOD to load - next&lt;br /&gt;
# use the scenery intersect ( as before ) to get exact contact point&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Runways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Lights {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Markings {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Roads {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Rail {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Streams {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Objects {{Pending}} {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Scenery Database {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== OSM {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Random Objects {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://www.dropbox.com/s/zsnwbxi8npnjmq9/hawaiidem.tgz?dl=0 hawaii_dem].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_TEXTURING=&amp;quot;bluemarble&amp;quot;&lt;br /&gt;
  or&lt;br /&gt;
LOD_TEXTURING=&amp;quot;debug&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107351</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107351"/>
		<updated>2017-03-12T23:03:58Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* FDM groundcache init {{Progressbar|15}} */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== Tools to created LOD tile hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
demconvert can create highest LOD based on .HGT files from viewfinderpanorama&amp;lt;/br&amp;gt;&lt;br /&gt;
demconvert can create lower levels of detail based on higher LODs ( simplifies via gdalwarp API )&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== pagedLOD (.SPT) hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
pagedLOD database is created at subsystem init time in Scenery/terrain_pgt class&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|20}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
&lt;br /&gt;
The entire scenegraph is loaded before FDM initialization, and the database pager is traversing the pagedLOD nodes, but the viewpoint is such that all of the pagedLOD nodes are culled.  &lt;br /&gt;
It looks like aircraft final positioning ( or a switch to cockpit view ) is starting the actual terrain loading.  I'll need to move up the camera positioning to start terrain loading before fdm is initialized.&lt;br /&gt;
&lt;br /&gt;
Ugh - the original altitude was a hack I added to get moving...  I can get a more accurate position by querying the DEM, but this isn't accurate enough - I'm still to high off the ground for a good trim, and I bounce off the ground on init - breaking new Cessna's gear.&lt;br /&gt;
&lt;br /&gt;
I will try to implement the following:&amp;lt;/br&amp;gt;&lt;br /&gt;
# get rough estimate to position the aircraft viewPos - DONE!&lt;br /&gt;
# use scenery_available() to wait for the highest level pagedLOD to load - next&lt;br /&gt;
# use the scenery intersect ( as before ) to get exact contact point&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Runways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Lights {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Markings {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Roads {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Rail {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Streams {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Objects {{Pending}} {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Scenery Database {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== OSM {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Random Objects {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107350</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107350"/>
		<updated>2017-03-12T23:03:43Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* FDM groundcache init {{Progressbar|10}} */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== Tools to created LOD tile hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
demconvert can create highest LOD based on .HGT files from viewfinderpanorama&amp;lt;/br&amp;gt;&lt;br /&gt;
demconvert can create lower levels of detail based on higher LODs ( simplifies via gdalwarp API )&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== pagedLOD (.SPT) hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
pagedLOD database is created at subsystem init time in Scenery/terrain_pgt class&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|15}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
&lt;br /&gt;
The entire scenegraph is loaded before FDM initialization, and the database pager is traversing the pagedLOD nodes, but the viewpoint is such that all of the pagedLOD nodes are culled.  &lt;br /&gt;
It looks like aircraft final positioning ( or a switch to cockpit view ) is starting the actual terrain loading.  I'll need to move up the camera positioning to start terrain loading before fdm is initialized.&lt;br /&gt;
&lt;br /&gt;
Ugh - the original altitude was a hack I added to get moving...  I can get a more accurate position by querying the DEM, but this isn't accurate enough - I'm still to high off the ground for a good trim, and I bounce off the ground on init - breaking new Cessna's gear.&lt;br /&gt;
&lt;br /&gt;
I will try to implement the following:&amp;lt;/br&amp;gt;&lt;br /&gt;
# get rough estimate to position the aircraft viewPos - DONE!&lt;br /&gt;
# use scenery_available() to wait for the highest level pagedLOD to load - next&lt;br /&gt;
# use the scenery intersect ( as before ) to get exact contact point&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Runways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Lights {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Markings {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Roads {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Rail {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Streams {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Objects {{Pending}} {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Scenery Database {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== OSM {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Random Objects {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107349</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107349"/>
		<updated>2017-03-12T22:23:47Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* FDM groundcache init {{Progressbar|10}} */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== Tools to created LOD tile hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
demconvert can create highest LOD based on .HGT files from viewfinderpanorama&amp;lt;/br&amp;gt;&lt;br /&gt;
demconvert can create lower levels of detail based on higher LODs ( simplifies via gdalwarp API )&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== pagedLOD (.SPT) hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
pagedLOD database is created at subsystem init time in Scenery/terrain_pgt class&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
&lt;br /&gt;
The entire scenegraph is loaded before FDM initialization, and the database pager is traversing the pagedLOD nodes, but the viewpoint is such that all of the pagedLOD nodes are culled.  &lt;br /&gt;
It looks like aircraft final positioning ( or a switch to cockpit view ) is starting the actual terrain loading.  I'll need to move up the camera positioning to start terrain loading before fdm is initialized.&lt;br /&gt;
&lt;br /&gt;
Ugh - the original altitude was a hack I added to get moving...  I can get a more accurate position by querying the DEM, but this isn't accurate enough - I'm still to high off the ground for a good trim, and I bounce off the ground on init - breaking new Cessna's gear.&lt;br /&gt;
&lt;br /&gt;
I will try to implement the following:&amp;lt;/br&amp;gt;&lt;br /&gt;
# get rough estimate to position the aircraft viewPos&lt;br /&gt;
# use scenery_available() to wait for the highest level pagedLOD to load&lt;br /&gt;
# use the scenery intersect ( as before ) to get exact contact point&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Runways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Lights {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Markings {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Roads {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Rail {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Streams {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Objects {{Pending}} {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Scenery Database {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== OSM {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Random Objects {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107345</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107345"/>
		<updated>2017-03-12T16:17:38Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* FDM groundcache init {{Progressbar|10}} */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== Tools to created LOD tile hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
demconvert can create highest LOD based on .HGT files from viewfinderpanorama&amp;lt;/br&amp;gt;&lt;br /&gt;
demconvert can create lower levels of detail based on higher LODs ( simplifies via gdalwarp API )&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== pagedLOD (.SPT) hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
pagedLOD database is created at subsystem init time in Scenery/terrain_pgt class&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
&lt;br /&gt;
The entire scenegraph is loaded before FDM initialization, and the database pager is traversing the pagedLOD nodes, but the viewpoint is such that all of the pagedLOD nodes are culled.  &lt;br /&gt;
It looks like aircraft final positioning ( or a switch to cockpit view ) is starting the actual terrain loading.  I'll need to move up the camera positioning to start terrain loading before fdm is initialized.&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Runways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Lights {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Markings {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Roads {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Rail {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Streams {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Objects {{Pending}} {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Scenery Database {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== OSM {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Random Objects {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107327</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107327"/>
		<updated>2017-03-11T14:05:03Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Digital Elevation Modem (DEM ) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== Tools to created LOD tile hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
demconvert can create highest LOD based on .HGT files from viewfinderpanorama&amp;lt;/br&amp;gt;&lt;br /&gt;
demconvert can create lower levels of detail based on higher LODs ( simplifies via gdalwarp API )&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== pagedLOD (.SPT) hierarchy {{Progressbar|90}} ===&lt;br /&gt;
&lt;br /&gt;
pagedLOD database is created at subsystem init time in Scenery/terrain_pgt class&lt;br /&gt;
&lt;br /&gt;
NOTE: There may be an issue generating low LOD in the tool, or loading them in Flightgear.  I am seeing tile border 'valleys' from space.&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Runways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Lights {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Markings {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Roads {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Rail {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Streams {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Objects {{Pending}} {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Scenery Database {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== OSM {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Random Objects {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107326</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107326"/>
		<updated>2017-03-11T13:58:45Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Runways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Lights {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Markings {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Roads {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Rail {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Streams {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Objects {{Pending}} {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Scenery Database {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== OSM {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Random Objects {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107325</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107325"/>
		<updated>2017-03-11T13:56:56Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Vector Data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Runways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Lights {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Markings {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Roads {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Rail {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Streams {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107324</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107324"/>
		<updated>2017-03-11T13:56:35Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Airports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Runways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Lights {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Markings {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Roads ===&lt;br /&gt;
&lt;br /&gt;
=== Rail ===&lt;br /&gt;
&lt;br /&gt;
=== Streams ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107323</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107323"/>
		<updated>2017-03-11T13:56:02Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Landclass Data */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data {{Pending}} ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== LOD  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Effect  {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Airports ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Runways ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss ===&lt;br /&gt;
&lt;br /&gt;
=== Lights ===&lt;br /&gt;
&lt;br /&gt;
=== Markings ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Roads ===&lt;br /&gt;
&lt;br /&gt;
=== Rail ===&lt;br /&gt;
&lt;br /&gt;
=== Streams ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107322</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107322"/>
		<updated>2017-03-11T13:54:59Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Digital Elevation Modem (DEM ) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
Subclass Terrain nodes in the scenegraph to express terrain LOD and area covered in lon/lat?&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Pending}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images ===&lt;br /&gt;
&lt;br /&gt;
=== LOD ===&lt;br /&gt;
&lt;br /&gt;
=== Effect ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Airports ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Runways ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss ===&lt;br /&gt;
&lt;br /&gt;
=== Lights ===&lt;br /&gt;
&lt;br /&gt;
=== Markings ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Roads ===&lt;br /&gt;
&lt;br /&gt;
=== Rail ===&lt;br /&gt;
&lt;br /&gt;
=== Streams ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107321</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107321"/>
		<updated>2017-03-11T13:52:24Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Digital Elevation Modem (DEM ) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init {{Progressbar|10}} ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Scenery Available {{Progressbar|0}} ===&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) {{Progressbar|0}} ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync {{Progressbar|0}} ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images ===&lt;br /&gt;
&lt;br /&gt;
=== LOD ===&lt;br /&gt;
&lt;br /&gt;
=== Effect ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Airports ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Runways ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss ===&lt;br /&gt;
&lt;br /&gt;
=== Lights ===&lt;br /&gt;
&lt;br /&gt;
=== Markings ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Roads ===&lt;br /&gt;
&lt;br /&gt;
=== Rail ===&lt;br /&gt;
&lt;br /&gt;
=== Streams ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107320</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107320"/>
		<updated>2017-03-11T13:50:18Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* terrain collision */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Identifying what level is loaded at particular coordinates ===&lt;br /&gt;
&lt;br /&gt;
=== terrain collision (BVH) ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images ===&lt;br /&gt;
&lt;br /&gt;
=== LOD ===&lt;br /&gt;
&lt;br /&gt;
=== Effect ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Airports ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Runways ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss ===&lt;br /&gt;
&lt;br /&gt;
=== Lights ===&lt;br /&gt;
&lt;br /&gt;
=== Markings ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Roads ===&lt;br /&gt;
&lt;br /&gt;
=== Rail ===&lt;br /&gt;
&lt;br /&gt;
=== Streams ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107319</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107319"/>
		<updated>2017-03-11T13:44:06Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* FDM groundcache init */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.&amp;lt;/br&amp;gt;  &lt;br /&gt;
This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
&lt;br /&gt;
# Need to set camera location&lt;br /&gt;
# Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Identifying what level is loaded at particular coordinates ===&lt;br /&gt;
&lt;br /&gt;
=== terrain collision ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images ===&lt;br /&gt;
&lt;br /&gt;
=== LOD ===&lt;br /&gt;
&lt;br /&gt;
=== Effect ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Airports ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Runways ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss ===&lt;br /&gt;
&lt;br /&gt;
=== Lights ===&lt;br /&gt;
&lt;br /&gt;
=== Markings ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Roads ===&lt;br /&gt;
&lt;br /&gt;
=== Rail ===&lt;br /&gt;
&lt;br /&gt;
=== Streams ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107318</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107318"/>
		<updated>2017-03-11T13:42:54Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* FDM groundcache init */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init ===&lt;br /&gt;
&lt;br /&gt;
On startup, the terrain is initialized via subsystem init.  This populates the pagedLOD tree for the whole world.  What it does NOT do, is start paging in terrain.&lt;br /&gt;
1) Need to set camera location&lt;br /&gt;
2) Need to start the pager ( main loop )&lt;br /&gt;
&lt;br /&gt;
The FDM is also started via subsystem init, but queries the terrain engine until scenery is available given a certain radius around the aircraft.  &lt;br /&gt;
On first attempt, the groundcache is initialized with the first LOD ( very rough ) giving incorrect altitude.&lt;br /&gt;
We need a way for scenery_available to query per LOD, and pass in the most detailed level, so we wait for local conditions to be stable.&lt;br /&gt;
We also need to run the pager to begin loading&lt;br /&gt;
&lt;br /&gt;
=== Identifying what level is loaded at particular coordinates ===&lt;br /&gt;
&lt;br /&gt;
=== terrain collision ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images ===&lt;br /&gt;
&lt;br /&gt;
=== LOD ===&lt;br /&gt;
&lt;br /&gt;
=== Effect ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Airports ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Runways ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss ===&lt;br /&gt;
&lt;br /&gt;
=== Lights ===&lt;br /&gt;
&lt;br /&gt;
=== Markings ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Roads ===&lt;br /&gt;
&lt;br /&gt;
=== Rail ===&lt;br /&gt;
&lt;br /&gt;
=== Streams ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107317</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107317"/>
		<updated>2017-03-11T13:37:56Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
== Digital Elevation Modem (DEM ) ==&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init ===&lt;br /&gt;
&lt;br /&gt;
=== Identifying what level is loaded at particular coordinates ===&lt;br /&gt;
&lt;br /&gt;
=== terrain collision ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images ===&lt;br /&gt;
&lt;br /&gt;
=== LOD ===&lt;br /&gt;
&lt;br /&gt;
=== Effect ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Airports ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Runways ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss ===&lt;br /&gt;
&lt;br /&gt;
=== Lights ===&lt;br /&gt;
&lt;br /&gt;
=== Markings ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Roads ===&lt;br /&gt;
&lt;br /&gt;
=== Rail ===&lt;br /&gt;
&lt;br /&gt;
=== Streams ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels ===&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107316</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=107316"/>
		<updated>2017-03-11T13:33:24Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Enabling the engine */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
Currently, the work is being done on a topic branch.  topics/new-scenery - located here [https://sourceforge.net/p/flightgear/simgear/ci/topics/new-scenery/~/tree/ simgear] and here [https://sourceforge.net/p/flightgear/flightgear/ci/topics/new-scenery/~/tree/ flightgear]&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== Design Decisions ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FDM groundcache init ===&lt;br /&gt;
&lt;br /&gt;
=== Identifying what level is loaded at particular coordinates ===&lt;br /&gt;
&lt;br /&gt;
=== terrain collision ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Landclass Data ==&lt;br /&gt;
&lt;br /&gt;
=== Per tile images ===&lt;br /&gt;
&lt;br /&gt;
=== LOD ===&lt;br /&gt;
&lt;br /&gt;
=== Effect ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding LC ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Transition ===&lt;br /&gt;
&lt;br /&gt;
=== Encoding Exclusion areas ===&lt;br /&gt;
&lt;br /&gt;
=== Terrasync ===&lt;br /&gt;
&lt;br /&gt;
== Airports ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Runways ===&lt;br /&gt;
&lt;br /&gt;
=== Taxiways ===&lt;br /&gt;
&lt;br /&gt;
=== X-Plane .DSF Polygonss ===&lt;br /&gt;
&lt;br /&gt;
=== Lights ===&lt;br /&gt;
&lt;br /&gt;
=== Markings ===&lt;br /&gt;
&lt;br /&gt;
== Vector Data ==&lt;br /&gt;
&lt;br /&gt;
=== Flattening ===&lt;br /&gt;
&lt;br /&gt;
=== Roads ===&lt;br /&gt;
&lt;br /&gt;
=== Rail ===&lt;br /&gt;
&lt;br /&gt;
=== Streams ===&lt;br /&gt;
&lt;br /&gt;
=== Bridges ===&lt;br /&gt;
&lt;br /&gt;
=== Tunnels ===&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=104745</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=104745"/>
		<updated>2016-10-09T17:05:28Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = &lt;br /&gt;
|name        = Experimental Terrain Engine&lt;br /&gt;
|started     = 09/2016 &lt;br /&gt;
|description = Experimental Terrain Engine&lt;br /&gt;
|status      = Under active development as of 10/2016&lt;br /&gt;
|maintainers = {{usr|psadro_gm}}&lt;br /&gt;
|developers  = {{usr|psadro_gm}} (since 09/2016)&lt;br /&gt;
|folders = &lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* {{flightgear file|src/Canvas}}&lt;br /&gt;
* {{simgear file|simgear/canvas}}&lt;br /&gt;
* {{fgdata file|Nasal/Canvas}}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|topic-fgdata = (main repository, master branch; https://gitorious.org/~tomprogs/fg/toms-fgdata/commits/canvas-gui-demo)&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|subforum = http://forum.flightgear.org/viewforum.php?f=71&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
Currently, the work is being done on a topic branch.  topics/new-scenery - located here [https://sourceforge.net/p/flightgear/simgear/ci/topics/new-scenery/~/tree/ simgear] and here [https://sourceforge.net/p/flightgear/flightgear/ci/topics/new-scenery/~/tree/ flightgear]&lt;br /&gt;
&lt;br /&gt;
== Status / Gallery ==&lt;br /&gt;
psadro_gm has the normal calculations, now.  Everything is being generated on the fly.  psadro_gm sees very little CPU usage.&lt;br /&gt;
Still lot's to do - e.g. need to sample 1 extra pixel in the DEM so edges of tiles get correct normals ( you can see the edges )&lt;br /&gt;
&lt;br /&gt;
Also, psadro_gm hasn't created skirts, yet, so there are gaps between levels.&lt;br /&gt;
&lt;br /&gt;
psadro_gm will add to Mathais' tunables to select grid spacing at each LOD level, to see if we can minimie the popping.&lt;br /&gt;
Note: the texture is just 1 4096x4096 sheet for the whole planet.  It'll be nice to see what we can do with procedural texturing.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=295882#p295882 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Next-generation scenery generating? &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; psadro_gm &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  Oct 1st, 2016 &lt;br /&gt;
  |added  =  Oct 1st, 2016 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|-eWEB0-j7zk}} {{#ev:youtube|v9M2La8ZN1U}}&lt;br /&gt;
&lt;br /&gt;
== Design Decisions ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
== Trying it out ==&lt;br /&gt;
I have uploaded a small DEM section covering Hawaii for testing:  the tarball is here: [https://dl.dropboxusercontent.com/u/29968727/hawaiidem.tar.gz hawaiidem.tar.gz].  Extract the files in a subdirctory, and add this to your fg-scenery path:&lt;br /&gt;
&lt;br /&gt;
Here's an example script I use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOG_CLASS=--log-class=terrain,flight&lt;br /&gt;
LOG_LEVEL=--log-level=info&lt;br /&gt;
&lt;br /&gt;
FGROOT=--fg-root=${HOME}/Development/flightgear-fgdata/&lt;br /&gt;
SCENERY=--fg-scenery=${HOME}/Development/hawaiidem/&lt;br /&gt;
&lt;br /&gt;
# HAWAII&lt;br /&gt;
START_POS=&amp;quot;--lon=-158.0 --lat=21.0 --altitude=4000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
TERRAIN_ENGINE=&amp;quot;pagedLOD&amp;quot;&lt;br /&gt;
LOD_RES=&amp;quot;1&amp;quot;&lt;br /&gt;
LOD_RANGEMULT=&amp;quot;2&amp;quot;&lt;br /&gt;
LOD_LEVELS=&amp;quot;1 2 3 4 5 6 7 8 9&amp;quot;&lt;br /&gt;
LOD_LEVEL_RES=&amp;quot;3 5 9 17 33 49 65 93 151&amp;quot;&lt;br /&gt;
ZFAR=&amp;quot;9600000&amp;quot;&lt;br /&gt;
&lt;br /&gt;
fgfs ${FGROOT} ${SCENERY} ${LOG_LEVEL} ${LOG_CLASS} ${START_POS} --timeofday=noon --aircraft=ufo --prop:double:/sim/rendering/camera-group/zfar=${ZFAR} --prop:/sim/scenery/engine=&amp;quot;${TERRAIN_ENGINE}&amp;quot; --prop:/sim/scenery/lod-levels=&amp;quot;${LOD_LEVELS}&amp;quot; --prop:/sim/scenery/lod-res=&amp;quot;${LOD_RES}&amp;quot; --prop:/sim/scenery/lod-level-res=&amp;quot;${LOD_LEVEL_RES}&amp;quot; --prop:/sim/scenery/lod-range-mult=&amp;quot;${LOD_RANGEMULT}&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=104741</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=104741"/>
		<updated>2016-10-09T16:23:04Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Enabling the engine */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
Currently, the work is being done on a topic branch.  topics/new-scenery - located here [https://sourceforge.net/p/flightgear/simgear/ci/topics/new-scenery/~/tree/ simgear] and here [https://sourceforge.net/p/flightgear/flightgear/ci/topics/new-scenery/~/tree/ flightgear]&lt;br /&gt;
&lt;br /&gt;
== Design Decisions ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=104740</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=104740"/>
		<updated>2016-10-09T16:22:07Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[Git]], [[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
{{Scenery Core Development}}&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a [[Shader|shader]] based landclass engine utilizing raster encoded fileds to identify landclass, and smoothness of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the [[OpenSceneGraph]] Database Pager for handling multiple levels of detail (see [[PagedLOD]]).&lt;br /&gt;
&lt;br /&gt;
Currently, the work is being done on a topic branch.  topics/new-scenery - located here [https://sourceforge.net/p/flightgear/simgear/ci/topics/new-scenery/~/tree/ simgear] and here [https://sourceforge.net/p/flightgear/flightgear/ci/topics/new-scenery/~/tree/ flightgear]&lt;br /&gt;
&lt;br /&gt;
== Design Decisions ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is an abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all subsystems inheriting from {{API Link|simgear|class|SGSubsystem}} &lt;br /&gt;
{{See also|Howto:Create new subsystems}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the [[FDM]] or [[Nasal]] (scripting).&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the [[Effects|effect]] engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  &lt;br /&gt;
&lt;br /&gt;
{{Note|how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info on terrain initialization.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
    // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling the engine ==&lt;br /&gt;
&lt;br /&gt;
By default, the current engine is the tile-manager based terrain (.stg/.btg files)&lt;br /&gt;
To enable and tune the new engine, the following properties are added:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Property !! Type !! Value(s) !! Description&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=&amp;quot;2&amp;quot;|/sim/scenery/engine ||rowspan=&amp;quot;2&amp;quot;|String || &amp;quot;tilecache&amp;quot; || Select normal engine&lt;br /&gt;
|-&lt;br /&gt;
| &amp;quot;pagedLOD&amp;quot; || Select new terrain engine &lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-levels || String || &amp;quot;1 3 5 7&amp;quot; || a list of levels - between 1 and 9 - Selects which levels to use.&lt;br /&gt;
|-&lt;br /&gt;
| lod-range-mult || String || &amp;quot;2&amp;quot; || the range in which to move to/from new LOD.&amp;lt;/br&amp;gt;The bounding radius of the tile is multiplied by this value to calculate the range from the center of the tile.&lt;br /&gt;
|-&lt;br /&gt;
| /sim/scenery/lod-level-res || String || &amp;quot;3 5 9 17 33 49 65 93 129&amp;quot; || &amp;quot;This list defines the resolution of each LOD level.&amp;lt;/br&amp;gt; In this instance, level 1 is a 2 x 2 grid.&amp;lt;/br&amp;gt;(3 samples on both x and y axis)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The Digital Elevation Model ==&lt;br /&gt;
&lt;br /&gt;
The actual DEM is a collection of levels (independent of the LOD level)  Multiple DEM levels are not required, but highly advised.  The ViewFinderPanorama DEM is ~50GB.  The entire planet is always loaded, so terrasync would need to download all 60 GB the first time to be able to model the whole world.  Each LOD request opens a 'session' with the DEM.  The DEM will pick an appropriate DEM level to fulfill the session request based on the size of the request.  Sessions are cached, so multiple elevation requests using the same session will not cause addition file open/reads.&lt;br /&gt;
&lt;br /&gt;
For example, if you request anything between 1/8 x 1/8 degree and 1 x 1 degree sessions, you'll get the highest resolution DEM ( as vfp tiles are 1x1 ).  If you request 12x12 degrees, you'll get a significantly reduced DEM resolution - as you are most likely generating a tile VERY far away from the viewer.&lt;br /&gt;
&lt;br /&gt;
Currently, only one Mesh Hierarchy is supported.  Paths are searched via the normal fg-scenery paths list.  The first scenery path to contain a valid hierarchy is selected.  The directories are searched in scenery-path/DEM/&lt;br /&gt;
&lt;br /&gt;
Under this directory are sub-directories named level_xx.  Within each subdirectory is a description file (deminfo.txt), along with each tile.  An example description file is for the original .hgt files from viewfinder panoramas:&lt;br /&gt;
&lt;br /&gt;
1 1 1201 1201 hgt&lt;br /&gt;
&lt;br /&gt;
The format is size-lon( in degrees ) size-lat( in degrees ), res-lon, res-y, file type&lt;br /&gt;
&lt;br /&gt;
Currently, I have generated 5 levels from the vfp data.  The largest tile size being 60x60 degrees - 18 tiles cover the whole planet.  Current disk space for the levels is as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! level dir !! size of tile (degrees) !! size on disk &lt;br /&gt;
|-&lt;br /&gt;
| ./level_01 || 1x1 || 50G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_02 || 2x2 || 4.8G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_03 || 4x4 || 1.2G&lt;br /&gt;
|-&lt;br /&gt;
| ./level_04 || 12x12 || 149M&lt;br /&gt;
|-&lt;br /&gt;
| ./level_05 || 60x60 || 6.8M&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that level_01 is uncompressed .hgt format.  The generated levels are compressed geotiff format.  Final solution will be to use geotiff for level 1 as well.  I expect the first level to be ~20GB, as each level reduces x and y resolution by a factor of 2.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enchancement]]&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=104715</id>
		<title>Experimental terrain engine</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Experimental_terrain_engine&amp;diff=104715"/>
		<updated>2016-10-09T13:59:21Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: Goals and Design of a new terrain engine for FlightGear&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[GDAL]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
== Goals ==&lt;br /&gt;
&lt;br /&gt;
The new experimental terrain engine main goals are:&lt;br /&gt;
&lt;br /&gt;
# a shader based landclass engine utilizing raster encoded fileds to identify landclass, and smoothnexx of transitions between them&lt;br /&gt;
# a regular mesh that can be generated on the fly from standard gdal raster images&lt;br /&gt;
# utilize the OpenSceneGraph Database Pager for handling multiple levels of detail.&lt;br /&gt;
&lt;br /&gt;
Currently, the work is being done on a topic branch.  topics/new-scenery - located here [https://sourceforge.net/p/flightgear/simgear/ci/topics/new-scenery/~/tree/ simgear] and here [https://sourceforge.net/p/flightgear/flightgear/ci/topics/new-scenery/~/tree/ flightgear]&lt;br /&gt;
&lt;br /&gt;
== Design Decisions ==&lt;br /&gt;
&lt;br /&gt;
# modular terrain engine.&lt;br /&gt;
The user should be able to select the legacy terrain engine ( tile cache based ), or the new engine based on a property.&lt;br /&gt;
In the flightgear/Scenery source, the Scenery object instantiates the selected terrain engine.&lt;br /&gt;
The terrain object is a abstract base class, and new terrain engines derive from this class.&lt;br /&gt;
&lt;br /&gt;
The following APIs are defined for all SGSubsystems&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;nowiki&amp;gt; // Implementation of SGSubsystem. - called from Scenery&lt;br /&gt;
    virtual void init ( osg::Group* terrain ) = 0;&lt;br /&gt;
    virtual void reinit() = 0;&lt;br /&gt;
    virtual void shutdown () = 0;&lt;br /&gt;
    virtual void bind () = 0;&lt;br /&gt;
    virtual void unbind () = 0;&lt;br /&gt;
    virtual void update (double dt) = 0;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called from various other flightgear modules, like the FDM.&lt;br /&gt;
They are used to query altitude and materials at given locations&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;nowiki&amp;gt; /// Compute the elevation of the scenery at geodetic latitude lat,&lt;br /&gt;
    /// geodetic longitude lon and not higher than max_alt.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined. &lt;br /&gt;
    /// All values are meant to be in meters or degrees.&lt;br /&gt;
    virtual bool get_elevation_m(const SGGeod&amp;amp; geod, double&amp;amp; alt,&lt;br /&gt;
                                 const simgear::BVHMaterial** material,&lt;br /&gt;
                                 const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the elevation of the scenery below the cartesian point pos.&lt;br /&gt;
    /// you the returned scenery altitude is not higher than the position&lt;br /&gt;
    /// pos plus an offset given with max_altoff.&lt;br /&gt;
    /// If the exact flag is set to true, the scenery center is moved to&lt;br /&gt;
    /// gain a higher accuracy of that query. The center is restored past&lt;br /&gt;
    /// that to the original value.&lt;br /&gt;
    /// The altitude hit is returned in the alt argument.&lt;br /&gt;
    /// The method returns true if the scenery is available for the given&lt;br /&gt;
    /// lat/lon pair. If there is no scenery for that point, the altitude&lt;br /&gt;
    /// value is undefined.&lt;br /&gt;
    /// All values are meant to be in meters.&lt;br /&gt;
    virtual bool get_cart_elevation_m(const SGVec3d&amp;amp; pos, double max_altoff,&lt;br /&gt;
                                      double&amp;amp; elevation,&lt;br /&gt;
                                      const simgear::BVHMaterial** material,&lt;br /&gt;
                                      const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&lt;br /&gt;
    /// Compute the nearest intersection point of the line starting from &lt;br /&gt;
    /// start going in direction dir with the terrain.&lt;br /&gt;
    /// The input and output values should be in cartesian coordinates in the&lt;br /&gt;
    /// usual earth centered wgs84 coordinate system. Units are meters.&lt;br /&gt;
    /// On success, true is returned.&lt;br /&gt;
    virtual bool get_cart_ground_intersection(const SGVec3d&amp;amp; start, const SGVec3d&amp;amp; dir,&lt;br /&gt;
                                              SGVec3d&amp;amp; nearestHit,&lt;br /&gt;
                                              const osg::Node* butNotFrom = 0) = 0;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These APIs are called to determine the state of the scenery, or to schedule new scenery&lt;br /&gt;
Scheduling new scenery from flightgear may or may not be necessary - depending on the engine.&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;nowiki&amp;gt; /// Returns true if scenery is available for the given lat, lon position&lt;br /&gt;
    /// within a range of range_m.&lt;br /&gt;
    /// lat and lon are expected to be in degrees.&lt;br /&gt;
    virtual bool scenery_available(const SGGeod&amp;amp; position, double range_m) = 0;&lt;br /&gt;
&lt;br /&gt;
    // tile mgr api&lt;br /&gt;
    virtual bool schedule_scenery(const SGGeod&amp;amp; position, double range_m, double duration=0.0) = 0;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the effect engine notifies the terrain engine when the material library has changed.  &lt;br /&gt;
This occurs when moving from one regional texture definition to another.  NOTE: how this can be done &lt;br /&gt;
without being under flightgear control is TBD.  We would need to setup the database pager with this info &lt;br /&gt;
on terrain initialization.&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;nowiki&amp;gt; // tile is in a different regional texture definition.&lt;br /&gt;
    virtual void materialLibChanged() = 0;&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=World_Scenery_3.0_roadmap&amp;diff=104714</id>
		<title>World Scenery 3.0 roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=World_Scenery_3.0_roadmap&amp;diff=104714"/>
		<updated>2016-10-09T13:29:34Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See also [[TerraGear roadmap]]&lt;br /&gt;
&lt;br /&gt;
For the experimental runtime generated mesh/landclassing engine - which may become WS3.0 - see [[Experimental terrain engine]].&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Make_an_airport&amp;diff=86917</id>
		<title>Howto:Make an airport</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Make_an_airport&amp;diff=86917"/>
		<updated>2015-08-31T13:58:11Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* What you need */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article will guide you through the process of '''creating an airport''' and link you to related articles.&lt;br /&gt;
&lt;br /&gt;
== A note about licenses ==&lt;br /&gt;
Official FlightGear scenery is, as the rest of the program and data, licensed under the [[GNU General Public License]] v2. In order to have your work included in the official scenery, it must comply with this license.&lt;br /&gt;
&lt;br /&gt;
In short this means that you can only use images that:&lt;br /&gt;
* you created yourself, entirely from scratch. This is the case when you draw something, or take a photograph of a building.&lt;br /&gt;
* you received permission for to release under the GNU GPL v2.&lt;br /&gt;
* are licensed under a [http://upload.wikimedia.org/wikipedia/commons/d/dc/Quick-guide-gplv3-compatibility.svg GNU GPL v2 compatible license] (eg. Public Domain).&lt;br /&gt;
&lt;br /&gt;
Google Earth imagery is per definition '''not''' compatible. For the USA you can download the High Resolution Orthoimagery jpeg from http://earthexplorer.usgs.gov/ and use that to trace airports or buildings. For other countries, you might use OpenStreetMap data if available. Note that OpenStreetMap has been granted the right to trace over Yahoo and Bing aerial images, so it can get quite accurate. Consider learning how to [http://wiki.openstreetmap.org/wiki/Aeroways map airports in OSM].&lt;br /&gt;
&lt;br /&gt;
Alternatively you can estimate the lengths and widths of the buildings by looking at pictures.&lt;br /&gt;
&lt;br /&gt;
== Runways, taxiways and aprons ==&lt;br /&gt;
=== What you need ===&lt;br /&gt;
* [[WorldEditor]] - to &amp;quot;draw&amp;quot; the layout of the airport (taxiways, runways, aprons)&lt;br /&gt;
** Runway layout data - either from the USA Airport &amp;amp; Scenery Database or from other free imagery&lt;br /&gt;
** Other data (approach lighting systems, frequencies etc.) about the airport you want to make&lt;br /&gt;
* [[TerraGear]] - to turn the layout into useable scenery&lt;br /&gt;
** Shapefiles for the area around your airport - http://mapserver.flightgear.org/download.psp&lt;br /&gt;
** Heightmaps - http://dds.cr.usgs.gov/srtm/version2_1/ or, to more closely match the official world scenery, use http://www.viewfinderpanoramas.org/Coverage%20map%20viewfinderpanoramas_org3.htm&lt;br /&gt;
&lt;br /&gt;
Ubuntu users, can use the script in [[Ubuntu fg tools]].&lt;br /&gt;
&lt;br /&gt;
=== Airport layout ===&lt;br /&gt;
The very first step before creating a new airport layout is to check if the airport already exists in the airport database. Latest data is available at http://data.x-plane.com/get_data.html&lt;br /&gt;
If we find our airport there, we can improve it, if not, we start a new layout. This is all done in [[WorldEditor]].&lt;br /&gt;
&lt;br /&gt;
So if we have done the airport in WED, we save it as &amp;quot;ICAO.dat&amp;quot; (replacing ICAO with the ICAO code of your airport). That's the X-Plane fileformat, which is used by FlightGear too.&lt;br /&gt;
&lt;br /&gt;
==== A note about the formats ====&lt;br /&gt;
FlightGear once used the 810 version of the [[File formats#apt.dat file|apt.dat file format]], while now 850 is on duty. The difference between them is mainly that 850 allows laying down taxiways/taxilines indipendently, and making them bend smoothly (with {{wikipedia|Bezier curve|Bezier curves}}), while in 810 there were only rectangles of taxiways with a yellow line in the middle. You can tell an old airport by the fact that crossings and bends are rounded by overlaying a number of rectangular patches. If you meet one, consider converting it, and as you're already there try to gather information to make it better!&lt;br /&gt;
&lt;br /&gt;
=== Turning the airport into FlightGear scenery ===&lt;br /&gt;
There are three possibilities, the later two require [[TerraGear]], but have the advantage that you can view the result immediately:&lt;br /&gt;
* Use WED to upload your layout to http://gateway.x-plane.com/ as explained at [[#Share your layout with the world!]] and wait for the next FlightGear scenery build to include your airport.&lt;br /&gt;
* [[Howto: Test your airport layout: quick and easy]], for a quick look at your airport. This will place your airport in the middle of an ocean.&lt;br /&gt;
* [[Using TerraGear]], you can create an entire scenery, including the surrounding terrain.&lt;br /&gt;
&lt;br /&gt;
=== Share your layout with the world! ===&lt;br /&gt;
FlightGear and X-Plane make use of the same airport data. The X-Plane team has set up a scenery gateway that allows you to submit your layout for inclusion in the official scenery of both simulators. At this moment, FlightGear does not have access to the gateway though. You are advised not to submit your layout for the time being, but instead keep it on your computer. As of early October 2014 it is expected that we can start processing layouts in a couple of weeks. Keep an eye on [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=23562 this forum topic] for updates and more information.&lt;br /&gt;
&lt;br /&gt;
== Terminals, towers and hangars ==&lt;br /&gt;
=== What you need ===&lt;br /&gt;
* 3D modeling software, like [[Blender]] or [[SketchUp]], as long as it can export to the .ac file type.&lt;br /&gt;
* Lots of pictures of the buildings at the airport.&lt;br /&gt;
&lt;br /&gt;
=== Making a 3D model ===&lt;br /&gt;
One meter in FlightGear is one meter in the real world. If you use aerial or satellite imagery to measure out the buildings you'll be fine.&lt;br /&gt;
&lt;br /&gt;
=== Placing objects ===&lt;br /&gt;
{{Main article|Howto:Add details to your airport}}&lt;br /&gt;
&lt;br /&gt;
There exists a few ways which you can place a model unto a scenery, one of which is by manually using the [[UFO]].&lt;br /&gt;
&lt;br /&gt;
recently, [[User:Laserman|Laserman]] came up a with more intuitive way using [[WorldEditor]], that provides a nice, accessible way to place models using an existing airport layout as reference, but the object placement data exported by [[WorldEditor]] cannot be used directly in Flight Gear, hence the use of a python script, that parses the earth.wed.xml in such a way to make 3D model placement data compatible for inclusion into an .stg file. (see [[Howto: Place 3D objects with WED]])&lt;br /&gt;
&lt;br /&gt;
{{Tip|if you are developing an actual building, it's usually good to get the co-ordinates of one of the corners of the building so you can place it extremely accurately.}}&lt;br /&gt;
&lt;br /&gt;
=== Share your models with the world! ===&lt;br /&gt;
After finishing a building, send your model to the [http://scenemodels.flightgear.org/ scenery database], as that is the best way for them to be distributed. Everyone who downloads the airport from then on will be able to see your building!&lt;br /&gt;
&lt;br /&gt;
== Related content ==&lt;br /&gt;
* [[Howto:Make a helipad]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Howto]]&lt;br /&gt;
[[Category:Scenery enhancement]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Talk:TerraGear_roadmap&amp;diff=86173</id>
		<title>Talk:TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Talk:TerraGear_roadmap&amp;diff=86173"/>
		<updated>2015-07-13T12:42:11Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Planets ==&lt;br /&gt;
&lt;br /&gt;
{{FGCquote&lt;br /&gt;
|1= scenery itself is a different matter though, but the TerraGear tool chain will process pretty much any elevation data you throw at it and try to turn it into scenery (DEM for Mars being freely available)&lt;br /&gt;
|2= {{cite web&lt;br /&gt;
  | url    = http://forum.flightgear.org/viewtopic.php?p=250154#p250154&lt;br /&gt;
  | title  = &amp;lt;nowiki&amp;gt;Re: Planets&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | author = &amp;lt;nowiki&amp;gt;Hooray&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | date   = Jul 7th, 2015&lt;br /&gt;
  }}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{FGCquote&lt;br /&gt;
|1= As it stands, simgear's reference ellipsoid is earth.  Terragear uses these functions (a lot) when generating scenery.  We'd need to be able to plug in the parameters for each planet...&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#define 	_EQURAD   6378137.0&lt;br /&gt;
#define 	_FLATTENING   298.257223563&lt;br /&gt;
#define 	_POLRAD   6356752.3142451794975639668&lt;br /&gt;
#define 	_SQUASH   0.9966471893352525192801545&lt;br /&gt;
#define 	_STRETCH   1.0033640898209764189003079&lt;br /&gt;
#define 	E2   fabs(1 - _SQUASH*_SQUASH)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|2= {{cite web&lt;br /&gt;
  | url    = http://forum.flightgear.org/viewtopic.php?p=250159#p250159&lt;br /&gt;
  | title  = &amp;lt;nowiki&amp;gt;Re: Planets&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | author = &amp;lt;nowiki&amp;gt;psadro_gm&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | date   = Jul 7th, 2015&lt;br /&gt;
  }}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{FGCquote&lt;br /&gt;
|1= this work isn't in conflict with using terragear tools to generate other planets.  A robust toolchain should be considered a prerequisite for any scenery generation&lt;br /&gt;
|2= {{cite web&lt;br /&gt;
  | url    = http://forum.flightgear.org/viewtopic.php?p=250327#p250327&lt;br /&gt;
  | title  = &amp;lt;nowiki&amp;gt;Re: Planets&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | author = &amp;lt;nowiki&amp;gt;psadro_gm&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | date   = Jul 8th, 2015&lt;br /&gt;
  }}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{FGCquote&lt;br /&gt;
|1= [http://www.mail-archive.com/flightgear-devel%40flightgear.org/msg04153.html right], but if someone wanted to do this, those are preprocessor macros that could be easily exposed/overridden via CLI flags - I mean, it's the equivalent of running sed against the SG/TG source trees to replace any references to the corresponding macros to a std::map&amp;lt;std::string, double&amp;gt; lookup table that gets populated during initialiation (i.e. values being defaulted to what they are now). &lt;br /&gt;
Alternatively, we could have a planet.xml file using the existing propertyList xml file dialect and let people create/provide such files for whatever they want to do.&lt;br /&gt;
Replacing those constants is relatively straightforward compared to all the data manipulation and DEM processing that TG can already handle, and I guess there are quite a few other hard-coded assumptions in various parts of SG/FG and TG, too&lt;br /&gt;
Then again, this is a long-standing idea, and even some of the original TG authors (think Curt) were tossing with such ideas - to see for yourself, search the archives for &amp;quot;[http://sourceforge.net/p/flightgear/mailman/search/?q=terragear+%2B+mars TerraGear mars]&amp;quot; or &amp;quot;[http://sourceforge.net/p/flightgear/mailman/search/?q=terragear+%2B+planets&amp;amp;mail_list=all TerraGear planets]&amp;quot;&lt;br /&gt;
The main reference thread dating back to early 2002: [http://www.mail-archive.com/flightgear-devel%40flightgear.org/msg04128.html Getting settled in my new &amp;quot;home&amp;quot; / Mars Scenery] (look for answers from Curt, Jon, David Megginson&lt;br /&gt;
So preparing SG/TG to make such things possible would definitely be a worthwhile thing according to quite a number of discussions in the archives (many of which being inspired by X-Plane's Mars mode) - and with JSBSim already supporting custom atmosphere models, and given the recent revamped interest supporting spaceflight, why not ?  :D&lt;br /&gt;
It's seems we're already well on our way ...&lt;br /&gt;
|2= {{cite web&lt;br /&gt;
  | url    = http://forum.flightgear.org/viewtopic.php?p=250161#p250161&lt;br /&gt;
  | title  = &amp;lt;nowiki&amp;gt;Re: Planets&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | author = &amp;lt;nowiki&amp;gt;Hooray&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | date   = Jul 7th, 2015&lt;br /&gt;
  }}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Next WS ==&lt;br /&gt;
Note that this page is discussing a new terragear toolchain - The 'master' branch.  It is where we are trying completely new ideas, and using new tools like CGAL, and GDAL2.0.  We don't have any known date when a world will be built using the master branch, as it isn't at all stable yet, and the changes needed in Simgear are not final.  Once what we need changed in Simgear is nailed down, we'll probably wait 2-4 releases before releasing new scenery utilizing the needed SimGear changes.  &lt;br /&gt;
&lt;br /&gt;
In the meantime, the ws2.0 branch is being used to generate new world scenery releases.  No new features are being added to the toolchain, just bug fixes.&lt;br /&gt;
Martin, on the other hand does have some big changes in store with regards to the data being used :)  See http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=24038&amp;amp;hilit=NLCD&lt;br /&gt;
&lt;br /&gt;
We plan on making the scenery 'forward compatible' in that the new features will be ignored by current simgear.&lt;br /&gt;
&lt;br /&gt;
As far as .SPT, this will require a new fgviewer.&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=86172</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=86172"/>
		<updated>2015-07-13T12:31:31Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Update as of Pre-3.6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{Progressbar|100}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || support intersecting linear features instead of clipping || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| gdalchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;s&amp;gt;ogrdecode&amp;lt;/s&amp;gt; || &amp;lt;s&amp;gt;support arbitrary tile sizes / directory structure&amp;lt;/s&amp;gt; || {{not done}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;s&amp;gt;tgconstruct&amp;lt;/s&amp;gt; || &amp;lt;s&amp;gt;arbitrary tile sizes / directory structure&amp;lt;/s&amp;gt; || {{not done}}&lt;br /&gt;
|-&lt;br /&gt;
| tg-lod || .spt directory heiarchy generation || {{Progressbar|50}}&lt;br /&gt;
|-&lt;br /&gt;
| tg-lod || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
arbitrary tile sizes for ogrdecode and tgconstruct is no longer needed.  Going forward, we will try to simplify generated BTGs instead of creating new ones based on simplified scenery.&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
*A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.  Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  A quick check shows that these materials do not use tc scaling, so we should be ok.  If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
*Linear feature intersections are working, and committed to terragear/master.  I'll post screenshots, and details of the algorithm shortly.&lt;br /&gt;
&lt;br /&gt;
*I want to refactor simgear/scene/tgdb/obj.cxx.  Currently, it is saving most of the .btg in an inefficient format, along side the scenegraph equivelent, before building trees, lights, and random buildings.  I am creating a new page here for discussion among interested parties: [[NewBTGLoader]]&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
&amp;lt;!-- {{WIP}} --&amp;gt;&lt;br /&gt;
For now, please see the following discussions to learn more about plans to procedurally build airports at run-time:&lt;br /&gt;
&lt;br /&gt;
* [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=18985&amp;amp;p=176132&amp;amp;hilit=#p176151 Scenery Draping]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/537CBB58.2000707%40mindcontract.com/#msg32364995 Airport Runtime Generation-5]&lt;br /&gt;
== Update as of Pre-3.6 ==&lt;br /&gt;
Martin Spott appears to be generating the world right now, We hope to have a new WS release before the end of 2015.&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=86171</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=86171"/>
		<updated>2015-07-13T12:29:47Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: The next ws will be ws2.1 - it will be using the same tg toolchain as ws2.0 but with bug fixes, not the new toolchain being discussed here.  It is still very much experimental at the moment.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=4.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{Progressbar|100}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || support intersecting linear features instead of clipping || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| gdalchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;s&amp;gt;ogrdecode&amp;lt;/s&amp;gt; || &amp;lt;s&amp;gt;support arbitrary tile sizes / directory structure&amp;lt;/s&amp;gt; || {{not done}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;s&amp;gt;tgconstruct&amp;lt;/s&amp;gt; || &amp;lt;s&amp;gt;arbitrary tile sizes / directory structure&amp;lt;/s&amp;gt; || {{not done}}&lt;br /&gt;
|-&lt;br /&gt;
| tg-lod || .spt directory heiarchy generation || {{Progressbar|50}}&lt;br /&gt;
|-&lt;br /&gt;
| tg-lod || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
arbitrary tile sizes for ogrdecode and tgconstruct is no longer needed.  Going forward, we will try to simplify generated BTGs instead of creating new ones based on simplified scenery.&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
*A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.  Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  A quick check shows that these materials do not use tc scaling, so we should be ok.  If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
*Linear feature intersections are working, and committed to terragear/master.  I'll post screenshots, and details of the algorithm shortly.&lt;br /&gt;
&lt;br /&gt;
*I want to refactor simgear/scene/tgdb/obj.cxx.  Currently, it is saving most of the .btg in an inefficient format, along side the scenegraph equivelent, before building trees, lights, and random buildings.  I am creating a new page here for discussion among interested parties: [[NewBTGLoader]]&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
&amp;lt;!-- {{WIP}} --&amp;gt;&lt;br /&gt;
For now, please see the following discussions to learn more about plans to procedurally build airports at run-time:&lt;br /&gt;
&lt;br /&gt;
* [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=18985&amp;amp;p=176132&amp;amp;hilit=#p176151 Scenery Draping]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/537CBB58.2000707%40mindcontract.com/#msg32364995 Airport Runtime Generation-5]&lt;br /&gt;
== Update as of Pre-3.6 ==&lt;br /&gt;
pasdro_gm appears to be generating the world right now, so by 3.6 or 3.8 we should have new scenery!&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=79477</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=79477"/>
		<updated>2015-01-30T12:39:02Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{Progressbar|100}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || support intersecting linear features instead of clipping || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| gdalchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;s&amp;gt;ogrdecode&amp;lt;/s&amp;gt; || &amp;lt;s&amp;gt;support arbitrary tile sizes / directory structure&amp;lt;/s&amp;gt; || {{not done}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;s&amp;gt;tgconstruct&amp;lt;/s&amp;gt; || &amp;lt;s&amp;gt;arbitrary tile sizes / directory structure&amp;lt;/s&amp;gt; || {{not done}}&lt;br /&gt;
|-&lt;br /&gt;
| tg-lod || .spt directory heiarchy generation || {{Progressbar|50}}&lt;br /&gt;
|-&lt;br /&gt;
| tg-lod || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
arbitrary tile sizes for ogrdecode and tgconstruct is no longer needed.  Going forward, we will try to simplify generated BTGs instead of creating new ones based on simplified scenery.&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
*A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.  Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  A quick check shows that these materials do not use tc scaling, so we should be ok.  If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
*Linear feature intersections are working, and committed to terragear/master.  I'll post screenshots, and details of the algorithm shortly.&lt;br /&gt;
&lt;br /&gt;
*I want to refactor simgear/scene/tgdb/obj.cxx.  Currently, it is saving most of the .btg in an inefficient format, along side the scenegraph equivelent, before building trees, lights, and random buildings.  I am creating a new page here for discussion among interested parties: [[NewBTGLoader]]&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
&amp;lt;!-- {{WIP}} --&amp;gt;&lt;br /&gt;
For now, please see the following discussions to learn more about plans to procedurally build airports at run-time:&lt;br /&gt;
&lt;br /&gt;
* [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=18985&amp;amp;p=176132&amp;amp;hilit=#p176151 Scenery Draping]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/537CBB58.2000707%40mindcontract.com/#msg32364995 Airport Runtime Generation-5]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=FlightGear_Git:_tips&amp;diff=79207</id>
		<title>FlightGear Git: tips</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=FlightGear_Git:_tips&amp;diff=79207"/>
		<updated>2015-01-18T12:53:30Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Git}}&lt;br /&gt;
[[Git]] is a powerful tool, but can be overwhelming, even to seasoned developers. This page lists some tips and tricks to help you discover all that Git has to offer.&lt;br /&gt;
&lt;br /&gt;
== Some more helpful commands ==&lt;br /&gt;
;&amp;lt;code&amp;gt;git help&amp;lt;/code&amp;gt;&lt;br /&gt;
;&amp;lt;code&amp;gt;git help [command]&amp;lt;/code&amp;gt;&lt;br /&gt;
;&amp;lt;code&amp;gt;git apply&amp;lt;/code&amp;gt;&lt;br /&gt;
: apply a patch to files and/or to the index http://www.kernel.org/pub/software/scm/git/docs/git-apply.html&lt;br /&gt;
;&amp;lt;code&amp;gt;git checkout -f&amp;lt;/code&amp;gt;&lt;br /&gt;
: may be used to throw away any local changes to the ''working tree''. Use with care, as any option that name is &amp;lt;tt&amp;gt;-f&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;--force&amp;lt;/tt&amp;gt;, and only after reading &amp;lt;code&amp;gt;git checkout help&amp;lt;/code&amp;gt;!&lt;br /&gt;
;&amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt;'''&lt;br /&gt;
: may be used for future updates&lt;br /&gt;
&lt;br /&gt;
== git remote - adding remote repositories ==&lt;br /&gt;
Now, before anyone unnecessarily goes through the pain of cloning fgdata &lt;br /&gt;
again, you just need to add the git URL to your new personal &lt;br /&gt;
clone at gitorious as a remote in your local fgdata clone to be able to &lt;br /&gt;
push to gitorious.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
'''git remote add my-fgdata g...@gitorious.org:~andersg/fg/anders-fgdata.git'''&lt;br /&gt;
&lt;br /&gt;
Stores the URL to my fgdata clone at gitorious under the name my-fgdata in  my local git clone of fgdata. (You want the gitorious SSH URL for your repository)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''git push my-fgdata my-branch:master'''&lt;br /&gt;
&lt;br /&gt;
Pushes the local branch named my-branch to my-fgdata (i.e. my clone of fgdata at gitorious) where the branch will be named master.&lt;br /&gt;
&lt;br /&gt;
== Switching to a remote branch ==&lt;br /&gt;
&lt;br /&gt;
You can create a local version of a remote branch with &amp;quot;git branch releases-2.2.0 origin/releases-2.2.0&amp;quot;or &amp;quot;git checkout -b releases-2.2.0&lt;br /&gt;
origin/releases-2.2.0&amp;quot;. Git doesn't create a local branch automatically. It exists locally as a remote branch. Create a local branch based on it &lt;br /&gt;
with '''git branch -t -l my-2.2.0 origin/releases/2.2.0'''&lt;br /&gt;
&lt;br /&gt;
== git pull ==&lt;br /&gt;
git pull will also work if you have committed local changes but will make your local history messy (and the official history too if your changes &lt;br /&gt;
are ever merged back into the official history). If you don't care about the messyness of your local history read no further than point 1 below and use git pull without hesitation :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you do have changes you want to keep I'd recommend using git rebase to  keep them &amp;quot;on top&amp;quot; of the official work:&lt;br /&gt;
&lt;br /&gt;
1. First commit your changes to your local branch.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git status                - show you what files you have modified.&lt;br /&gt;
git add file1 file2 etc   - adds the files you want to commit&lt;br /&gt;
git commit                - creates a commit with the changes you have added.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
2. Fetch the latest stuff from the main repository.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git fetch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
3. Rebase your local branch on top of the latest official state.&lt;br /&gt;
For the FlightGear and SimGear sources this would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git rebase origin/next&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For fgdata it is&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git rebase origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. If you get conflicts you can drop your local conflicting commit by&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git rebase --skip&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
or resolve the conflicts, git add the changed files and continue the rebase with&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git rebase --continue&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Use of git status is needed here to see which files are in conflict).&lt;br /&gt;
&lt;br /&gt;
As an additional safe-guard you may create a name for your previous work &lt;br /&gt;
before you rebase so that you can easily recover it if the rebase goes &lt;br /&gt;
bad. Assuming your branch is called my-branch the following command &lt;br /&gt;
creates a back-up point:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git branch my-branch.20110205  my-branch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging Topic Branches ==&lt;br /&gt;
You want to merge your branch back into master. merge is the right word:&lt;br /&gt;
&lt;br /&gt;
* git checkout master&lt;br /&gt;
* git merge newidea&lt;br /&gt;
&lt;br /&gt;
done. If the merge creates conflicts, git will tell you so. To fix them, simply edit the files and add them to the index (git add fixed_file) and when you are done do a git commit. A merge usually creates a new commit anyway, since it's a new version of your source tree.&lt;br /&gt;
 &lt;br /&gt;
If your newidea branch is nice and tidy and a straight continuation of your current master branch (i.e. they have not diverged) you can just  merge the newidea branch into master (if they have not diverged it will just be a fast-forward of the master branch).&lt;br /&gt;
&lt;br /&gt;
You can create a new branch to keep track of your old master point first if you like:&lt;br /&gt;
&lt;br /&gt;
'''git branch old-master master'''&lt;br /&gt;
&lt;br /&gt;
git branch -h  or --help will show many useful options to git branch e.g. for creating, renaming and deleting branches.&lt;br /&gt;
&lt;br /&gt;
As long as you don't rewrite the history you can always create a new branch starting at any old commit so there is no particular need to &lt;br /&gt;
create such branches before you need them (except maybe to help remembering where that point was).&lt;br /&gt;
&lt;br /&gt;
If the branches have diverged I would consider cherry-pick over the commits from the newidea branch into master (if they are not very many) &lt;br /&gt;
and perhaps also tidy them up with using interactive rebasing before publishing the new master state. This is particularily useful if master is &lt;br /&gt;
a public branch that receives commits from other developers - it avoids the rather ugly multiple levels of merges we see in e.g. fgdata. (See also git rebase).&lt;br /&gt;
&lt;br /&gt;
gitk --all is a very useful tool to see where your different branches are in the history and how they relate to each other.&lt;br /&gt;
&lt;br /&gt;
While on the master branch:&lt;br /&gt;
&lt;br /&gt;
'''git merge newidea'''&lt;br /&gt;
&lt;br /&gt;
== Resolving Conflicts ==&lt;br /&gt;
Basically, you have to resolve your conflicts at that point if you want to keep your commit. Even if you merged your changed branch (e.g. with git pull) rather than rebasing it you'd get the conflicts.&lt;br /&gt;
&lt;br /&gt;
* git status             to check which files are in conflict.&lt;br /&gt;
* git add &amp;lt;files&amp;gt;        to register the state you want them to have.This may include cleaning out merge conflict from text files before adding them.use git checkout local-weather -- the/file to restore your version and git checkout master -- the/file to restore the upstream version.&lt;br /&gt;
* git rebase --continue  to continue the rebase.&lt;br /&gt;
&lt;br /&gt;
For your own local work I recommend committing it in small logical units - that makes it easier to use git rebase --skip to remove local edits when &lt;br /&gt;
they become obsolete due to upstream updates.&lt;br /&gt;
&lt;br /&gt;
Btw. if you don't have any particular need to checkout the master branch just&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   git fetch origin/master&lt;br /&gt;
   git rebase origin/master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
on the local-weather branch will do.&lt;br /&gt;
&lt;br /&gt;
But do remember to use origin/master rather than just master in git diff and git checkout -- some/file commands in that case, since your local &lt;br /&gt;
master branch will not be updated by fetch and rebase.&lt;br /&gt;
&lt;br /&gt;
== git merge vs. rebase ==&lt;br /&gt;
Each rebase moves your local commits to be on-top of all upstream commits.&lt;br /&gt;
&lt;br /&gt;
For example, my local SimGear branch currently looks like this:&lt;br /&gt;
git log output:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
commit 4087b34f7ebbdb54b62afb205dc2e1ca225dc68b&lt;br /&gt;
Author: Anders Gidenstam &amp;lt;and...@gidenstam.org&amp;gt;&lt;br /&gt;
Date:   Tue Mar 29 22:44:53 2011 +0200&lt;br /&gt;
&lt;br /&gt;
     Experimental Nasal GC work: Added a GC thread.&lt;br /&gt;
&lt;br /&gt;
commit d94d1a907d6ec001ab9ba497bc03aaeff55f923c&lt;br /&gt;
Author: Anders Gidenstam &amp;lt;and...@gidenstam.org&amp;gt;&lt;br /&gt;
Date:   Sun Oct 3 16:59:50 2010 +0200&lt;br /&gt;
&lt;br /&gt;
     Turn the creation of a variable without the var keyword an error in &lt;br /&gt;
Nasal.&lt;br /&gt;
&lt;br /&gt;
commit c7c3fae5c2cd21cf81e7a94911568adba926f680&lt;br /&gt;
Author: ThorstenB &amp;lt;bre...@gmail.com&amp;gt;&lt;br /&gt;
Date:   Sat May 7 19:40:01 2011 +0200&lt;br /&gt;
&lt;br /&gt;
     Also remove visual_enviro.cxx from the VC90 build.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is my two local commits appear as later than any upstream commit,  although they are &amp;quot;older&amp;quot; (as seen by their dates).&lt;br /&gt;
&lt;br /&gt;
This is the effect of the rebase. If I had merged my branch with the upstream branch instead of rebasing it on top of the upstream branch my &lt;br /&gt;
commits would have been somwhere way down in the history.&lt;br /&gt;
&lt;br /&gt;
However, note that each rebase creates new commits since the commit ID is a consequence of the history preceding the commit. The old &amp;quot;copies&amp;quot; of my &lt;br /&gt;
commits from previous rebases are no longer part of my local branch.&lt;br /&gt;
&lt;br /&gt;
== Keeping topic branches in sync with upstream ==&lt;br /&gt;
Any time someone pushes a change to the gitorious repository here is the approximate procedure to update my local clones/branches (this is the git&lt;br /&gt;
replacement for the old cvs update command):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;primary-fgdata&amp;quot;&lt;br /&gt;
git pull&lt;br /&gt;
&amp;lt;error&amp;gt; - oops I have a branch checked out currently&lt;br /&gt;
git checkout master&lt;br /&gt;
&amp;lt;error&amp;gt; - oops commit any changes in the current branch&lt;br /&gt;
 - git diff&lt;br /&gt;
 - git commit&lt;br /&gt;
git checkout master (try again, it works)&lt;br /&gt;
git pull (now it works)&lt;br /&gt;
git checkout &amp;quot;primary-branch&amp;quot;&lt;br /&gt;
git merge master (to sync the upstream changes with my own &amp;quot;wip&amp;quot; branch)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But this is just in the main fgdata clone, Now cd over to my --local branch clone.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd &amp;quot;../fgdata-clone&amp;quot;&lt;br /&gt;
git pull (merge upstream changes from my local master repository that have&lt;br /&gt;
been merged into the master branch in the previous step.)&lt;br /&gt;
git diff (see what I changed locally)&lt;br /&gt;
git commit (commit my local changes)&lt;br /&gt;
git push (push these changes back into the primary branch in my original&lt;br /&gt;
clone of the gitoriious repository)&lt;br /&gt;
&amp;lt;error&amp;gt; - oops I have the branch checked out in my primary local  repository&lt;br /&gt;
- cd &amp;quot;../fgdata-primary&amp;quot;&lt;br /&gt;
- git checkout master&lt;br /&gt;
 - cd ../fgdata-clone&amp;quot;&lt;br /&gt;
git push (now it works!)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Woohoo, everything should now be consistent and in sync and all the upstream changes should be fully merged.&lt;br /&gt;
&lt;br /&gt;
== Updating a merge request after changes ==&lt;br /&gt;
Once a merge request has been generated from your cloned gitorious repo, it will be reviewed by a core developer with commit rights.&lt;br /&gt;
Once the suggestions have been implemented, you'll need to update the merge request with the changes.  As core developers always want to keep the git history clean, you'll want to squash your changes into the original merge request patch.&lt;br /&gt;
&lt;br /&gt;
To do this, make your modifications in the same branch you performed the original work in.&lt;br /&gt;
commit the fixes to your local repo, but before pushing to gitorious, perform an interactive rebase from the oldest change you wish to commit.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git rebase -i version~1 where version is the sha of the oldest commit to include in the patch&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then push to gitorious your updated local repo.  You can then choose to update the merge request with the single commit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Tracking a release branch ==&lt;br /&gt;
 git branch -t -l release/2.6.0 origin/release/2.6.0&lt;br /&gt;
 git checkout -b release/2.6.0&lt;br /&gt;
&lt;br /&gt;
== Messed up branches ==&lt;br /&gt;
It's worth experimenting with &amp;quot;git reflog&amp;quot; in situations like this. That tracks a list of HEAD references in strict chronological order&lt;br /&gt;
(i.e. what has HEAD been in the past, not what commits were done).&lt;br /&gt;
&lt;br /&gt;
In cases where you've completely mucked up the revision history, you can look at this to see what you were doing before, recover the commit ID, and do a reset --hard to that.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;Backing out&amp;quot; is done with git reset --hard last_good_commit. Often the name of the last good commit is HEAD^, the last commit. However, after a botched&lt;br /&gt;
merge it is good to verify that with git log or graphically with gitk.&lt;br /&gt;
&lt;br /&gt;
A merge commit has two parent commits (leaving aside octopus commits). If you are not happy with the results of the merge, usually you want to revert&lt;br /&gt;
back to the parent that was on your branch. The reflog can be useful for checking this, but usually the parent of the botched merge on your branch is HEAD^.&lt;br /&gt;
&lt;br /&gt;
If you've pushed a commit to a public repo and then it later turns out that the commit wasn't a good idea, then you want &amp;quot;git revert&amp;quot; which creates the&lt;br /&gt;
reverse patch for a given commit. However, if you make a real hash out of a public repo you may still want git reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Backing it out might be a bit tricky, but you can rename your messed up branch out of the way easily with git branch -m oldname newname.&lt;br /&gt;
&lt;br /&gt;
To cherry-pick commits from your other repository into a branch you first fetch the branch you want to pick, e.g.&lt;br /&gt;
&lt;br /&gt;
'''git fetch theOtherRepro.git theotherbranch:suitableName/theotherbranch'''&lt;br /&gt;
&lt;br /&gt;
Or just '''theotherbranch:suitableOthername'''&lt;br /&gt;
&lt;br /&gt;
Then you can inspect the commits on it with '''git log -u theOtherRepro/theotherbranch'''&lt;br /&gt;
&lt;br /&gt;
And finally cherry-pick the one you want with '''git cherry pick &amp;lt;commitID&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It's a good idea to always use a clean local copy (e.g. git branch -t mrClean origin/master)  of origin/master to cherry-pick commits to before pushing to origin, and leave that branch around since the next time you just need to check it out, do '''git pull''' which will be a clean fast forward and '''cherry-pick''' and push again.&lt;br /&gt;
&lt;br /&gt;
== Resetting the repository ==&lt;br /&gt;
&lt;br /&gt;
If you find yourself having constant trouble with GIT and being contstantly asked to &amp;quot;rebase&amp;quot; your commitments, please don't delete anything, instead follow AndersG's instructions below.&lt;br /&gt;
&lt;br /&gt;
If you have a local clone of fgdata you have everything at hand - starting over is just creating a new local branch that tracks master, e.g.:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git branch my-new-master origin/master&lt;br /&gt;
git checkout my-new-master&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And update it to latest with (I recommend using --rebase in the future since that will keep your local commits after all up stream commits):&lt;br /&gt;
'''git pull --rebase'''&lt;br /&gt;
&lt;br /&gt;
Use&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git status&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
and&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
git diff&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
to investigate what ever uncommitted changes you may have in your tree. If you want to throw all such changes away, use '''git reset --hard'''&lt;br /&gt;
&lt;br /&gt;
Or you can use '''git stash''' to save them for later.&lt;br /&gt;
&lt;br /&gt;
If you have an old branch with your work and want to reapply selected commits to the new one, '''git cherry-pick''' is a useful command.&lt;br /&gt;
&lt;br /&gt;
== Updating old FGData gitorious clones ==&lt;br /&gt;
If you haven't updated your gitorious clone in a while, so that it significantly diverges from the main fgdata repository, pushing all changes would eat up lots of resources (bandwith, CPU) - thus, it is generally better to back up all important data/branches, and then delete your gitorious clone, to start over with a fresh clone - that way, you'll save tons of bandwidth and time. Cloning fgdata only takes a fraction of the time that would be required to push hundreds of megabytes of data separately, this is because cloning fgdata is a &amp;quot;local&amp;quot; operation for gitorious - so that bandwith is not the bottleneck.&lt;br /&gt;
&lt;br /&gt;
== Git tutorials and resources ==&lt;br /&gt;
* Git [http://git-scm.com/documentation documentation and tutorials]&lt;br /&gt;
* Git Basics [http://schacon.github.com/git/gittutorial.html]&lt;br /&gt;
* The [http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html Git Cheat Sheet] and the [http://jan-krueger.net/development/git-cheat-sheet-extended-edition Git Cheat Sheet Extended Edition]&lt;br /&gt;
* [http://wiki.github.com/bogolisk/egg Egg], a cool Git emacs mode.&lt;br /&gt;
* A guide to [http://nathanj.github.com/gitguide/ using Git on Windows]&lt;br /&gt;
* [http://kylecordes.com/2008/04/30/git-windows-go/ Git on Windows Go!] (Setting up msysgit on Windows)&lt;br /&gt;
* [http://sourceforge.net/projects/qgit qgit - interactive git repository viewer and frontend]&lt;br /&gt;
* Additional [[Resources WRT running git on Win32]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Git]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=79024</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=79024"/>
		<updated>2015-01-09T13:52:34Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{Progressbar|100}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || support intersecting linear features instead of clipping || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| gdalchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
*A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.  Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  A quick check shows that these materials do not use tc scaling, so we should be ok.  If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
*Linear feature intersections are working, and committed to terragear/master.  I'll post screenshots, and details of the algorithm shortly.&lt;br /&gt;
&lt;br /&gt;
*I want to refactor simgear/scene/tgdb/obj.cxx.  Currently, it is saving most of the .btg in an inefficient format, along side the scenegraph equivelent, before building trees, lights, and random buildings.  I am creating a new page here for discussion among interested parties: [[NewBTGLoader]]&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
&amp;lt;!-- {{WIP}} --&amp;gt;&lt;br /&gt;
For now, please see the following discussions to learn more about plans to procedurally build airports at run-time:&lt;br /&gt;
&lt;br /&gt;
* [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=18985&amp;amp;p=176132&amp;amp;hilit=#p176151 Scenery Draping]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/537CBB58.2000707%40mindcontract.com/#msg32364995 Airport Runtime Generation-5]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=78657</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=78657"/>
		<updated>2014-12-29T14:53:23Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{Progressbar|100}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || support intersecting linear features instead of clipping || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| gdalchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
*A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.  Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  A quick check shows that these materials do not use tc scaling, so we should be ok.  If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
*Linear feature intersections are working, and committed to terragear/master.  I'll post screenshots, and details of the algorithm shortly.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
&amp;lt;!-- {{WIP}} --&amp;gt;&lt;br /&gt;
For now, please see the following discussions to learn more about plans to procedurally build airports at run-time:&lt;br /&gt;
&lt;br /&gt;
* [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=18985&amp;amp;p=176132&amp;amp;hilit=#p176151 Scenery Draping]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/537CBB58.2000707%40mindcontract.com/#msg32364995 Airport Runtime Generation-5]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=78656</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=78656"/>
		<updated>2014-12-29T14:52:15Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Development Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{Progressbar|100}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || support intersecting linear features instead of clipping || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
*A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.  Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  A quick check shows that these materials do not use tc scaling, so we should be ok.  If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
*Linear feature intersections are working, and committed to terragear/master.  I'll post screenshots, and details of the algorithm shortly.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
&amp;lt;!-- {{WIP}} --&amp;gt;&lt;br /&gt;
For now, please see the following discussions to learn more about plans to procedurally build airports at run-time:&lt;br /&gt;
&lt;br /&gt;
* [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=18985&amp;amp;p=176132&amp;amp;hilit=#p176151 Scenery Draping]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/537CBB58.2000707%40mindcontract.com/#msg32364995 Airport Runtime Generation-5]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=78655</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=78655"/>
		<updated>2014-12-29T14:47:14Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{Progressbar|100}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || support intersecting linear features instead of clipping || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
&amp;lt;!-- {{WIP}} --&amp;gt;&lt;br /&gt;
For now, please see the following discussions to learn more about plans to procedurally build airports at run-time:&lt;br /&gt;
&lt;br /&gt;
* [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=18985&amp;amp;p=176132&amp;amp;hilit=#p176151 Scenery Draping]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/537CBB58.2000707%40mindcontract.com/#msg32364995 Airport Runtime Generation-5]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Talk:TerraGear_scenery_build_server&amp;diff=73820</id>
		<title>Talk:TerraGear scenery build server</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Talk:TerraGear_scenery_build_server&amp;diff=73820"/>
		<updated>2014-07-07T13:03:45Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Packaging (saiarcot895 ) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Server &amp;amp; Hosting (D-YETI) ==&lt;br /&gt;
By the way I personally would give some computing time and IO /Diskspace, at the server listed below, too, because I hope much more pople will benefit from it than running it for me alone. Since Terragear is not so easy to install and even with the gui doesn't always give the result I was expecting.&lt;br /&gt;
&lt;br /&gt;
* Intel® Core™ i5-4570 CPU @ 3.20GHz × 4 &lt;br /&gt;
* 32GB RAM&lt;br /&gt;
* SSD + RAID&lt;br /&gt;
* but rather slow Internet connection. (600kbit/s dn / 128kbit/s up)&lt;br /&gt;
&lt;br /&gt;
== Potential TerraGear Issues (psadro_gm) ==&lt;br /&gt;
An issue you will may hit is that some terragear tools don't behave very well when run at the same time (genapt and ogrdecode, in particular). this may work with two separate work directories, but I have not tried it. If using the same work directory, You can hit some directory / file creation collisions. To recitify these, I added a Boost global mutex so one can write at a time. With multiple users, this may become a bottleneck.&lt;br /&gt;
&lt;br /&gt;
== Packaging (saiarcot895 ) ==&lt;br /&gt;
'''Hooray:'''Obviously, one major part of this would involve installing/packaging SimGear and TerraGear as *.deb files.&lt;br /&gt;
This would greatly simplify the installation - we do have several instructions related to this, and even a script - so we could change the script to build SG/TG and then package things afterwards.&lt;br /&gt;
&lt;br /&gt;
Ideally, SimGear would be built in &amp;quot;headless&amp;quot; mode - i.e. minus all the OSG dependencies, no sound etc required: http://wiki.flightgear.org/Building_using_CMake#SimGear_Build_Options&lt;br /&gt;
&lt;br /&gt;
So we would first of all end up with something like &amp;quot;libsimgear-headless-dev&amp;quot; which could be used to build TerraGear.&lt;br /&gt;
The next step would be creating a package for TerraGear itself that depends on SimGear-headless-dev&lt;br /&gt;
&lt;br /&gt;
Once these two steps are completed, setting up TerraGear on Linux should become much more straightforward.&lt;br /&gt;
And we could use these packages to set up a TerraGear build server.&lt;br /&gt;
&lt;br /&gt;
All this will be based on TurnKeyLinux, which is a debian/wheezy based distro, intended for &amp;quot;remastering&amp;quot; - so that new virtual appliances can be easily created, and exported - so that others can install an ISO file to get a working TG setup.&lt;br /&gt;
&lt;br /&gt;
For now, I simply built SG headless (libsimgearcore) and installed it system-wide and it's working properly.&lt;br /&gt;
&lt;br /&gt;
But obviously it would be better to come up with packages for both, SG and TG (64bit).&lt;br /&gt;
Which would be useful for all debian/ubuntu users, not just this particular effort.&lt;br /&gt;
&lt;br /&gt;
Also, we would need to publish those packages, so that people only need to add the repo to download updates automatically.&lt;br /&gt;
&lt;br /&gt;
Overall, this would help greatly simplify TG deployment obviously, no matter if it's about having a build server or not.&lt;br /&gt;
&lt;br /&gt;
Looking at SG/FG, the best option seems to be to use cmake's cpack support to create packages: http://www.cmake.org/Wiki/CMake:CPackPackageGenerators&lt;br /&gt;
&lt;br /&gt;
:'''saiarcot895''': I think I can help here.&lt;br /&gt;
&lt;br /&gt;
:Part of the work may have been already done. We are distributing simgear in two packages (since there are two libraries): libsimgearcore and libsimgearscene. libsimgearcore doesn't have any graphical dependencies; it only depends on libc6. libexpat, libgcc1, libstdc++6, and zlib1g. The only drawback here is that the -dev package includes headers for both libraries, which would require both libraries be installed. Would libsimgearcore be equivalent to the library produced by SIMGEAR_HEADLESS?&lt;br /&gt;
&lt;br /&gt;
:'''saiarcot895''': I just uploaded the terragear package to my [https://launchpad.net/~saiarcot895/+archive/flightgear-edge flightgear-edge PPA]. It should be built and available in about 20-30 minutes for users of Ubuntu Precise, Quantal, and Trusty, but ''not'' Saucy (someone decided to place the Boost libraries on Saucy at a weird place, and so I get to find a fix to that). If you use Debian, I ''think'' you can download the debs for the Quantal version and use that.&lt;br /&gt;
&lt;br /&gt;
:: '''Hooray:''' There seems to be a dependency issue regarding libtiff according to [https://launchpadlibrarian.net/166371092/buildlog_ubuntu-precise-amd64.terragear_2.1.0~1196%2Bgitf089559-0ubuntu1~ppa1~precise1_MANUALDEPWAIT.txt.gz] ? --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 19:15, 15 February 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::'''saiarcot895''': Already on it. I got another dependency issue with libgdal (apparently, they changed the development package name right after Precise). [[User:Flyhigh|Flyhigh]] ([[User talk:Flyhigh|talk]]) 21:10, 15 February 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::: '''Hooray:''' Would it be a lot of work to set up launchpad such that it also provides a debian wheezy (64bit) package ? That's what I am currently using - otherwise, I'd need to change some things here - so it depends on the amount of work involved obviously. Thanks for looking into it! --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 04:09, 16 February 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::: '''saiarcot895''': Sorry for the delay. The Launchpad PPAs are Ubuntu-only, but I can easily create deb files for Wheezy. It's just a matter of publishing it somewhere. Also, I might have a patch to send regarding having an explicit #include &amp;lt;std::string&amp;gt; line in a file. Something is different in Precise that an explicit #include is necessary. Also, I finally fixed the annoying bug in Saucy; it was actually a bug in CGAL having the incorrect Boost location in its config file. [[User:Flyhigh|Flyhigh]] ([[User talk:Flyhigh|talk]]) 16:14, 8 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::: '''saiarcot895''': I've built simgear and terragear for the unstable/sid repo, and the packages are available at http://128.61.105.135/apt. To get it down to wheezy, however, I'll have to bump up (at least) OpenSceneGraph from unstable because wheezy still has 3.0. [[User:Flyhigh|Flyhigh]] ([[User talk:Flyhigh|talk]]) 15:30, 9 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
: '''Hooray:''' Sorry for not getting back to this earlier, thanks for the updates and all your work here. You raised a few good points - I am wondering if we can avoid the OSG issue in this particular instance for now, because we really only require the &amp;quot;headless&amp;quot; part of SimGear for TG, i.e. OSG should not even be required normally, right ? Otherwise, you're right that it would make sense to also provide deb packages for wheezy. But just for TG, I think, we don't need to touch any OSG related stuff ? --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 16:13, 9 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: '''saiarcot895''': You're right, I forgot about that. I've built simgear (in headless mode) for unstable and will build it for testing (jessie) and stable (wheezy), and will build terragear for all three releases once simgear is done. This should be done in a few hours. [[User:Flyhigh|Flyhigh]] ([[User talk:Flyhigh|talk]]) 21:36, 10 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: '''saiarcot895''': Simgear for all releases is done, and Terragear for unstable is done. However, Terragear on testing failed with an error in a boost include saying uintptr_t wasn't found...which doesn't make sense to me since boost is from the main Debian archives. [[User:Flyhigh|Flyhigh]] ([[User talk:Flyhigh|talk]]) 00:28, 11 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: '''Hooray:''' Thank you, I will be testing this shortly and have forwarded instructions to D-YETI who offered to provide hosting for this.--[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 17:32, 11 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
Ok, I added your URL to apt/source.lst on Deb Wheezy (64 bit) and ran apt-get update, when doing &amp;quot;apt-cache search&amp;quot; (simgear/terragear) your repo shows up correctly with the SG packages:&lt;br /&gt;
* core&lt;br /&gt;
* dev&lt;br /&gt;
* dbg&lt;br /&gt;
&lt;br /&gt;
And installation worked without problems, however terragear does not currently show up as a separate package yet, and also isn't listed [http://128.61.105.135/apt/dists/wheezy/main/binary-amd64/Packages in the files on the server] apparently ? --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 20:02, 11 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
: '''saiarcot895''': Refresh it and check it now. It should be there. [[User:Flyhigh|Flyhigh]] ([[User talk:Flyhigh|talk]]) 20:37, 11 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: '''Hooray:''' Confirmed,  this works now properly - just took 3 seconds to install TG here now on a fresh system, surprisingly not even SG was required (static build?) Very good job indeed! Now, we'll need to document this and spread the good news (article/newsletter). I'll also try to get in touch with D-YETI to see if he still can contribute hosting, which would also be a good way to host the actual TG packages. I guess we could ask Curt to set up a subdomain like packages.flightgear.org to host deb/ppa packages there for i386/amd64. Did you prepare those packages manually, or where you able to use cmake's cpack support for this ? I am asking because I guess it would be a good idea to strive towards using cmake/cpack for this, so that package creation can be automatically supported for SG/FG/TG for each upcoming release, without involving manual work - possibly by running things via the build server (nightly snapshots/prereleases).--[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 20:58, 11 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::: '''saiarcot895''': Strange; it has a dependency on libsimgearcore3.1.0, and it's not a static build. Ah well; if it works, you're fine. I did a mix of both manual stuff and scripts, but updates can be fully scripted (which is what I'm doing for my edge PPA). I used scripts from the debhelper package to generate the source package (I think you can get the source package and the debian folder using &amp;quot;sudo apt-get source terragear&amp;quot;), and then used sbuild to recreate a Debian Wheezy chroot and build it in that chroot. It looks like CPack asks for much of the same things as the debian/control file. Also, I'm not sure if CPack generates the .dsc and .changes file, which is necessary for publishing it to a repo. [[User:Flyhigh|Flyhigh]] ([[User talk:Flyhigh|talk]]) 21:33, 11 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
'''saiarcot895''': I'm getting a build failure with TerraGear git commit 25294ee and simgear git commit 1948198.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1144:9: error: 'class SGBinObject' has no member named 'set_pts_v'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1145:9: error: 'class SGBinObject' has no member named 'set_pts_n'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1146:9: error: 'class SGBinObject' has no member named 'set_pt_materials'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1147:9: error: 'class SGBinObject' has no member named 'set_tris_v'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1148:9: error: 'class SGBinObject' has no member named 'set_tris_n'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1149:9: error: 'class SGBinObject' has no member named 'set_tris_tc'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1150:9: error: 'class SGBinObject' has no member named 'set_tri_materials'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1151:9: error: 'class SGBinObject' has no member named 'set_strips_v'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1152:9: error: 'class SGBinObject' has no member named 'set_strips_n'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1153:9: error: 'class SGBinObject' has no member named 'set_strips_tc'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1154:9: error: 'class SGBinObject' has no member named 'set_strip_materials'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1155:9: error: 'class SGBinObject' has no member named 'set_fans_v'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1156:9: error: 'class SGBinObject' has no member named 'set_fans_n'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1157:9: error: 'class SGBinObject' has no member named 'set_fans_tc'&lt;br /&gt;
&lt;br /&gt;
/build/buildd/terragear-2.1.0~1200+git25294ee/src/Airports/GenAirports850/airport.cxx:1158:9: error: 'class SGBinObject' has no member named 'set_fan_materials'&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Does someone need to update the code here? (cause of error is SG commit 5b2b420) [[User:Flyhigh|Flyhigh]] ([[User talk:Flyhigh|talk]]) 01:27, 8 April 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
Please use git branch scenery/ws2.0 for building packages - it is the current stable branch.  We are working on new features that need some simgear coordination in master.  This work is temporarily stalled for Simgear feature freeze.  --[[User:Psadro gm|Psadro gm]] ([[User talk:Psadro gm|talk]]) 13:03, 7 July 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== TerraGear &amp;amp; TerraGear GUI (reeed) ==&lt;br /&gt;
this damned build server idea doesn't want to go away!&lt;br /&gt;
&lt;br /&gt;
very quickly now, to get me up to speed:&lt;br /&gt;
* is a hosting server available for our use right away? or who are the probable candidate(s)?&lt;br /&gt;
* who maintains the latest, compileable and functional TerraGear? &lt;br /&gt;
* Is the above TG packaged with Gijs' GUI? If not, which one is packaged?&lt;br /&gt;
&lt;br /&gt;
== TurnkeyLinux (Hooray) ==&lt;br /&gt;
* http://www.turnkeylinux.org/blog/introducing-tkldev&lt;br /&gt;
* http://www.turnkeylinux.org/forum/support/20120507/how-create-customized-appliance&lt;br /&gt;
* https://github.com/turnkeylinux-apps/tkldev/tree/master/docs&lt;br /&gt;
&lt;br /&gt;
== WebService / UI (F-JJTH, Gijs, Hooray, reeed ) ==&lt;br /&gt;
&lt;br /&gt;
{{Progressbar|40}} (proof-of-concept by F-JJTH)&lt;br /&gt;
&lt;br /&gt;
'''Gijs:'''It'd be nicer/better to have a web interface. That'll allow you to keep the interface and backend in sync (without asking people to recompile/redownload the GUI om each change), save people from downloading yet another tool and make it work/look the same on all systems.&lt;br /&gt;
&lt;br /&gt;
: '''Hooray:''' As I mentioned on the forum, I am not at all opposed to having a webservice, I just consider it much more straightforward to modify [[TerraGear GUI]] for now. if there's anybody interested in working on a web interface that would obviously be great, but short of that, I would simply modify TerraGear GUI to support two modes local (default) and remote (build server) over SSH. I already looked at the code briefly and the main issue is the amount of Qt code that runs locally, i.e. to download stuff for example - if that could be moved out into external programs, preferably part of TerraGear itself, then it would be trivial to support both, local AND remote TG installations. Currently, there's just too much stuff directly done, without calling external tools - so that would need to be factored out.&lt;br /&gt;
: Overall, the TerraGear GUI is not such a complex code base, so I am not sure if keeping the frontend/backends in sync is such a huge issue ?? I mean, people ALREADY need to have a matching TG/TGGUI versions after all ...&lt;br /&gt;
: I am certainly not going to stop anybody from coming up with a webservice - it's just something that I am probably not going to work on anytime soon - while modifying TGGUI accordingly would just take a few hours and involve well-understood steps. &lt;br /&gt;
: So I wasn't thinking of forking TGGUI, but more about extending it to support local AND remote installations - selected/configured during startup.&lt;br /&gt;
&lt;br /&gt;
: Obviously you are much more familiar with the code in question here - but based on what I've seen, it would not be such a difficult undertaking to turn TGGUI into a &amp;quot;remote control&amp;quot; for a TG build server setup.&lt;br /&gt;
&lt;br /&gt;
: If frontend changes are such an issue, I would actually suggest to get rid of the hardcoded GUI and use Qt's scripting support for those *.ui files instead - that would allow you to automatically download QtScript while booting.&lt;br /&gt;
&lt;br /&gt;
: Finally, coming up with a working web service is in my opinion more difficult than using SSH to teach TGGUI to run a handful of commands remotely and fetch the results via SFTP - so yeah, I am kinda lazy here&lt;br /&gt;
&lt;br /&gt;
== Standalone GUI (via SSH) ==&lt;br /&gt;
&lt;br /&gt;
If the consensus should end up being not to use [[TerraGear GUI]], the most straightforward option for coming up with a simple GUI would be Python using SSH and GUI bindings: &lt;br /&gt;
&lt;br /&gt;
* http://docs.fabfile.org/en/1.4.2/index.html&lt;br /&gt;
* http://hackerific.net/2009/02/06/paramiko-scripting-ssh-with-python/&lt;br /&gt;
* http://jessenoller.com/2009/02/05/ssh-programming-with-paramiko-completely-different/&lt;br /&gt;
* https://github.com/paramiko/paramiko&lt;br /&gt;
* http://www.pythonforbeginners.com/code-snippets-source-code/ssh-connection-with-python/&lt;br /&gt;
* http://sourceforge.net/projects/pexpect/&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=71773</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=71773"/>
		<updated>2014-05-23T14:02:00Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{Progressbar|100}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || support intersecting linear features instead of clipping || {{Progressbar|50}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
&amp;lt;!-- {{WIP}} --&amp;gt;&lt;br /&gt;
For now, please see the following discussions to learn more about plans to procedurally build airports at run-time:&lt;br /&gt;
&lt;br /&gt;
* [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=18985&amp;amp;p=176132&amp;amp;hilit=#p176151 Scenery Draping]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/537CBB58.2000707%40mindcontract.com/#msg32364995 Airport Runtime Generation-5]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=World_Scenery_3.0_roadmap&amp;diff=70103</id>
		<title>World Scenery 3.0 roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=World_Scenery_3.0_roadmap&amp;diff=70103"/>
		<updated>2014-04-28T13:11:18Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: Psadro gm moved page World Scenery 3.0 roadmap to Terragear roadmap: This roadmap is just for the terragear toolchain, not the actual scenery&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Terragear roadmap]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=70102</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=70102"/>
		<updated>2014-04-28T13:11:02Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: Psadro gm moved page World Scenery 3.0 roadmap to Terragear roadmap: This roadmap is just for the terragear toolchain, not the actual scenery&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
{{WIP}}&lt;br /&gt;
&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=70098</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=70098"/>
		<updated>2014-04-27T21:48:56Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=too few&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
{{WIP}}&lt;br /&gt;
&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=70097</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=70097"/>
		<updated>2014-04-27T20:58:17Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|80}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
{{WIP}}&lt;br /&gt;
&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=70096</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=70096"/>
		<updated>2014-04-27T20:52:58Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || elevation source || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway relative texture coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|50}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass linear feature color and black border info in color btg section || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
{{WIP}}&lt;br /&gt;
&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=69326</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=69326"/>
		<updated>2014-03-28T01:37:58Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|50}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
{{WIP}}&lt;br /&gt;
&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=69325</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=69325"/>
		<updated>2014-03-28T01:34:15Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* preview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|50}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|center|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
{{WIP}}&lt;br /&gt;
&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=69324</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=69324"/>
		<updated>2014-03-28T01:30:07Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Development Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|50}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
== preview ==&lt;br /&gt;
&lt;br /&gt;
I'm getting close to a merge request for simgear changes so we can add bump maps and 'dirty maps' (i.e. skid marks) to the runways and taxiways that allow the same map to be used on both the draped details, and the pavement.&lt;br /&gt;
&lt;br /&gt;
[[File:Runway, and taxiway texture atlases.jpg|thumb|besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.]]&lt;br /&gt;
&lt;br /&gt;
== Runtime Airport Generation ==&lt;br /&gt;
{{WIP}}&lt;br /&gt;
&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5331A2EC.8010701%40mindcontract.com/#msg32142890 Airport Runtime Generation-1]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/CAPi24C0700ezXOU5GQ8A9h8udiwOWa5xXG02kcYaftZS-yuq-Q%40mail.gmail.com/#msg32143720 Airport Runtime Generation-2]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/0A90AC72-7461-4CC4-A5A7-6FD36AD48394%40mac.com/#msg32143737 Airport Runtime Generation-3]&lt;br /&gt;
* [http://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/5332EB0C.9060906%40mindcontract.com/#msg32147247 Airport Runtime Generation-4]&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=File:Runway,_and_taxiway_texture_atlases.jpg&amp;diff=69323</id>
		<title>File:Runway, and taxiway texture atlases.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=File:Runway,_and_taxiway_texture_atlases.jpg&amp;diff=69323"/>
		<updated>2014-03-28T01:29:10Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: User created page with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=besides the taxiway, runway, grass (and borders) - all markings on the runways and taxiways use a single texture.  This saves the number of state changes needed - improving performance.}}&lt;br /&gt;
|date=2014-03-27 21:27:09&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:Psadro gm|Psadro gm]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other_versions=&lt;br /&gt;
|other_fields=&lt;br /&gt;
}}&lt;br /&gt;
{{Location dec|0|0}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-3.0}}&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=69044</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=69044"/>
		<updated>2014-03-24T14:16:42Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{Progressbar|10}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|50}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68909</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68909"/>
		<updated>2014-03-20T01:27:57Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: /* Progress */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|60}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68908</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68908"/>
		<updated>2014-03-20T01:25:21Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]], [[Programming Resources#C.2B.2B_Courses|C++]], [[Developing using CMake]] }}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
== Progress ==&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|30}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|40}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Development Notes ==&lt;br /&gt;
&lt;br /&gt;
A fairly large snag while developing secondary texture coordinates : tc scaling is done per material, and the scaling needs to be looked up by material name.&lt;br /&gt;
Currently, the btg file stores lists of triangles/strips/fans under a common material name.  A draped material may lie on multiple underlying materials.  &lt;br /&gt;
&lt;br /&gt;
In the short term, my plan is to ignore texture coordinate scaling.  The main use case for this is the linear features over airport pavements and runways.  &lt;br /&gt;
A quick check shows that these materials do not use tc scaling, so we should be ok.&lt;br /&gt;
&lt;br /&gt;
If we get to the point where we drape roadways over general terrain, however, we will need a real solution.&lt;br /&gt;
&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68813</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68813"/>
		<updated>2014-03-18T01:22:32Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: getting there&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]]}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|30}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|30}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68804</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68804"/>
		<updated>2014-03-17T00:01:55Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]]}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|30}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68802</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68802"/>
		<updated>2014-03-16T20:28:03Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Mentored Volunteer Effort&lt;br /&gt;
|developers=psadro_gm, papillon81&lt;br /&gt;
|mentors=psadro_gm (get in touch to learn more)&lt;br /&gt;
|skills=[[TerraGear]]}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{Progressbar|30}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{Progressbar|20}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Terra}}&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68775</id>
		<title>TerraGear roadmap</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_roadmap&amp;diff=68775"/>
		<updated>2014-03-15T13:47:20Z</updated>

		<summary type="html">&lt;p&gt;Psadro gm: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Template:Non-stable|version=3.x|progress=10}}&lt;br /&gt;
&lt;br /&gt;
World Scenery 2.0 has been released.  After 2 1/2 years of development, the tool-chain is considered stable.  Although WS2.0 will continue to receive updates, and bug fixes, I'd like to start planning for the next major overhaul.&lt;br /&gt;
&lt;br /&gt;
For World Scenery 3.0, flightgear will have a LOD system for the underlying mesh.  The good news is, this new system is already in simgear (thanks to Mathias), and has been tested with 'hand stitched' .btg files.  So our job, is to update the tools to be able to generate the scenery automatically.&lt;br /&gt;
&lt;br /&gt;
Ideally, we would like to have at least 4 levels of detail.  &lt;br /&gt;
&lt;br /&gt;
The highest detail level being identical to WS2.0.&amp;lt;br&amp;gt;&lt;br /&gt;
The second level of detail maintains the same elevation mesh, but removes line data from both airports and terrain.  Airports are still smoothed, and cut in to the terrain.&amp;lt;br&amp;gt;&lt;br /&gt;
The third level of detail is a simplified mesh, with simplified airports (no bezier interpolation) created as landclass polys (runway, taxiway, and grass).  To be determined, is how to simplify the landclass polygons.  possibly combining a small area landclass with it's neighbor.&amp;lt;br&amp;gt;&lt;br /&gt;
Optional fourth level and more LODs would be refinements to the third - lower res mesh, and more landclass combining)&amp;lt;br&amp;gt;&lt;br /&gt;
The lowest detail level being a sphere with a global texture.&lt;br /&gt;
&lt;br /&gt;
In the terragear toolchain, there are 3 main directories: Data, Work, and Output.  The Work directory structure will be overhauled to handle arbitrary tile sizes.  The output directory needs to match what simgear .SPT files expect.&lt;br /&gt;
&lt;br /&gt;
After conversing with i4dnf, some extra ideas have come up to fix some of the long standing scenery issues.  As we move to a new scenery structure, that may not be 100% backward compatible, we should be able to add some additional capabilities to the .btg file format.  NOTE: the .btg file format is extensible, so this may not require major changes and 'could' be backward compatible.  Experimentation needed:&lt;br /&gt;
&lt;br /&gt;
The first idea is separating the runway markings from the pavement.  We have this somewhat working now, but the pavement shader is completely clueless about the marking shader.  and bump mapping / dirtying effects cannot be normalized between the line and pavement - leading to visual artifacts.&lt;br /&gt;
The marking shader needs to know the underlying pavement origin.  To do this, the .BTG file needs to support multiple texture coordinates.  1 primary set to look up the line texture in the texture atlas, and another set relative to the origin of the pavement.  i4dnf would also like to add dirty / tire marks to the runways.  To do this, he needs to know where in the runway polygon, the thresholds are.  In openGL, a vertex attribute would be passed to the shader to relay the information.  The btg format should be expanded to allow vertex indices (of a triagle) to have attributes.&lt;br /&gt;
&lt;br /&gt;
The second idea is to use multiple tcs to allow landclass shaders to know where in a tile they are located.  If we have a per tile raster image with the landclasses encoded, then the borders between landclasses can be smoothed / modified by the shaders.  We could also encode regional definitions into the same raster image to support irregular shaped region encoding.  probably 8 bits for landclass, and 8 bits for region is enough.&lt;br /&gt;
&lt;br /&gt;
It would be nice to have all landclass images and this single per tile image to all have the same resolution, so we could use a texture array.  This allows us to draw an entire tile (other than linear road / rail / stream ) in one openGL draw call.&lt;br /&gt;
&lt;br /&gt;
The below table is my first attempt at a work item breakdown.  I imagine we'll need to add / remove entries as work progresses.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Tool !! Work item !! Progress &lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file multiple tc support || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| simgear || btg file vertex attribute support || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || separate .btg for line data || {{Progressbar|90}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || runway texture atlas || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || linear and runway marking triangle vertices have texture coordinates of underlying pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || pass runway touchdown point as vertex attribute || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
|-genapts || support no bezier - low level detail for pavements || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| genapts || airport as landclass || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtchop || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| imgchop || new tool to support per tile raster images based on a global image.  Could be used to chop i4dnf's ocean depth image || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| hgtfit || port from terra to CGAL mesh simplification (optional / cleanup) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| ogrdecode || support arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || add tile skirts to hide LOD gaps || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of landclass data || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate per tile raster image of region data ( can be combined with landclass image to use just 1 texture unit) || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || generate landclass triangles with geodetic texture coordinates and per tile origin coordinates || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || arbitrary tile sizes / directory structure || {{pending}}&lt;br /&gt;
|-&lt;br /&gt;
| tgconstruct || .spt file generation || {{pending}}&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Psadro gm</name></author>
	</entry>
</feed>