Anti-aliasing

From FlightGear wiki
(Redirected from Antialiasing)
Jump to navigation Jump to 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 (called adaptive anti-aliasing by AMD) that is helpful for use with overlays.

Try turning anti-alising higher than what you would normally use if your FPS is limited by your CPU, or if you have more FPS than you want. Anti-aliasing only needs GPU time, it doesn't need extra CPU time.

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.

Overriding anti-aliasing settings in NVIDIA or AMD control panel

Nvidia Control Panel on Windows 10
NVIDIA Control Panel on Windows 10. Click to enlarge.

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 (Feb 2021).


Tip: In Windows at least can have different settings for different programs by selecting the executable path e.g. C:\Program Files\FlightGear\bin\fgfs.exe . If you are a power user using multiple installations of FlightGear side by side, You can have different settings for different version of FlightGear installed in parallel. You can also have different profiles by copying the \bin folder to \bin2 e.g. C:\Program Files\FlightGear\bin2\fgfs.exe, and use a copy of the shortcut pointing to the new fgfs.exe (otherwise you may need to add any command-line options like --launcher that is already included in the default shortcut created by the installer).

Note  NVIDIA users: if you have forced anti-aliasing off in the NVIDIA control panel, and you have not set anti-aliasing off in FG you will likely see black or green squares for trees.

Transparency anti-aliasing

Volumetric grass effect using the overlays

Transparency anti-aliasing (NVIDIA), called Adaptive anti-aliasing by AMD, is a 2nd anti-aliasing option (article with explanation - archived). Transparency anti-aliasing can be enabled in the control panel for NVIDIA and AMD GPUs.

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). However as of March 2020, transparency anti-aliasing 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 a demanding on the GPU. Anti-aliasing and overlays don't need extra CPU time, and you can try turning them up if you are CPU bound, or your GPU has FPS to spare.

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).