LFD’s Auto View Distance Utility for X-Plane

LFD’s Auto View Distance utility will optimise X Plane’s graphics engine dynamically to bring you the best results for your configuration.

Where to Donate

Your search is over… you can donate here!

Where to Download

This free utility is on XPlane.org – click the image to go there.

Click the image to go to the X Plane download page

How it Works

The Auto View Distance (AVD) utility will optimise X Plane’s graphics dynamically to bring you the best results for your configuration and you control how that happens.

The utility can be set to work unobtrusively in the background once you have finished configuring it via the user interface.

The computing power saved from needless far-distance calculations can be spent increasing the quality of your local area. Saving as little as 5% on the view distance normally lost in haze can make all the difference.

Even in a correctly configured system there will be times when the complexity of scenery and weather can cause your FPS to drop to levels that cause visual stuttering. During these times the utility will automatically reduce the view distance to alleviate the burden and restore your minimum FPS. You control the speed and depth of that response.

The FPS power you save will allow you to:

  • Increase the Number of World Objects setting
  • Increase the Texture Quality setting

The ‘Number of World Objects’ Setting

The primary X Plane setting that can be radically improved by using the AVD utility is the Number of World Objects.

…without the AVD Utility

Without the AVD utility, the only way to lower FPS demand from scenery is to reduce the density of the buildings across the whole view for the entire flight. That results in an unsatisfying and unrealistic representation of towns and cities.

…with the AVD Utility

When AVD is running, the Number of Objects can be set to maximum, making your immediate surroundings much more realistic. When your FPS allows, this level of detail will spread to the horizon.

The difference between ‘high’ and ‘max’ number of objects is substantial
A comparison between High and Max number
of world objects in 2 different locations

Key Features of Version 2.0

The creation of a companion app to override the view distance control. Via configurable key presses you can stabilise or change the view distance throughout your stay at airports.

Key Features of Version 1.9

Exception handlers have been added to the functions that access X Plane’s LOD and FPS variables.

Key Features of Version 1.8

  • The FPS averaging window is now available for configuration.
  • There are two independent rate of change sliders to control the view distance.
  • Rate of change units are now Percent Per Second (%/s).
  • View Distances are also represented by their equivalent as a ground level View Areas. The View Area is the workload that your computer is actually working to fill and this rises exponentially as you approach the horizon, whether you can see it or not.

Compatibility With Other Tools

LFD’s AVD utility is intended to be compatible with other tools as far as is possible – it only controls one variable. There is a good chance that there won’t be any ongoing conflict if you leave the LOD aspect of other tools alone. If the utility detects an external adjustment of the utility’s LOD variable “LOD Control Conflict” is displayed on the user interface until the conflict is resolved.

The following utilities are compatible:

  • FlyAgi_Tweak_Utility – set its LOD option to manual.
  • 3jFPS-wizard – set automatic LOD to off
  • ASHA – no change needed

User Guide for Version 1.8 & 1.9

Once you have configured AVD, set X Plane’s ‘Number of World Objects’ to maximum for best results.

FPS Target

Choose your minimum required FPS value, ensuring that it is an achievable one. If you have ‘frame limiting’ set (for Oculus VR), you can safely use the limiting number as your target. If the FPS drops below the target value then the view distance (the range of the level of detail) will be reduced to compensate.

Sensitivity

The sensitivity depends on a combination of the averaging window and the rates of change applied to the view distance.

The default values will provide smooth handling of the view distance horizon with moderate rates of change, but will still be able to climb back from a minimum view distance at a reasonable pace.

These settings depend on your personal preference for smooth replay vs graphical fidelity so you’ll probably want to adjust them to suit your needs.

FPS Averaging Window

The FPS is averaged over a time period measured in fractions of a second. The default value might seem a little high but it does make changes to the view distance horizon less noticeable.

View Distance Retreat Rate

The retreat rate should be faster than the advance rate in order to lower the stutter frequency. A ratio of 2 or 3 time the advance rate value works well. If you set the retreat rate high then the view horizon will shrink visibly when your FPS drops.

View Distance Advance Rate

The advance rate should be less than the retreat rate for best stutter control. If you set this value high you might find that the view horizon washes back and forth rapidly, making it unpleasantly noticeable. If you set the advance rate too low then the view distance may take a long time to recover.

Limits

Although the View Distance is the focus of this application, it’s the View Area resulting from it that determines the graphical burden on your computer.

Each 1% step towards the horizon brings into view a larger amount of surface area than the previous 1%. You can read the relative area as a percentage underneath the view distance readouts on the sliders and on the readout at the top of the form.

Max View Distance

The most distant objects become visible at 93% and after 95% there will be little useful improvement due to reducing object size and haze. Going to 100% will exchange 9.25% of your computer’s resources for an imperceptible gain in fidelity. The FPS response will depend on terrain detail and weather.

If your view horizon is fluctuating noticeably and you find it annoying, you might want to consider opting for a lower maximum view distance to make the visuals more consistent across varying terrain.

Min View Distance

When taxiing at an airport a value of around 30% will retain the highest available detail for the buildings in your immediate vicinity and some of the terrain beyond the airport, which will be fine for getting aloft. If seeing extra building detail isn’t of interest, you can push the minimum to zero to make a final stand against stutter control.

Test

You can try out your system with the test slider to see the appearance at different level of detail. The value will stay set until you disable it or start a new flight.

Options

If you want to keep the AVD dialogue visible during flights you can have it remember its dimensions for next time. Be aware that in VR the window sizes are slightly different from the 2D version, and this might cause confusion.

Note that in VR you can grab a corner and scale the dialogue to be smaller.

You don’t need to have the user interface on display for it to do its job. Leaving the dialogue hidden after loading an aircraft won’t cause any problems.

If you make the dialogue small on a 2D screen, the data readouts will jump to the title bar of the window. Unfortunately, LUA has a few limitations and one of them is that you must make a part of the form visible to be able to capture update events from X Plane.

Installation

The first step is the biggest one: you will need the FlyWithLua plugin to provide the power to run this utility – you can find it here. You will be loading it at: >> X-Plane 11 > Resources > plugins.

  • Install FlyWithLua
  • Put the Auto View Distance utility into the FlyWithLua ‘scripts’ folder which can be found inside the FlyWithLua plugin folder.
  • Launch X-Plane and the utility will appear automatically.
  • You can turn the dialogue auto-launch off in the options settings.
  • The user interface can also be launched from:
    Plugins > FlyWithLua > FlyWithLua Macros
You can launch the dialogue from the FlyWithLua Macro menu

Configuration

Do This First!

  • Select your target FPS carefully, this is a critical step!
  • Ensure you are not running other scripts that might be changing LOD variables – you will see a warning notice if that happens.

Before you Make Changes

Take some time to get used to the Auto View Distance Utility in its default mode before tinkering with your X Plane settings in detail. You may see some FPS improvement straight away or the support may come when you are over more complex terrain or using special effects that are pushing your computer’s limits.

When you are ready, the first X Plane change to try is setting the Number of World Objects to maximum.

Tailor the Configuration

Press and hold your cursor on the help buttons (marked h1, h2 etc) for an explanation of whats available.

  • Fly to a worst-case FPS scenario area and observe the FPS readout
  • If all is well, increase the Number of World Objects setting
  • See how this affect the FPS and View Distance readout and spend a few minutes getting acquainted with it.
  • If you are OK so far, try increasing the texture setting
  • Continue flying and monitoring the readouts
  • Adjust the sensitivity sliders to suit your taste. Refer to the Sensitivity section for more information.

Allow for Stabilisation on Start-Up

Be aware that when launching a flight at a complex location the view distance will probably fall initially because:

  • The sim will still be loading objects and textures in the background.
  • The sim sees a lot more of the terrain, textures and world objects than you do.

For example – if you are on the ground at Heathrow facing London city centre, the frame-rate will be affected far more than if you are facing away from London at the exact same location even though in both cases you can’t see London.

Simply give the sim time to settle and the utility will respond accordingly.

Understand the Sensitivity Settings

There are two sensitivity settings to control the view distance – the shrink rate and the expansion rate. The default values are geared towards reducing stutter by retreating more quickly from FPS drops than the more moderate speed of advance. This strategy will result in fewer and smaller stutters.

You Will Reach a Limit

Although the utility will give you great results comparable to an expensive hardware boost, at some point you will inevitably push your computer beyond its capability. At this point the frame-rate will drop and the view distance will go to minimum and stay there.

That can be frustrating but if there isn’t a specific fault in the your system, and there are no background resource hogs on your computer then you just don’t have enough computing power and have reached your limit. All you can do now is carefully review the configuration of your computer’s hardware and software to free up some more computational power just like you did before AVD.

FPS Flying Tips

There are a few things you can do to avoid having your FPS drop in the first place. If you just want to relax and enjoy the view then consider the following:

  1. Don’t fly close to complex buildings or the ground.
  2. Plan your airport use such that when entering, leaving or taxiing at an airport ensure you face away from complex structures on the horizon such as cities, even if you can’t see them.
  3. When at altitude avoid lining up two cities.

Troubleshooting

How to Test FlyWithLua

FlyWithLua itself could become destabilised in certain circumstances. The net result of that is that it may crash, taking its scripts with it. However, there is also a possibility that a script or plugin may be preventing FlyWithLua from issuing ‘event’ calls to it’s scripts so they are not running correctly. This is something that I have been debugging on a users’ system remotely and I thought the most recent test script might be useful for FlyWithLua’s users generally. The latest version of AVD contains this test script – it merely writes to X Plane’s log file so you can confirm that its is running normally. All instructions are included.

Why Doesn’t AVD Load?

At the time of writing there have been 4,383 downloads and one reported case of AVD failing to load this was due to AVD failing to receive event calls from FlyWithLua – meaning that another plugin or script is affecting the ability of FlyWithLua to run as intended, and is not to do with AVD specifically. The latest version of AVD contains this test script as an additional file you can use to test your system.

In normal operation and on first use, AVD will open automatically for you so you won’t have to look for it (this behaviour can be switched off in its options). If you don’t see the user interface at all, the possibilities are that you have a mixture scripts running in LUA and possibly additional plugins that may:

  • Have caused LUA to crash
  • Have caused AVD in particular to crash. This is less likely in version 1.9 which has exception handling implemented.

In order to isolate the problem yourself, try to answer the following questions:

  1. Has LUA crashed?
  2. Does LUA run properly with no plugins?
  3. Does LUA run properly with any one single plugin?
  4. Does AVD respond if AVD is the only LUA plugin present?
  5. Does AVD still respond when I add my other plugins back in?

If methodically going through that list in order doesn’t reveal the problem, then:

  1. Check the installation procedure carefully from the start, verifying as you go.
  2. Check that LUA hasn’t crashed due to a failure in an unrelated script.
  3. Send me your complete and freshly recreated log.txt file as described in another section.

However, bear in mind that even if AVD can be loaded it can only perform its function if it has complete control over the X Plane LOD variable. Therefore debugging will be a fruitless mission if you are not also prepared to turn off LOD control in other scripts and plugins.

How Do I Send You My Log File?

I can’t promise I can debug the situation from a log file, but if you want me to take a look, make contact via this page first, and when I have replied you can send an attachment.

You should create a fresh log file that contains the AVD information without the repetition that can grow in a normal log file that might confusion the issue. You can find log.txt I need located inside the root folder of X-Plane 11. This file is created or extended every time you launch X-Plane, so it would help if you would follow this procedure:

  • Exit X Plane
  • Delete the log file
  • Launch X Plane
  • Attempt to load the AVD LUA script
  • Zip up the whole log.txt file and send by email

Why Does the FPS Readout Show 1000?

This is a fail-safe value that is returned internally when AVD is unable to get a true reading from X Plane for any reason, but you probably won’t ever see it. If 1000 FPS occurs and persists over a period of time, the view distance will float up to the maximum value that you chose.

Why do the PAPI Lights Disappear?

The AVD utility does not control individual objects, instead X Plane chooses how to respond to the view distance setting. You would have to be quite close to the PAPI lights to use them so that suggests your view distance must have reached a fairly low value. In other words your computer must be heavily loaded. At this point you will need to review your settings. There are tools available which will allow you to choose the density of static aircraft at airports as well as vehicles on the roads and other details. These things can be reduced to give you the FPS you need to raise the view distance enough for the PAPI lights come back into view.

Why is There a Blank dialogue box?

In previous versions, a blank dialogue was possible when there is conflict in the system. The utility has now been recoded to go to a ‘test & wait’ mode instead of trying to overcome the situation. It also has exception handling included to stop problems from disabling the script. When a collision of interest occurs between AVD and another plugin an error message is shown in the user interface for a few seconds before attempting to continue. This message will be displayed repeatedly until the situation is resolved.

If you see this message, you will need to find and stop the LOD variable modification from happening – it will normally be another tool in your system that is trying to do a similar job as AVD.

Excessive Stuttering?

If you are having any issues its always worth checking what’s going on with the Task Manager as the first step to solving it. Look for excessive activity in the ‘Performance’ tab as well as CPU usage on the ‘Processes’ tab.

Check for background downloading by Steam or windows, or virus scanning.

Improve Your Computer Settings

Be aware that there have been no reported errors for the AVD utility. If you encounter a drop in quality of the sim, check your system for background recording or background downloading by Windows or Steam.

You can also check this article for a list of the ways you may be able to maximise your computer’s resources, including these possibilities:

  • Optimising your Page File according to rules provided by a long standing Windows expert and employee.
  • Ensure Windows and Steam updates are not being downloaded in the background.
  • Consider turning off background recording of your flight
  • Control virus scan times and durations
  • Windows 10 has Game Mode settings you should check
  • NVidia card users can get more FPS by configuring the ‘Manage 3D Settings’ tab, choosing performance over quality.

There are many other settings available and you should check your favourites to ensure they are still set as you want them to be.

Screenshots

100% Review Score

Flightsim Hangar Contents List

Related Articles