Board index FlightGear Development Scenery

No go airports for weak gpus ...

Questions and discussion about enhancing and populating the FlightGear world.

Re: No go airports for weak gpus ...

Postby Philosopher » Tue Feb 03, 2015 3:27 am

Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: No go airports for weak gpus ...

Postby clrCoda » Tue Feb 03, 2015 3:36 am

Thank you for posting so quickly Philosopher.

To alleviate my confusion: This is not Scenery2.0?

Ray
Ray St. Marie
clrCoda
 
Posts: 1225
Joined: Wed Apr 07, 2010 12:04 pm

Re: No go airports for weak gpus ...

Postby Philosopher » Tue Feb 03, 2015 3:41 am

That is correct, it's scenery last changed for the 2.12 version of FG (but compatible with pretty much all versions), which is part of the first generation of scenery.... whereas "Scenery 2.0" is compatible with FG 3.0+. It's probably explained somewhere on the wiki too, but I couldn't find it quickly.
Philosopher
 
Posts: 1593
Joined: Sun Aug 12, 2012 7:29 pm

Re: No go airports for weak gpus ...

Postby Hooray » Tue Feb 03, 2015 3:48 am

The "best" solution for people on old/weak hardware is what psadro_gm said previously:
psadro_gm wrote in Tue Aug 12, 2014 3:47 pm:I'd like to see both LOD range and user settable masks in the .stg file.


This would work analogous to our existing "draw-masks", (as per the minimal startup profile detailed on the wiki) - basically, more and more features would get dedicated properties with draw-masks to disable/enable rendering and optionally customize things - this isn't too difficult to do, and it doesn't necessarily involve touching tons of STG/BTG files - it's mainly a change that would involve SimGear/FG, so that buildings (and other heavy stuff) would be loaded into dedicated sub-scene graph that can be easily disabled using an osg::switch node - here's a code snippet demonstrating the concept by disabling rendering of the sun/sky.

Hooray wrote:I've used these for doing some more profiling on the netbook that I mentioned to help better understand where performance is spent, not just in terms of subsystems, but also at the rendering level (PUI!) -this is line with James' original "draw-masks" commit and uses the same property location for new draw masks - I think this could be a useful extension for various reasons, because we can simply keep stuff disabled while booting - and also use it for troubleshooting.

I am probably going to add a few more draw-masks, also for Canvas - not because I believe that we need to run FG without Canvas :lol: , but to provide stats/evidence for benchmarking purposes, i.e. we can tell people to use those draw masks to disable all CanvasGUI/CanvasScenery/CanvasAircraft rendering and watch their frame rate/spacing accordingly.

For the "fgcanvas" mode, this just means that sky/sunlight and PUI rendering can be completely disabled for even better performance/appearance, i.e. Nasal/Canvas are up and running in under 5 seconds here normally. Likewise, this is a good thing for debugging and regression testing, i.e. to keep certain rendering features completely disabled - for example so that only Canvas related OSG/OpenGL calls show up in the gDebugger profile, i.e. much more fine-grained info, without having to patch FG.

Code: Select all
diff --git a/src/Viewer/renderer.cxx b/src/Viewer/renderer.cxx
index 2c4d5c7..d3ba9a6 100644
--- a/src/Viewer/renderer.cxx
+++ b/src/Viewer/renderer.cxx
@@ -82,7 +82,10 @@
 #include <simgear/scene/tgdb/pt_lights.hxx>
 #include <simgear/scene/tgdb/userdata.hxx>
 #include <simgear/structure/OSGUtils.hxx>
+
 #include <simgear/props/props.hxx>
+#include <simgear/props/propertyObject.hxx>
+
 #include <simgear/timing/sg_time.hxx>
 #include <simgear/ephemeris/ephemeris.hxx>
 #include <simgear/math/sg_random.h>
@@ -380,9 +383,60 @@ public:
 
   static bool scenery_enabled;
 };
-
 bool FGScenerySwitchCallback::scenery_enabled = false;
 
+// update callback for the sky switch node
+struct FGSkySwitchCallback : public osg::NodeCallback {
+  FGSkySwitchCallback() : _enabled("/sim/rendering/draw-mask/sky") {}
+
+  virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
+  {
+    assert(dynamic_cast<osg::Switch*>(node));
+    osg::Switch* sw = static_cast<osg::Switch*>(node);
+
+    sw->setValue(0, _enabled);
+    if (!_enabled)
+      return;
+    traverse(node, nv);
+  }
+private:
+simgear::PropertyObject<bool> _enabled;
+};
+
+// update callback for the GUI (old) switch node
+struct FGOldGUISwitchCallback : public osg::NodeCallback {
+  FGOldGUISwitchCallback() : _enabled("/sim/rendering/draw-mask/old-gui") {}
+  virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
+  {
+    assert(dynamic_cast<osg::Switch*>(node));
+    osg::Switch* sw = static_cast<osg::Switch*>(node);
+
+    sw->setValue(0, _enabled);
+    if (!_enabled)
+      return;
+    traverse(node, nv);
+  }
+private:
+simgear::PropertyObject<bool> _enabled;
+};
+
+// update callback for the GUI (old) switch node
+struct FGSunlightSwitchCallback : public osg::NodeCallback {
+  FGSunlightSwitchCallback() : _enabled("/sim/rendering/draw-mask/sunlight") {}
+  virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
+  {
+    assert(dynamic_cast<osg::Switch*>(node));
+    osg::Switch* sw = static_cast<osg::Switch*>(node);
+
+    sw->setValue(0, _enabled);
+    if (!_enabled)
+      return;
+    traverse(node, nv);
+  }
+private:
+simgear::PropertyObject<bool> _enabled;
+};
+
 FGRenderer::FGRenderer() :
     _sky(NULL),
     _ambientFactor( new osg::Uniform( "fg_SunAmbientColor", osg::Vec4f() ) ),
@@ -1483,7 +1537,8 @@ FGRenderer::setupView( void )
     lightSource->setLocalStateSetModes(osg::StateAttribute::ON);
     lightSource->setUpdateCallback(new FGLightSourceUpdateCallback);
     _viewerSceneRoot->addChild(lightSource);
-   
+
+
     // we need a white diffuse light for the phase of the moon
     osg::ref_ptr<LightSource> sunLight = new osg::LightSource;
     sunLight->setName("sunLightSource");
@@ -1501,7 +1556,11 @@ FGRenderer::setupView( void )
     sunLight->addChild(skyGroup);
     
     if ( _classicalRenderer ) {
-        _root->addChild(sunLight);
+    osg::Switch *sw = new osg::Switch;
+    sw->setName("sunLightSwitch");
+    sw->setUpdateCallback( new FGSunlightSwitchCallback);
+    sw->addChild(sunLight);
+    _root->addChild(sw);
     }
   
     osg::Group* sceneGroup = globals->get_scenery()->get_scene_graph();
@@ -1531,19 +1590,25 @@ FGRenderer::setupView( void )
     stateSet->setAttributeAndModes(fog);
     stateSet->setUpdateCallback(new FGFogEnableUpdateCallback);
 

     // plug in the GUI
     osg::Camera* guiCamera = getGUICamera(CameraGroup::getDefault());
     if (guiCamera) {
+      osg::Switch* sw = new osg::Switch;
+      sw->setName("OldGUISwitch");
+      sw->setUpdateCallback(new FGOldGUISwitchCallback);
+
       osg::Geode* geode = new osg::Geode;
       geode->addDrawable(new SGHUDDrawable);
       geode->addDrawable(new SGPuDrawable);
+      sw->addChild(geode);
+      sw->addChild( FGPanelNode::create2DPanelNode() );
 
       // Draw first (eg. before Canvas GUI)
-      guiCamera->insertChild(0, geode);
-      guiCamera->insertChild(0, FGPanelNode::create2DPanelNode());
+      guiCamera->insertChild(0, sw);
     }
     
-    osg::Switch* sw = new osg::Switch;
+    osg::Switch *sw = new osg::Switch;
     sw->setName("scenerySwitch");
     sw->setUpdateCallback(new FGScenerySwitchCallback);
     sw->addChild(_root.get());
@@ -1552,8 +1617,13 @@ FGRenderer::setupView( void )
     // because, in theory, they don't want the same default state set
     // as the rest of the scene. This may not be true in practice.
     if ( _classicalRenderer ) {
-      _viewerSceneRoot->addChild(_sky->getCloudRoot());
-      _viewerSceneRoot->addChild(FGCreateRedoutNode());
+   sw = new osg::Switch;
+       sw->setName("skySwitch");
+       sw->setUpdateCallback(new FGSkySwitchCallback);
+        sw->addChild(_sky->getCloudRoot());
+        sw->addChild(FGCreateRedoutNode());
+
+        _viewerSceneRoot->addChild(sw);
     }
   
     // Attach empty program to the scene root so that shader programs
@@ -1625,7 +1695,8 @@ FGRenderer::update( ) {
                           : osg::Vec4(0, 0, 0, 1);
     camera->setClearColor(clear_color);
 
-    updateSky();
+    if (fgGetBool("/sim/rendering/draw-mask/sky",true))
+       updateSky();
     
     // need to call the update visitor once
     _frameStamp->setCalendarTime(*globals->get_time_params()->getGmt());
diff --git a/preferences.xml b/preferences.xml
index dbbbe2a..bc35ef3 100644
--- a/preferences.xml
+++ b/preferences.xml
@@ -224,10 +224,13 @@ Started September 2000 by David Megginson, david@megginson.com
             non-cockpit + aircraft elements. Use draw-mask instead. -->
          <draw-otw type="bool">true</draw-otw>
             <draw-mask>
+                <sunlight type="bool">true</sunlight>
                 <terrain type="bool">true</terrain>
                 <models type="bool">true</models>
                 <aircraft type="bool">true</aircraft>
                 <clouds type="bool">true</clouds>
+                <sky type="bool">true</sky>
+                <old-gui type="bool">true</old-gui>
             </draw-mask>
             
          <shadows-ac type="bool" userarchive="y">false</shadows-ac>



PS: We could probably unify those structs and make the property path configurable via the ctor and just parameterize the thing in the new call:
FGPropertySwitchCallback("/my/property");
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: No go airports for weak gpus ...

Postby clrCoda » Tue Feb 03, 2015 7:30 am

.
Last edited by clrCoda on Tue Feb 03, 2015 10:21 am, edited 1 time in total.
Ray St. Marie
clrCoda
 
Posts: 1225
Joined: Wed Apr 07, 2010 12:04 pm

Re: No go airports for weak gpus ...

Postby Hooray » Tue Feb 03, 2015 8:01 am

Are you trying to suggest that FlightGear not working "for weak gpus" is related to the Canvas system, if so, how ?
Using the draw-masks as per the instructions on the wiki, should disable everything, and should provide plenty of performance even on really outdated hardware.
WS 2.0 is a different matter though - as you can see by re-enabling terrain/scenery rendering - without using any fancy aircraft.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: No go airports for weak gpus ...

Postby clrCoda » Tue Feb 03, 2015 10:23 am

No, I apologize for posting in frustration. The thing I was most concerned about when I made that post is the extreme drop in frame rate from a view outside the cockpit to one inside. I have no data that supports that canvas is to blame. For that reason I edited the post.
Ray St. Marie
clrCoda
 
Posts: 1225
Joined: Wed Apr 07, 2010 12:04 pm

Re: No go airports for weak gpus ...

Postby Hooray » Tue Feb 03, 2015 11:43 am

You can use the minimal startup profile on the wiki to see if this is scenery related or not - equally, you can try different combinations of aircraft/locations.
However, in general, you will find that heavy scenery is not particularly optimized in its current - there are also several known scenery related "bugs" that people are currently working towards fixing.
Even worse, most cockpits are developed/modelled and textured by people who have no significant background in rendering, so that some of the most detailed aircraft cockpits (think 777) are extremely inefficiently structured which puts further strain on overall system load. None of these should be Canvas related - in fact, it would only require 5-10 lines of code to be edited to completely disable the Canvas system (from being initialized), which would prove that what you're seeing is more likely related to the complexity of the scenery and aircraft you're using/viewing, in conjunction with a whole number of factors related to inefficiently structured scene graph data (3D models and textures).

The minimal startup profile can be used to look at individual features (locations/aircraft) in isolation to see what kind of load they're responsible for, while excluding other factors/features.
Realistically, you shouldn't expect better frame rates once start using more complex scenery/aircraft though. Basically, you cannot expect an aircraft like the 777 or the extra500 to perform any better than when running using the minimal startup profile - which can be a suitable means to come up with a baseline for benchmarking, while also identifying individual features that are inherently problematic.

Once you have found potential culprits, it would make sense to use all the tools at your disposal to post a meaningful bug report, e.g. by using the built-in system monitor, the OSG on-screen stats and/or the built-in profiler or external profilers.

FlightGear can only improve if people actually provide this sort of feedback and do so regularly, no matter the degree of frustration involved.
Recently, a few core developers have fixed a few long-standing issues related to leaking listeners, which were responsible for massive slow-downs, without being related to any particular aircraft or location.

But don't expect these things to improve magically, you need to provide actionable feedback.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: No go airports for weak gpus ...

Postby LesterBoffo » Thu Feb 05, 2015 4:23 am

I believe the FG Download Central Graphical Map download page has pre Scenery 2.0 terrain and scenery. Most of the newer terrain comes from TerraSynch auto download.
User avatar
LesterBoffo
 
Posts: 2171
Joined: Sun Oct 02, 2011 5:02 pm
Location: Oregon, USA
Callsign: LesBof
Version: 2018.3.2
OS: Win10 Pro

Previous

Return to Scenery

Who is online

Users browsing this forum: No registered users and 7 guests