Scenery LoD: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (link to PagedLOD)
(+-lead section; +- Minor cleanup; +cat: Scenery)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
Given the large distances that need to drawn in FlightGear, we use Level of Detail (LoD) to control what is rendered at what distance to ensure frame-rates are reasonable.
Given the large distances that need to drawn in FlightGear, we use '''Level of Detail (LoD)''' to control how much of the scenery that is rendered at what distance to ensure frame-rates are reasonable.


==How LoD is Controlled==
== How LoD is Controlled ==
{{See also|Level Of Detail (LOD) Ranges}}


There are three ranges that can be configured:
There are three ranges that can be configured:
* Detailed - the range at which detailed scenery objects are displayed.  Default value is 1500m.
 
* Rough - the range at which trees are displayed.  Note that to avoid forests suddenly appearing, trees are slowly faded in from 2xRough range.  Default value 9km.
; Detailed
* Bare - the range at which the underlying terrain mesh is displayed.  Default value 30km
: The range at which detailed scenery objects are displayed.  Default value is 1500 m.
 
; Rough
: The range at which trees are displayed.  Note that to avoid forests suddenly appearing, trees are slowly faded in from 2xRough range.  Default value 9 km.
 
; Bare
: The range at which the underlying terrain mesh is displayed.  Default value 30 km.


Scenery LoD is controlled from the '''View->Adjust LOD Ranges''' menu item in the simulator.   
Scenery LoD is controlled from the '''View->Adjust LOD Ranges''' menu item in the simulator.   
Line 12: Line 19:
It should always be the case that Detailed < Rough < Bare.  So in the dialog the Rough and Bare ranges are controlled as a delta on top of the Detailed range.  Specifically the following properties  
It should always be the case that Detailed < Rough < Bare.  So in the dialog the Rough and Bare ranges are controlled as a delta on top of the Detailed range.  Specifically the following properties  


* /sim/rendering/static-lod/detailed - Defaults value 1500m
* <code>/sim/rendering/static-lod/detailed</code> - Defaults value 1500m
* /sim/rendering/static-lod/rough-delta - Defaults value 7500
* <code>/sim/rendering/static-lod/rough-delta</code> - Defaults value 7500
* /sim/rendering/static-lod/bare-delta - underlying terrain mesh.  Default value 21000
* <code>/sim/rendering/static-lod/bare-delta</code> - underlying terrain mesh.  Default value 21000


So the ranges are calculated as follows:
So the ranges are calculated as follows:
* Detailed = /sim/rendering/static-lod/detailed
* Detailed = <code>/sim/rendering/static-lod/detailed</code>
* Rough = /sim/rendering/static-lod/rough = /sim/rendering/static-lod/detailed + /sim/rendering/static-lod/rough-delta
* Rough = <code>/sim/rendering/static-lod/rough</code> = <code>/sim/rendering/static-lod/detailed</code> + <code>/sim/rendering/static-lod/rough-delta</code>
* Bare = /sim/rendering/static-lod/bare = /sim/rendering/static-lod/detailed + /sim/rendering/static-lod/rough-delta + /sim/rendering/static-lod/bare-delta
* Bare = <code>/sim/rendering/static-lod/bare</code> = <code>/sim/rendering/static-lod/detailed</code> + <code>/sim/rendering/static-lod/rough-delta</code> + <code>/sim/rendering/static-lod/bare-delta</code>


==How LoD works==
== How LoD works ==
{{See also|PagedLOD}}
{{See also|PagedLOD}}
A scenery tile contains all three components - an underlying terrain mesh, trees (defined by the materials definition), and objects defined by the STG file for the tile.
A scenery tile contains all three components - an underlying terrain mesh, trees (defined by the materials definition), and objects defined by the STG file for the tile.


The set of scenery tiles that are to be loaded/unloaded are re-calculated each time the view changes to a different tile location (aka "bucket"), and based on the Bare range.  If /sim/tile-cache/enable=true, then a cache is used to keep the 100 most recent tiles loaded.  Otherwise, they are unloaded as soon a they go out of range.
The set of scenery tiles that are to be loaded/unloaded are re-calculated each time the view changes to a different tile location (aka "bucket"), and based on the Bare range.  If <code>/sim/tile-cache/enable=true</code>, then a cache is used to keep the 100 most recent tiles loaded.  Otherwise, they are unloaded as soon a they go out of range.


The terrain mesh is loaded in a separate thread, and FlightGear creates PagedLoD objects for the trees and objects.  The PagedLoD is a piece of OSG code that will automatically load the required scenery when it comes into view and within the required range, then unload it if required when it goes out of view/range.  So as you approach a tile, firstly the terrain mesh will be loaded, then the trees and then the scenery objects.  
The terrain mesh is loaded in a separate thread, and FlightGear creates PagedLoD objects for the trees and objects.  The PagedLoD is a piece of OSG code that will automatically load the required scenery when it comes into view and within the required range, then unload it if required when it goes out of view/range.  So as you approach a tile, firstly the terrain mesh will be loaded, then the trees and then the scenery objects.  
Line 31: Line 39:
Obviously we need to unload objects otherwise memory usage will increase continually.  OSG keeps this in check by limiting the number of PagedLoDs that are loaded at any time.  To keep below the limit, it has a concept of object "expiring" after they have been out of view/range for a period of time.  Once an object has expired
Obviously we need to unload objects otherwise memory usage will increase continually.  OSG keeps this in check by limiting the number of PagedLoDs that are loaded at any time.  To keep below the limit, it has a concept of object "expiring" after they have been out of view/range for a period of time.  Once an object has expired


The way in which PagedLoD objects are unloaded is controlled through two properties:


The way in which PagedLoD objects are unloaded is controlled through two properties
* <code>/sim/rendering/plod-minimum-expiry-time-secs</code> - This is the minimum time before a PagedLoD will be unloaded (expired).  Default value is 180 seconds.
* /sim/rendering/plod-minimum-expiry-time-secs - This is the minimum time before a PagedLoD will be unloaded (expired).  Default value is 180 seconds.
* <code>/sim/rendering/max-paged-lod</code> - This is the maximum number of loaded PagedLoD nodes that OSG will keep.  Once this limit is reached, OSG will unload expired PagedLoD nodes, starting with "inactive" ones - those out of view.  Default value is 200.
* /sim/rendering/max-paged-lod - This is the maximum number of loaded PagedLoD nodes that OSG will keep.  Once this limit is reached, OSG will unload expired PagedLoD nodes, starting with "inactive" ones - those out of view.  Default value is 200.


Note that PagedLoD nodes are also used for AI aircraft, so there can be interactions in behaviour with high numbers of AI aircraft and scenery tiles.
Note that PagedLoD nodes are also used for AI aircraft, so there can be interactions in behaviour with high numbers of AI aircraft and scenery tiles.
[[Category:Scenery|LoD]]

Latest revision as of 22:51, 23 August 2020

Given the large distances that need to drawn in FlightGear, we use Level of Detail (LoD) to control how much of the scenery that is rendered at what distance to ensure frame-rates are reasonable.

How LoD is Controlled

There are three ranges that can be configured:

Detailed
The range at which detailed scenery objects are displayed. Default value is 1500 m.
Rough
The range at which trees are displayed. Note that to avoid forests suddenly appearing, trees are slowly faded in from 2xRough range. Default value 9 km.
Bare
The range at which the underlying terrain mesh is displayed. Default value 30 km.

Scenery LoD is controlled from the View->Adjust LOD Ranges menu item in the simulator.

It should always be the case that Detailed < Rough < Bare. So in the dialog the Rough and Bare ranges are controlled as a delta on top of the Detailed range. Specifically the following properties

  • /sim/rendering/static-lod/detailed - Defaults value 1500m
  • /sim/rendering/static-lod/rough-delta - Defaults value 7500
  • /sim/rendering/static-lod/bare-delta - underlying terrain mesh. Default value 21000

So the ranges are calculated as follows:

  • Detailed = /sim/rendering/static-lod/detailed
  • Rough = /sim/rendering/static-lod/rough = /sim/rendering/static-lod/detailed + /sim/rendering/static-lod/rough-delta
  • Bare = /sim/rendering/static-lod/bare = /sim/rendering/static-lod/detailed + /sim/rendering/static-lod/rough-delta + /sim/rendering/static-lod/bare-delta

How LoD works

A scenery tile contains all three components - an underlying terrain mesh, trees (defined by the materials definition), and objects defined by the STG file for the tile.

The set of scenery tiles that are to be loaded/unloaded are re-calculated each time the view changes to a different tile location (aka "bucket"), and based on the Bare range. If /sim/tile-cache/enable=true, then a cache is used to keep the 100 most recent tiles loaded. Otherwise, they are unloaded as soon a they go out of range.

The terrain mesh is loaded in a separate thread, and FlightGear creates PagedLoD objects for the trees and objects. The PagedLoD is a piece of OSG code that will automatically load the required scenery when it comes into view and within the required range, then unload it if required when it goes out of view/range. So as you approach a tile, firstly the terrain mesh will be loaded, then the trees and then the scenery objects.

Obviously we need to unload objects otherwise memory usage will increase continually. OSG keeps this in check by limiting the number of PagedLoDs that are loaded at any time. To keep below the limit, it has a concept of object "expiring" after they have been out of view/range for a period of time. Once an object has expired

The way in which PagedLoD objects are unloaded is controlled through two properties:

  • /sim/rendering/plod-minimum-expiry-time-secs - This is the minimum time before a PagedLoD will be unloaded (expired). Default value is 180 seconds.
  • /sim/rendering/max-paged-lod - This is the maximum number of loaded PagedLoD nodes that OSG will keep. Once this limit is reached, OSG will unload expired PagedLoD nodes, starting with "inactive" ones - those out of view. Default value is 200.

Note that PagedLoD nodes are also used for AI aircraft, so there can be interactions in behaviour with high numbers of AI aircraft and scenery tiles.