FlightGear Newsletter September 2012: Difference between revisions

Jump to navigation Jump to search
Summarize random building changes
No edit summary
(Summarize random building changes)
Line 11: Line 11:
Shortly after the 2.8 release, a number of users reported severe memory growth issues related to a new feature: [[Random Buildings]].
Shortly after the 2.8 release, a number of users reported severe memory growth issues related to a new feature: [[Random Buildings]].


Unfortunately, the buildings are generated when the tiles are loaded, and it is this that causes the memory occupancy problems rather than visibility itself (subject to big view ranges causing the loading of more tiles).  Aggressively limiting the maximum available visibility range might help, if it's causing more tiles to be loaded, but it is very dependent on the amount of Urban and Town terrain.
This was a side-effect of the way in which the buildings were created during tile loading. Stuart has now completely changed the way in which random buildings are generated and displayed to reduce the memory occupancy by using a shader-based scheme similar to random trees.  You should now see significantly lower memory occupancy (500 - 2GB less depending on area and density) when running with random buildings enabled.
 
For performance reasons, all the buildings within a tile are a single object currently. The memory capacity could be addressed by changing the implementation to something closer to the trees, where a (relatively) small number of buildings are instantiated at different locations.  I don't know what this would do for performance though.
 
Stuart has now managed to get a prototype running using an instantiation of a shared geometry rather than a huge single object per tile.
 
So far the results are promising.  Stuart's standard test is at KSFO with the c172p, waiting until the intial set of tiles is loaded with standard weather conditions (e.g. no excessive visibility). With random buildings switched off  FG uses ~1GB memory.  With v2.8.0
random buildings, it's 2GB.  With instantiated buildings at present it is 1.5GB.
At KLAX, it's down even further, from 2.7GB to 1.6GB. So far, without any frame-rate impact.
 
This work is now checked into next/master.  You'll need an updated simgear and data to see any effect.
 
Basically, the design has been altered to use a scheme very similar to that of the random trees, where there are a small number of buildings created, and then instantiated multiple times.
 
The technique relies on a vertex shader, as the final position and rotation of the building are passed in on the gl_Color vectorThis in turn has meant that I've been forced to create new version of various vertex shaders.  It might be possible to clean that up by having a new parameter to existing shaders indicating that position/rotation information is in gl_Color
 
There are three known regressions from the previous implementation:
* The reflection map appears to be broken, and is currently switched off. (this might be because the binormal or tangent are not being calculated correctly.)
* The buidings do not cast shadows in Rembrandt, though other objects _do_ cast shadows on the buildings. I don't know the reason for this.
* At high building densities and certain angles of view, one can see gaps in the building placement where the edges of the scenery triangles go.  This is unfortunately inevitable, as we have less sizing information during placement.
 
You should now see significantly lower memory occupancy (500 - 2GB less depending on area and density) when running with random buildings enabled.  This will obviously be available in the next FG release as well.
 
 
Feedback/comments appreciated as always.


=== Project Rembrandt ===
=== Project Rembrandt ===

Navigation menu