Shader

From FlightGear wiki
(Redirected from Shaders)
Jump to: navigation, search
The (advanced) shader dialog, as seen on 2.6.0.

A shader is a set of software instructions, which is used primarily to calculate rendering effects on graphics hardware, like water reflections and shadows.

Shaders in FlightGear

FlightGear supports shaders since the switch from PLIB to OSG (FlightGear 1.9.0). FlightGear 2.0 added the ability to program shaders and effects more easily (without modifying the core code) and use them for terrain and model materials. Old hard-coded shaders like the chrome shader or the random trees in the scenery were converted to the new system.

The Performance vs Quality slider in the View > Rendering Options dialog provides basic control. At the right most position, all enabled shaders will be shown at maximum quality. Most shaders are simple on/off, but some of the more demanding shaders have intermediate steps. Powerfull graphics cards have no problem with the maximum quality setting, but most cards (even modern ones) need a finetuned setting to maintain reasonable framerates.

FlightGear 2.6.0

As of 2.6.0, you can change individual shader's settings in the Shader Options dialog, which can be reached via the button in the Rendering Options dialog. Some aircraft are equipped with custom shaders, those will show up under "Aircraft" in the very same dialog. Setting the Performance vs Quality slider all the way to the left will disable all shaders.

Another novelty is the so called uber shader; one effect that controls several shaders. This allows an aircraft (or any model actually) to have lightmap, normalmap as well as reflection map applied. For details and usage instructions, see $FG_ROOT/Docs/README.effects.

Disabling Shaders

It's possible that the FlightGear default shader settings are not supported with your hardware/drivers, so that the process will be killed by the OS because it's trying to do something not supported by your computer. If you are experiencing full system crashes, you should see System Crashes instead.

By default, FlightGear 2.6+ will assume a certain runtime environment and certain GPU features which may not be suppported by most older cards (e.g. shader support), such as GeForce 6/7 generation hardware and most older hardware (older than 4-5 years), so that it can be expected that FG will probably not work on such computers "out of the box" and may get terminated by your operating system eventually, i.e. the default startup settings will need to be customized accordingly, to disable all unsupported default features. See Troubleshooting performance issues, Problematic Video Cards and FlightGear Hardware Recommendations for more details.

Also, make sure you've got the newest driver for your video card installed and running without errors. A suggestion for a thorough updating procedure can be found at Graphics drivers configuration.

Use the following startup arguments to disable shaders altogether:

  • --prop:/sim/rendering/quality-level=0
  • --prop:/sim/rendering/shaders/quality-level=0

For the future, it makes sense (at a minimum) to make sure these features that require newer hardware can be turned off so that people with older hardware can still run the basic code and see the base scene. In some cases it may make sense to have a backup scheme available so older hardware can see something, even if it's slower or less detailed. (For instance, we have a couple runway light schemes floating around.) But at some point we do need to decide where to draw the line.[1]

Gallery

Image:SnowAtAltitude1.jpg Image:SnowAtAltitude2.jpg Image:SnowAtAltitude1.jpg Image:SnowAtAltitude2.jpg

Scenery around LFLJ with the snow effect disabled (left) and enabled (right).

Scenery around TNCM with water reflections disabled (left) and enabled (right).

Related content

Wiki articles

Older shaders

Source code

Non-inclusive list of C++ source code files:

  • Curtis Olson (Jan 23rd, 2008). Re: [Flightgear-devel] Shader based random trees and improved random objects.