Panel Graphics Synthetic Vision
These routines let you draw the simulator's Synthetic Vision Technology (SVT) terrain rendering into your avionics panel. SVT provides a 3-D perspective view of terrain, runways, obstacles, and optional overlays such as flight path hoops, traffic, and airport signs. The view is always centered on the user aircraft and uses the selected AHRS source for attitude.
Create an SVT display with XPLMCreateSVTDisplay and draw it with XPLMSVTDisplayDrawIn. Each display instance manages its own terrain tile loading and GPU state, so you can have multiple independent SVT views (e.g. pilot and copilot PFDs at different scales). Which visual layers are drawn is chosen per draw call, not per display.
SVT rendering works on any aircraft, regardless of whether the stock cockpit has a G1000 or other SVT-capable avionics installed.
XPLMSVTFeatures
enum
Bit flags that control which visual layers an SVT display renders. Combine flags with bitwise OR to enable multiple layers.
| Name | Value | Description |
|---|---|---|
| xplm_SVT_Terrain | 1 | 3-D terrain mesh with elevation coloring. |
| xplm_SVT_Runways | 2 | Runway outlines, centerline stripes, and numbers. |
| xplm_SVT_Obstacles | 4 | Obstacle markers (towers, masts, etc.). |
| xplm_SVT_FlightPath | 8 | Flight path guidance hoops along the active route. |
| xplm_SVT_Traffic | 16 | TCAS traffic symbols. |
| xplm_SVT_AirportSigns | 32 | Airport identification signs near airports. |
| xplm_SVT_ILSHoops | 64 | ILS approach guidance hoops. |
| xplm_SVT_HorizonHeading | 128 | Horizon line and heading reference. |
| xplm_SVT_All | 255 | All visual layers enabled. |
Used by:
XPLMCreateSVT_t
struct
Parameters for creating an SVT display. Set structSize to the size of your struct so that future SDK versions can add fields without breaking existing plugins.
local My_CreateSVT_t = {
structSize = 0, -- int
pilotIndex = 0, -- int
pixelsPerDegree = 0.0, -- float
}
XPLMSVTDisplayRef
typedef
An opaque handle to an SVT display instance. Create one with XPLMCreateSVTDisplay and destroy it with XPLMDestroySVTDisplay.
local my_sVTDisplayRef = nil -- XPLMSVTDisplayRef
Used by:
XPLMCreateSVTDisplay
function
This function creates a new SVT display instance. The display begins loading terrain tiles for the current aircraft position immediately. You can draw it as soon as tiles are available; before that, the draw call is a no-op.
The pixelsPerDegree scale and the rectangle you pass to XPLMSVTDisplayDrawIn together determine the field of view: the rectangle is simply the scale applied to the view's angular extent. So drawing into a bigger rectangle at the same scale shows more of the world at the same magnification rather than zooming in, and to zoom you change the scale, not the rectangle. Pick the same scale your pitch ladder uses and the 3-d horizon will line up with your artificial horizon.
Which visual layers are rendered is a property of the draw call, not of the display - see XPLMSVTDisplayDrawIn.
The returned handle must be destroyed with XPLMDestroySVTDisplay when no longer needed. Handles are automatically destroyed when the owning plugin is unloaded.
-- returns XPLMSVTDisplayRef -> assign to local/var
local my_sVTDisplayRef = XPLMCreateSVTDisplay(
params -- see XPLMCreateSVT_t
)
See associated types:
XPLMDestroySVTDisplay
function
This function destroys an SVT display and frees all associated resources.
XPLMDestroySVTDisplay(
svt -- XPLMSVTDisplayRef
)
See associated types:
XPLMSVTCustomData_t
struct
local My_SVTCustomData_t = {
pitchDeg = 0.0, -- float
rollDeg = 0.0, -- float
headingMagDeg = 0.0, -- float
magVarDeg = 0.0, -- float
indicatedAltFt = 0.0, -- float
baroSettingInHg = 0.0, -- float
hsiSource = 0, -- int
hdefDots = 0.0, -- float
vdefDots = 0.0, -- float
}
XPLMSVTDisplayDrawIn
function
This function renders the SVT display directly into the active panel surface within the specified rectangular region. SVT sets up its own 3-D perspective projection to fit the rectangle, so no transform stack manipulation is needed.
The features parameter controls which visual layers are rendered for this draw call. Pass a bitwise OR of XPLMSVTFeatures flags.
This function must be called from within an avionics drawing callback. If terrain tiles have not finished loading yet, this function does nothing.
- svt: the SVT display handle.
- features: bitwise OR of XPLMSVTFeatures flags to enable for this draw call.
- left, top, right, bottom: the bounding rectangle in panel coordinates.
- dataOverrides. Pass nullptr for default sim state.
XPLMSVTDisplayDrawIn(
svt, -- XPLMSVTDisplayRef
features, -- XPLMSVTFeatures
left, -- int
top, -- int
right, -- int
bottom, -- int
dataOverrides -- see XPLMSVTCustomData_t
)
See associated types: