Anti-aliasing

From FlightGear wiki
Jump to: navigation, search

By default, FlightGear will not use anti-aliasing during the simulation. This results in incorrect rendering of sharp straight lines and very small objects. In order to correct this, you can apply the anti-aliasing function; however, this will slow down rendering and is not guaranteed to work on all graphics cards.

NVIDIA and AMD drivers have an additional option for transparency anti-aliasing that is helpful for use with overlays.

Examples

Anti-aliasing disabled Anti-aliasing enabled
Anti-aliasing disabled Anti-aliasing enabled

How to set anti-aliasing

Command line

When starting FlightGear via the command line, add the following two arguments:

--prop:/sim/rendering/multi-sample-buffers=true
--prop:/sim/rendering/multi-samples=4

FGRun

Setting anti-aliasing in FGrun

When you use FGRun, add these commands under Advanced > Properties.

Qt Launcher

If you are using the Integrated Qt5 Launcher, then you can easily enable anti-aliasing by toggling the "Enable Multi-sample anti-aliasing" option from the "Settings" tab.

Rembrandt

Anti-aliasing does not work with Rembrandt enabled due to GLSL limitations, but some graphics cards have hardware anti-aliasing which may work.

Options

If preferred, you can choose another value for the number of samples. The number has to be greater than 1. The greater the number of samples, the slower rendering will be.

Thanks to fredb for publishing this information on the FlightGear forum.

Transparency anti-aliasing

Volumetric grass effect using the overlays

A 2nd anti-aliasing option is transparency anti-aliasing. Overlays benefit from transparency anti-aliasing. Overlays add very small scale 3d detail to ground when regional terrain has been updated with overlays. Transparency anti-aliasing is most noticeable on overlay grass (High super-sampling transparency anti-aliasing example). Transparency anti-aliasing can be enabled in the control panel for NVIDIA and AMD GPUs. However as of March 2020, this is also applied to things like trees by Flightgear. High vegetation density with overlays can cause a bottleneck depending on GPU. Transparency anti-aliasing can take up a lot of GPU time. This is in addition to overlays being demanding.

The Multi-sample (MSAA) option has the best results without too much slowdown. It's recommended. The super-sampling option is slower.

If you're not using overlays the transparency anti-aliasing does not make too much of a difference. It may make a slight visible difference to vegetation, but leaves are fuzzy anyway and it's fine to have it off.

Tips on using anti-aliasing settings

  • Anti-aliasing is more obvious on still screenshots. Try increasing anti-aliasing if you have a screenshot in mind.
  • The driver control panels for NVIDIA and AMD support enhancing settings beyond what applications allow. You can use this to override Flightgear, or if you want a GUI interface.
  • When in motion at high FPS there is an averaging effect that has the same function as anti-aliasing.
  • Newer NVIDIA and AMD drivers have the option of "temporal anti-aliasing" that turns down anti-aliasing to free up performance at at high FPS. It's called "Multi-frame sampled AA" in NVIDA control panel. See if your GPU support this. (March 2020)
  • At least the NVIDIA control panel on windows supports driver settings overrides for each application by .exe file. If you create a copy of the /bin folder to get a copy of fgfs.exe, and you can set a different set of graphics overrides. This can be useful for example, when you want to take a screenshot of something at high anti-aliasing. You may also need to create a shortcut or equivalent that tells Flightgear where the FG data directory is.
  • If you have a monitor with very small pixel sizes, you can try reducing anti-aliasing if you need a performance boost. For these monitors, the decrease in pixel size can function in the same way as increased anti-aliasing. It's similar to the very slow super-sampling variety of anti-aliasing. You may be able to lower anti-aliasing settings, but it will look worse in screenshots or videos when displayed on a monitor with larger pixel sizes. Running Flightgear in a lower resolution mode can also help performance if needed. Options for lower resolution modes include: windowed mode, fullscreen mode with a black border, or a stretched fullscreen mode. Stretched modes can be slightly blurry where there are sharp edges like UI or text as interpolation is used. It is possible to run with resolution set to one half or one third to eliminate or reduce blur. For example running a 4k (3840 x 2160) monitor at half resolution with 1080p (1920 x 1080). This is less blurry, but it is not perfect in practice. This is because both displays and most GPUs will unnecessarily interpolate. Intel NVIDIA 11xx, corresponding AMD GPUs, Gen11 intel integrated GPUs (2019), and later series GPUs, have 'integer scaling'. Therefore running stretched fullscreen at half resolution will no longer be needlessly and slightly blurry. Context and info: In recent years (March 2020) there has been a trend of making pixel sizes smaller on LCD displays. For example a 2k (QHD) or 4k (UHD) monitor that is the same size or a little bit bigger than a 1080p (FHD) monitor while containing up-to 4x more pixels.

The trade off between graphics content, FPS, and graphics settings like anti-aliasing

There's a limited amount of time between each frame for the GPU to do computations. At 30 frames per second (FPS) the time is 1 second/30 FPS = 33ms. At 60 FPS it is 16.7 ms. Flightgear uses this GPU computational time to add realistic light simulation and create graphics content for the scene. How much GPU time is needed for a frame depends on what's being drawn in the current view. For example changing tree density cannot affect FPS over a desert or sea, even if vegetation density normally bottlenecks a system. Whether or not the lack of GPU time reduces FPS depends on where the bottleneck is. If Flightgear is waiting on CPU heavy tasks to finish on a system with an old CPU and a newer GPU, turning up GPU heavy settings further will not reduce FPS. The the bottleneck will most often the GPU on most systems at high graphic settings on most systems when flying over regions which have complex scenes.

Approximately what FPS is acceptable for each task? Ultimately it's a personal thing, to be found out by experimenting. Lower FPS means more time between frames, letting the GPU do more computations. It's been mentioned in the forum that around 20-30 FPS is enough for flying. Less FPS than this might be ok when operating a glass cockpit aircraft where the autopilot handles a lot of flying, and interaction mostly involves pushing buttons. There is a forum thread for submitting settings for different GPUs so newcomers will have reasonable starting settings for their GPU. A consistent time between frames (frame spacing) helps deliver a smooth experience even at lower FPS. Sometimes the focus is on FPS when frame spacing is more important.

Using the limited GPU time for anti-aliasing to smooth out jagged lines or get sharp grass at the cost of FPS is a personal tradeoff. My personal view is that turning down graphics content and light simulation just to increase anti-aliasing is not worth it (beyond the basic 4x anti-aliasing needed to display things like trees correctly).