This article contains a list (current to X-Plane 10.25r1) of art controls that can be used to analyze the performance of your custom aircraft.
Methodology
Before you attempt to improve the performance of aircraft, you need to understand what aspect of the aircraft is hurting performance. There are two principles here:
- The CPU and GPU work independently; framerate will be limited by whichever of the CPU or GPU is doing more work. Saving processing power on the processor doing less work will not improve framerate. (In other words, if the CPU is maxed out, saving GPU time doesn’t help; if the GPU is maxed out, saving CPU time doesn’t help.)
- Different aspects of your aircraft will contribute differently to processor load. It makes sense to focus on the most expensive parts of your aircraft first. If the flight model uses 5% of the CPU and object drawing uses 50% of CPU, focus on object drawing, not the flight model.
GPU load is heavily affected by which graphics card a user has and rendering settings, you should look at your aircraft on a range of settings and preferably a range of hardware as well. Users who run on small monitors without HDR are less likely to have GPU performance problems than users running with all rendering settings cranked on older machines with big external monitors.
Think in Milliseconds, not Frames-Per-Second
In order to correctly look at the ‘cost’ of code, look at the number of milliseconds (ms) it takes to render a single frame, not the framerate. In X-Plane’s “frame times” data output you get two useful pieces of information:
- “Frame time” is the time to draw the frame in ms. You can look at the change in this number as you disable features to figure out the cost (in time) to compute each feature. For example, if your frame time is 30 ms and lowers to 20 ms when you disable your plugin, your plugin is taking 10 ms per frame to do whatever it does.
- CPU Load – this is a ratio of the frame time that the CPU is busy for. If the number is near > 0.90 or so then you are probably limited by CPU time. If the number is lower, the CPU is idle, waiting for the GPU.
For example, when viewing the 747 with spill lights on a very old video card, the CPU load might be 0.31 and the frame time is 0.033. This means the frame took 33 ms to draw, but the CPU was only busy for 31% of that time (10 ms). Thus the frame is GPU bound.
If the GPU is not maxed out, X-Plane does not provide a direct way to view its loading; you may be able to use a third party utility for this.
Measuring Cost By Disabling Features
With the above in mind, you can determine the cost of various parts of your aircraft by disabling them and looking at the change in CPU time and CPU loading factors. Features that decrease CPU time or frame time a lot are good candidates for optimization effort.
The list below is a set of art controls that can be used (via DataRefEditor) to disable parts of the work done to draw your aircraft.
Besides these art controls, you can use your own datarefs to remove the attached objects of your aircraft to measure their individual cost.
Art Control List (Current 10.25r1)
perf/disable_cockpit_readback. This disables per-frame rendering of the panel texture. This saves the time of instruments on the panel texture, GPU overhead, and plugin time in the callbacks for the panel. If using this improves fps, your panel is too expensive (either due to X-Plane instruments or plugin code.)
perf/kill_click_3d. This disables per-frame checking of the mouse position against your manipulators. If setting this improves framerate, you have too many triangles that contain manipulators; use simpler meshes for your manipulators.
perf/kill_cockpit_objects. This disables all drawing of the airplane from inside the virtual cockpit. When looking at 3-d cockpit performance, kill the entire 3-d cockpit to get a “baseline” (e.g. how fast the sim is without your airplane at all). When you kill cockpit objects, the flight model, 3-d clicking, and cockpit readback are still running and must be separately disabled.
perf/kill_fm. This disables the flight model. When the sim is unpaused, you’ll see a fps gain as the CPU is freed up. Usually the gain is quite small; there’s not much you can do to improve flight model CPU time yourself (other than turn down the number of flight model computations per frame in the operations and warnings screen).
perf/kill_instruments. This disables the drawing of X-Plane’s instruments on the panel texture (or 2-d panel) but does not disable the background or plugin drawing. You can use this to determine the cost of X-Plane instruments vs. custom nav displays.
perf/kill_panel_bkgnd. This disables the panel background from drawing; the panel background is usually very cheap.
perf/kill_planes. This disables the drawing of planes in exterior views. Use this (with cockpit readback) to determine the speed of the sim without your aircraft.
perf/kill_prefill. This disables cockpit pre-fill. When pre-fill is disabled, GPU use goes up (since clouds behind the cockpit must be rendered) and CPU use goes down (because the aircraft objects do not need to be drawn multiple times). Use this dataref to look at the effficiency trade-off of pre-fill.