Feature Scaling
This article is a stub. You can help the wiki by expanding it. |
Note In its current form, this section/article is largely based on quotes collected from various related discussions/channels (devel list, forum etc) using the Instant-Cquotes script. Wiki users and other contributors are encouraged to help rewrite/edit contents accordingly to help get rid of unnecessary quoting (i.e. while the wiki is not intended to be a collection of quotes, quotes are sometimes the best/easiest way to bootstrap new articles, while also providing a good way to link back to related discussions in the archives).
While rewriting usually only entails changing first person speech to 3rd person. However, please try to retain references/links to the original discussion whenever possible. |
Portability & Compatibility |
---|
Performance |
Efforts |
Gallery
Screen shot showing the property browser running on Netbook in a patched version of FlightGear with resource tracking support using the cross platform SIGAR library
Screen shot showing the property browser running on Netbook in a patched version of FlightGear with resource tracking support using the cross platform SIGAR library
Background
For the more general question of what to enable by default, what we could really do with is a way to automatically adjust to the hardware. — Rebecca N. Palmer (Aug 13th, 2015). [Flightgear-devel] Defaults Re: Basic Weather.
(powered by Instant-Cquotes) |
I suggested automatically changing the LOD range according to available memory (which would probably be easier), but never got around to actually working on it.
— Rebecca N. Palmer (2015-02-05). Re: [Flightgear-devel] FlightGear on low (<=4GB) memory systems.
(powered by Instant-Cquotes) |
FlightGear's defaults don't scale very well at the moment. But to be honest, backward compatibility has never been a real priority ...
|
it was stuart who mentioned this a while ago: This could be implemented by using a Nasal script to monitor a handful of properties and by adjusting some other parameters dynamically.
That shouldn't require any C++ modifications. — Hooray (Fri Mar 02). Re: [SUGGESTION] Auto-adjusting fog for FPS control.
(powered by Instant-Cquotes) |
the first step is providing built-in means to gather system statistics at run-time (analogous to a task/process monitor), to see how CPU/RAM/GPU/VRAM are utilized when certain features are active, so that we can better identify subsystems and features that are resource hogs, e.g. because they eat up RAM or frame-rate. The next step is to either introduce feature-scaling then, or make such features entirely optional.
With a focus on RAM, the basic idea is summarized at: Subsystem-level_Memory_Tracking_for_FlightGear But the same thing could be done for CPU/GPU utilization. |
The neat thing about writing such stats directly to the property tree would be that we could use Nasal scripts to watch those values and change things on demand or issue warnings to the console, for example to implement feature scaling .
|
I do think that such a benchmark could probably be implemented directly in FlightGear, just by using Nasal scripting and some custom XML files.
|
it's commonly called "feature scaling", and has been discussed at lengths here. But for the time being, it would be as straightforward to implement as changing your FDM in-flight by adjusting engine/wing foil parameters - I am sure your FDM was never designed with such requirements in mind, and that also applies to most of the legacy FG code that's been around for over 15 years now.
Feature scaling involves not just reading a value/variable once, but either polling it (updating it permanently at frame rate) or acting upon events if some variable has changed, to reset/re-init or adjust the corresponding system - most people didn't/don't write their code that way, because it takes more time - see the XML discussion we had with Stiglr a few days ago: [2] |
The other LOD setting I keep debating about, is the ‘lod-bias’ feature the OSG pager has. This can be used to bias the LOD metrics arbitrarily, and in particular based on frame-rate. It would need a PID controller to drive it I think (but we have the code for one of those!), but the idea would be to bias LOD to achieve a target frame-rate; effectively ‘stuff’ which uses the OSG pager system (random building/trees, scenery models) would be unloaded if frame-rate dropped.
— James Turner (2014-11-19). Re: [Flightgear-devel] Improved LOD handling for AI Models.
(powered by Instant-Cquotes) |
I haven’t even made the experiments around this, but conceptually it feels nice to me - I’d much rather the system unload buildings/models to maintain a target 30fps. It would work even better with a ‘bare’ / ‘detailed’ BTG scheme of course, since we’d revert distant tiles to the bare version automatically.
— James Turner (2014-11-19). Re: [Flightgear-devel] Improved LOD handling for AI Models.
(powered by Instant-Cquotes) |
What I don’t know is how badly the system would hunt for the target frame-rate; i.e load in some expensive PagedLOD containing random buildings -> FPS drops -> bias increases -> PagedLOD unloads -> repeat. That’s why I assume a PID controller is needed, plus some additional logic to reset the bias on re-position. I can also imagine making a 180-degree turn changing the factors hugely (looking at Manhattan vs looking out to sea at KJFK), and the PID controller working the bias hard to deal with that. /And/ as you said above, we know loading+unloading has its own costs.
— James Turner (2014-11-19). Re: [Flightgear-devel] Improved LOD handling for AI Models.
(powered by Instant-Cquotes) |
Actually what I’d really be looking for here is not unloading, but simply skipping the culling+drawing - maybe that falls out from your expiry time change too.
— James Turner (2014-11-19). Re: [Flightgear-devel] Improved LOD handling for AI Models.
(powered by Instant-Cquotes) |
X-plane seemingly has something on firstboot that sets graphic settings according to your computer. Having this integrated into FG can prevent some users complaining about bad imagery,although what they forgot is the Rendering setting. Rough algorithm suggestion -Set settings to Lowest/off -Gradually add effects THEN shaders until we get nearest to(but more than) 25fps. Interested? Help me plan the algorithm. I think this will be in Nasal. — Poomklao Teerawattanaprapha (Jan 14th, 2016). [Flightgear-devel] Feature suggestions:Automatic setting of
Rendering.
(powered by Instant-Cquotes) |
It's not as easy as it sounds here. First, users are different - some like 60 fps steady and don't care too much about visuals. Others want opulent visuals and are willing to go down to 10 fps. Second, effects drag the framerate when they're used, i.e. when you look at an object rendered with them. So you don't know what quality level of, say, the water effect the system can sustain at 25 fps unless you're looking at a water surface. Third, visibility influences framerate often more than quality settings - what runs find at 20 km visibility may not at 120 km. Fourth, we have different rendering frameworks to provide options - what do people want to burn their GPU cycles for? You can opt to do it for dynamical lights and shadows, then you get Rembrandt, you can opt to do it for atmosphere visuals, haes and procedural terrain texturing, then you get ALS. Fifth, I have no clue what distinction between effects and shaders you're trying to make here. We do have fixed pipeline effects which don't run any shaders, but they're sort of the lowest fallback option before declaring failure, so we can't really gradually add them. I guess in the end better explaining to users how the rendering settings can be chosen and what affects what or perhaps some more intuitive GUI tweaks may work better. My two cents... but feel free to try it - I've once toyed with an 'hold framerate' controller for how far out we render clouds, and I wasn't really happy with it. — Thorsten Renk (Jan 14th, 2016). Re: [Flightgear-devel] Feature suggestions:Automatic setting of
Rendering.
(powered by Instant-Cquotes) |
Efforts
agreed, I once talked with Stuart and TheTom about also adding details about the amount of physical RAM vs. swap usage, too - having these things available in FG, would make troubleshooting around here quite a bit easier, and would also allow us to do feature-scaling, I provided a patch for this for a Linux implementation back then, and we could probably extend this for all main OS (win, mac, linux): [3]
|
For Nasal space, we pretty much have a working solution that could help us identify scripts that are causing lots of new naRefs or temporaries. But C++ code is a different beast, and as can be seen in many discussions here - we have quite a few people with >= 8gb of RAM seeing crashes on 64 bit OS due to "out of RAM" errors.
|