<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Amalon</id>
	<title>FlightGear wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Amalon"/>
	<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/Special:Contributions/Amalon"/>
	<updated>2026-05-29T21:15:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143835</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143835"/>
		<updated>2026-03-28T19:03:56Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Enabling VR */ reword&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Usage &amp;amp; Controls ==&lt;br /&gt;
&lt;br /&gt;
=== Headphones Setup ===&lt;br /&gt;
&lt;br /&gt;
If you use headphones, or have speakers attached to your headset, enable &amp;quot;Head tracked sound (for headphones)&amp;quot; in the VR Options dialog (in the View menu). This will make surround sound relative to your head orientation. You can also enable binaural audio using HRTF filters in OpenAL to get better stereo surround sound.&lt;br /&gt;
&lt;br /&gt;
=== Enabling VR ===&lt;br /&gt;
&lt;br /&gt;
You can enable / disable VR at startup via the &amp;lt;code&amp;gt;--enable-vr&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; command line options, or at runtime using the VR Options dialog (in the View menu).&lt;br /&gt;
&lt;br /&gt;
=== VR Specific Controls ===&lt;br /&gt;
&lt;br /&gt;
To use a mouse in VR, use the 360 mouse mode which captures the mouse and allows you to move it all around you. If you are using an OpenXR runtime which supports user presence detection then it will be enabled automatically while you have your headset on (if not you can toggle it manually using a keyboard shortcut).&lt;br /&gt;
&lt;br /&gt;
You can use the following shortcuts on the next branch:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vatop&amp;quot;&lt;br /&gt;
|width=&amp;quot;500&amp;quot; |&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Key combination&lt;br /&gt;
! Mouse combination&lt;br /&gt;
! VR input&lt;br /&gt;
! Action&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Tab}}&lt;br /&gt;
| {{key press|Shift|Right-click}}&lt;br /&gt;
| Put HMD on or take off (see &amp;quot;Enable 360 mouse when VR is in use&amp;quot; setting)&lt;br /&gt;
| Toggle VR/360 mouse mode&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Space}}&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| Recenter VR view position and direction&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make GUI accessible to VR user {{progressbar|90}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|80}} {{priority|2}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{progressbar|90}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143834</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143834"/>
		<updated>2026-03-28T19:01:27Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Usage &amp;amp; Controls */ subsections and audio&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Usage &amp;amp; Controls ==&lt;br /&gt;
&lt;br /&gt;
=== Headphones Setup ===&lt;br /&gt;
&lt;br /&gt;
If you use headphones, or have speakers attached to your headset, enable &amp;quot;Head tracked sound (for headphones)&amp;quot; in the VR Options dialog (in the View menu). This will make surround sound relative to your head orientation. You can also enable binaural audio using HRTF filters in OpenAL to get better stereo surround sound.&lt;br /&gt;
&lt;br /&gt;
=== Enabling VR ===&lt;br /&gt;
&lt;br /&gt;
You can enable / disable VR at startup via the &amp;lt;code&amp;gt;--enable-vr&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; command line options, or using the GUI from the VR Options dialog (in the View menu).&lt;br /&gt;
&lt;br /&gt;
=== VR Specific Controls ===&lt;br /&gt;
&lt;br /&gt;
To use a mouse in VR, use the 360 mouse mode which captures the mouse and allows you to move it all around you. If you are using an OpenXR runtime which supports user presence detection then it will be enabled automatically while you have your headset on (if not you can toggle it manually using a keyboard shortcut).&lt;br /&gt;
&lt;br /&gt;
You can use the following shortcuts on the next branch:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vatop&amp;quot;&lt;br /&gt;
|width=&amp;quot;500&amp;quot; |&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Key combination&lt;br /&gt;
! Mouse combination&lt;br /&gt;
! VR input&lt;br /&gt;
! Action&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Tab}}&lt;br /&gt;
| {{key press|Shift|Right-click}}&lt;br /&gt;
| Put HMD on or take off (see &amp;quot;Enable 360 mouse when VR is in use&amp;quot; setting)&lt;br /&gt;
| Toggle VR/360 mouse mode&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Space}}&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| Recenter VR view position and direction&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make GUI accessible to VR user {{progressbar|90}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|80}} {{priority|2}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{progressbar|90}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143833</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143833"/>
		<updated>2026-03-28T18:50:09Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Usage &amp;amp; Controls */ reword&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Usage &amp;amp; Controls ==&lt;br /&gt;
&lt;br /&gt;
You can enable / disable VR at startup via the &amp;lt;code&amp;gt;--enable-vr&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; command line options, or using the GUI from the VR Options dialog (in the View menu).&lt;br /&gt;
&lt;br /&gt;
You can use the following shortcuts on the next branch:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vatop&amp;quot;&lt;br /&gt;
|width=&amp;quot;500&amp;quot; |&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Key combination&lt;br /&gt;
! Mouse combination&lt;br /&gt;
! VR input&lt;br /&gt;
! Action&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Tab}}&lt;br /&gt;
| {{key press|Shift|Right-click}}&lt;br /&gt;
| Put HMD on or take off (see &amp;quot;Enable 360 mouse when VR is in use&amp;quot; setting)&lt;br /&gt;
| Toggle VR/360 mouse mode&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Space}}&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| Recenter VR view position and direction&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make GUI accessible to VR user {{progressbar|90}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|80}} {{priority|2}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{progressbar|90}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143832</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143832"/>
		<updated>2026-03-28T18:49:26Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Usage &amp;amp; Controls */ describe how to start VR.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Usage &amp;amp; Controls ==&lt;br /&gt;
&lt;br /&gt;
You can enable / disable VR at startup via the &amp;lt;code&amp;gt;--enable-vr&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; command line options, or using the GUI from the View-&amp;gt;VR Options dialog.&lt;br /&gt;
&lt;br /&gt;
You can use the following shortcuts on the next branch:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vatop&amp;quot;&lt;br /&gt;
|width=&amp;quot;500&amp;quot; |&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Key combination&lt;br /&gt;
! Mouse combination&lt;br /&gt;
! VR input&lt;br /&gt;
! Action&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Tab}}&lt;br /&gt;
| {{key press|Shift|Right-click}}&lt;br /&gt;
| Put HMD on or take off (see &amp;quot;Enable 360 mouse when VR is in use&amp;quot; setting)&lt;br /&gt;
| Toggle VR/360 mouse mode&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Space}}&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| Recenter VR view position and direction&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make GUI accessible to VR user {{progressbar|90}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|80}} {{priority|2}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{progressbar|90}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143821</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143821"/>
		<updated>2026-03-28T14:01:16Z</updated>

		<summary type="html">&lt;p&gt;Amalon: add some usage help&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Usage &amp;amp; Controls ==&lt;br /&gt;
&lt;br /&gt;
You can use the following shortcuts on the next branch:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;vatop&amp;quot;&lt;br /&gt;
|width=&amp;quot;500&amp;quot; |&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Key combination&lt;br /&gt;
! Mouse combination&lt;br /&gt;
! VR input&lt;br /&gt;
! Action&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Tab}}&lt;br /&gt;
| {{key press|Shift|Right-click}}&lt;br /&gt;
| Put HMD on or take off (see &amp;quot;Enable 360 mouse when VR is in use&amp;quot; setting)&lt;br /&gt;
| Toggle VR/360 mouse mode&lt;br /&gt;
|-&lt;br /&gt;
| {{key press|Ctrl|Space}}&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| Recenter VR view position and direction&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make GUI accessible to VR user {{progressbar|90}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|80}} {{priority|2}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{progressbar|90}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143820</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143820"/>
		<updated>2026-03-28T11:24:37Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ updates and drop done/old items&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make GUI accessible to VR user {{progressbar|90}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|80}} {{priority|2}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{progressbar|90}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143819</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143819"/>
		<updated>2026-03-28T11:21:18Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* General tasks */ drop old items (stability)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make GUI accessible to VR user {{progressbar|90}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{done}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{progressbar|90}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{progressbar|90}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{progressbar|90}}&lt;br /&gt;
**3D mouse cursors {{done}}&lt;br /&gt;
***mouse leave events on Windows {{progressbar|50}}&lt;br /&gt;
**360 mouse mode {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143818</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143818"/>
		<updated>2026-03-28T11:20:39Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Development targets */ drop old items, and set gui to 90% done&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make GUI accessible to VR user {{progressbar|90}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{done}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{progressbar|90}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{progressbar|90}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{progressbar|90}}&lt;br /&gt;
**3D mouse cursors {{done}}&lt;br /&gt;
***mouse leave events on Windows {{progressbar|50}}&lt;br /&gt;
**360 mouse mode {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143595</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143595"/>
		<updated>2026-02-07T16:42:29Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* General tasks */ head tracked sound is done&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{done}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{progressbar|90}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{progressbar|90}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{progressbar|90}}&lt;br /&gt;
**3D mouse cursors {{done}}&lt;br /&gt;
***mouse leave events on Windows {{progressbar|50}}&lt;br /&gt;
**360 mouse mode {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143586</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143586"/>
		<updated>2026-01-29T12:18:46Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ mouse update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{progressbar|90}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{done}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{progressbar|90}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{progressbar|90}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{progressbar|90}}&lt;br /&gt;
**3D mouse cursors {{done}}&lt;br /&gt;
***mouse leave events on Windows {{progressbar|50}}&lt;br /&gt;
**360 mouse mode {{done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143585</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143585"/>
		<updated>2026-01-29T12:17:14Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ update, vr mouse merged&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 29th January 2026'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
* Head tracked sound&lt;br /&gt;
* 3D mouse cursors, 360 mouse mode&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{progressbar|90}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{done}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{progressbar|90}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{progressbar|90}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{progressbar|90}}&lt;br /&gt;
**3D mouse cursors {{progressbar|90}}&lt;br /&gt;
***mouse leave events on Windows {{not_done}}&lt;br /&gt;
**360 mouse mode {{progressbar|90}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143416</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143416"/>
		<updated>2026-01-07T08:41:42Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ deduplicate&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 24th December 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
&lt;br /&gt;
Pending work for next branch:&lt;br /&gt;
* Head tracked sound, 3D mouse cursors, 360 mouse mode ([https://gitlab.com/flightgear/openscenegraph/-/merge_requests/14 OSG], [https://gitlab.com/flightgear/simgear/-/merge_requests/201 SG], [https://gitlab.com/flightgear/flightgear/-/merge_requests/368 FG], [https://gitlab.com/flightgear/fgdata/-/merge_requests/207 FGData])&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{progressbar|90}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{done}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{progressbar|90}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{progressbar|90}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{progressbar|90}}&lt;br /&gt;
**3D mouse cursors {{progressbar|90}}&lt;br /&gt;
***mouse leave events on Windows {{not_done}}&lt;br /&gt;
**360 mouse mode {{progressbar|90}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143415</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143415"/>
		<updated>2026-01-07T08:37:28Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Source code */ AUR osg link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/flightgear-openscenegraph-git flightgear-openscenegraph-git], [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 24th December 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
&lt;br /&gt;
Pending work for next branch:&lt;br /&gt;
* Head tracked sound, 3D mouse cursors, 360 mouse mode ([https://gitlab.com/flightgear/openscenegraph/-/merge_requests/14 OSG], [https://gitlab.com/flightgear/simgear/-/merge_requests/201 SG], [https://gitlab.com/flightgear/flightgear/-/merge_requests/368 FG], [https://gitlab.com/flightgear/fgdata/-/merge_requests/207 FGData])&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{progressbar|90}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{done}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{progressbar|90}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{progressbar|90}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{progressbar|90}}&lt;br /&gt;
**3D mouse cursors {{progressbar|90}}&lt;br /&gt;
***mouse leave events on Windows {{not_done}}&lt;br /&gt;
**360 mouse mode {{progressbar|90}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Hand tracking {{progressbar|50}}&lt;br /&gt;
** Show hand (basic) {{progressbar|90}}&lt;br /&gt;
** Show hand (skinned) {{not_done}}&lt;br /&gt;
** Direct and intuitive interaction {{progressbar|50}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143414</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143414"/>
		<updated>2026-01-07T08:33:02Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ more updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 24th December 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
&lt;br /&gt;
Pending work for next branch:&lt;br /&gt;
* Head tracked sound, 3D mouse cursors, 360 mouse mode ([https://gitlab.com/flightgear/openscenegraph/-/merge_requests/14 OSG], [https://gitlab.com/flightgear/simgear/-/merge_requests/201 SG], [https://gitlab.com/flightgear/flightgear/-/merge_requests/368 FG], [https://gitlab.com/flightgear/fgdata/-/merge_requests/207 FGData])&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{progressbar|90}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{done}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{progressbar|90}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{progressbar|90}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{progressbar|90}}&lt;br /&gt;
**3D mouse cursors {{progressbar|90}}&lt;br /&gt;
***mouse leave events on Windows {{not_done}}&lt;br /&gt;
**360 mouse mode {{progressbar|90}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Hand tracking {{progressbar|50}}&lt;br /&gt;
** Show hand (basic) {{progressbar|90}}&lt;br /&gt;
** Show hand (skinned) {{not_done}}&lt;br /&gt;
** Direct and intuitive interaction {{progressbar|50}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143413</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143413"/>
		<updated>2026-01-07T08:31:09Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ misc updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 24th December 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
&lt;br /&gt;
Pending work for next branch:&lt;br /&gt;
* Head tracked sound, 3D mouse cursors, 360 mouse mode ([https://gitlab.com/flightgear/openscenegraph/-/merge_requests/14 OSG], [https://gitlab.com/flightgear/simgear/-/merge_requests/201 SG], [https://gitlab.com/flightgear/flightgear/-/merge_requests/368 FG], [https://gitlab.com/flightgear/fgdata/-/merge_requests/207 FGData])&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{progressbar|90}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|80}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{done}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}} {{paused}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|80}}&lt;br /&gt;
* Motion tracking {{done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{progressbar|90}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{progressbar|90}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Mouse support {{progressbar|90}}&lt;br /&gt;
**3D mouse cursors {{progressbar|90}}&lt;br /&gt;
***mouse leave events on Windows {{not_done}}&lt;br /&gt;
**360 mouse mode {{progressbar|90}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143412</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143412"/>
		<updated>2026-01-07T08:20:59Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* General tasks */ general progress, some steamvr on linux issues resolved&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 24th December 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
&lt;br /&gt;
Pending work for next branch:&lt;br /&gt;
* Head tracked sound, 3D mouse cursors, 360 mouse mode ([https://gitlab.com/flightgear/openscenegraph/-/merge_requests/14 OSG], [https://gitlab.com/flightgear/simgear/-/merge_requests/201 SG], [https://gitlab.com/flightgear/flightgear/-/merge_requests/368 FG], [https://gitlab.com/flightgear/fgdata/-/merge_requests/207 FGData])&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{progressbar|80}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|80}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{progressbar|90}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143293</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143293"/>
		<updated>2025-12-24T09:31:26Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 24th December 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]], including shadows etc.&lt;br /&gt;
&lt;br /&gt;
Pending work for next branch:&lt;br /&gt;
* Head tracked sound, 3D mouse cursors, 360 mouse mode ([https://gitlab.com/flightgear/openscenegraph/-/merge_requests/14 OSG], [https://gitlab.com/flightgear/simgear/-/merge_requests/201 SG], [https://gitlab.com/flightgear/flightgear/-/merge_requests/368 FG], [https://gitlab.com/flightgear/fgdata/-/merge_requests/207 FGData])&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143292</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=143292"/>
		<updated>2025-12-24T09:30:45Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ Update status a bit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 24th December 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, working in next. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* [[HDR_Pipeline]].&lt;br /&gt;
&lt;br /&gt;
Pending work for next branch:&lt;br /&gt;
* Head tracked sound, 3D mouse cursors, 360 mouse mode ([https://gitlab.com/flightgear/openscenegraph/-/merge_requests/14 OSG], [https://gitlab.com/flightgear/simgear/-/merge_requests/201 SG], [https://gitlab.com/flightgear/flightgear/-/merge_requests/368 FG], [https://gitlab.com/flightgear/fgdata/-/merge_requests/207 FGData])&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities / work in progress:&lt;br /&gt;
* Frame pipelining improvements.&lt;br /&gt;
* Accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
* Hand tracking.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* PSVR2 Monado Driver, Linux/Wayland (Debian Forky), AMDGPU -- [[User:DMJC|DMJC]] 03:12, 17 December 2025 (UTC)&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141881</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141881"/>
		<updated>2025-05-21T09:50:20Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Source code */ link to osgxr AUR&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the [https://aur.archlinux.org/packages/osgxr osgxr] AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 13th January 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, broken in next pending HDR changes, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Broken in next branch:&lt;br /&gt;
* Pending HDR fixes.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141880</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141880"/>
		<updated>2025-05-21T09:49:51Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Source code */ strike out osgxr branches, they're long stale&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* &amp;lt;s&amp;gt;More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
* &amp;lt;s&amp;gt;More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&amp;lt;/s&amp;gt; (stale)&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 13th January 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, broken in next pending HDR changes, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Broken in next branch:&lt;br /&gt;
* Pending HDR fixes.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141879</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141879"/>
		<updated>2025-05-21T09:48:42Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Source code */ link to nightly builds and AUR packages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. [https://aur.archlinux.org/packages/simgear-git simgear-git], [https://aur.archlinux.org/packages/flightgear-git flightgear-git], [https://aur.archlinux.org/packages/flightgear-data-git flightgear-data-git].&lt;br /&gt;
** On Windows &amp;amp; Linux, you can use the [https://www.flightgear.org/download/nightly/ nightly builds].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 13th January 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, broken in next pending HDR changes, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Broken in next branch:&lt;br /&gt;
* Pending HDR fixes.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141713</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141713"/>
		<updated>2025-04-07T12:03:53Z</updated>

		<summary type="html">&lt;p&gt;Amalon: Drop SF changelog link, development is now on gitlab&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 13th January 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, broken in next pending HDR changes, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Broken in next branch:&lt;br /&gt;
* Pending HDR fixes.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141231</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141231"/>
		<updated>2025-01-13T16:20:54Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 13th January 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, broken in next pending HDR changes, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Broken in next branch:&lt;br /&gt;
* Pending HDR fixes.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141230</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141230"/>
		<updated>2025-01-13T16:10:22Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ Update status a bit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 13th January 2025'''&lt;br /&gt;
&lt;br /&gt;
Stable in release/2024.1 branch, broken in next pending HDR changes, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
VR support is Working in release/2024.1 branch, and enabled in Linux and Windows GitLab CI builds:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Broken in next branch:&lt;br /&gt;
* Pending HDR fixes.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch (stale, needs rebasing):&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken on release/2024.1 branch:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
** Will be fixed with HDR changes.&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141229</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=141229"/>
		<updated>2025-01-13T15:58:31Z</updated>

		<summary type="html">&lt;p&gt;Amalon: Though VR support is still quite basic, its not really experimental any longer, and will be in the next release, so drop experimental header&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 31st March 2024'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:nia|Nia]] ([[User talk:nia|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139597</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139597"/>
		<updated>2024-03-31T11:06:27Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ General HDR Pipeline support in progress&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 31st March 2024'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**General [[HDR Pipeline]] Support {{progressbar|50}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139596</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139596"/>
		<updated>2024-03-31T11:05:31Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ geometry shader multiviewport and OVR_multivew2 are now in progress&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 31st March 2024'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**Geometry shader multi viewport ([[HDR Pipeline]]) {{progressbar|50}}&lt;br /&gt;
**OVR_multiview2 with OSG branch ([[HDR Pipeline]]) {{progressbar|20}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139595</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139595"/>
		<updated>2024-03-31T11:00:44Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ update date&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 31st March 2024'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**Geometry shader multi viewport {{not done}}&lt;br /&gt;
**OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139594</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139594"/>
		<updated>2024-03-31T11:00:22Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Known issues */ HDR support&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* [[HDR Pipeline]] is unsupported, but work to support it is in progress&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**Geometry shader multi viewport {{not done}}&lt;br /&gt;
**OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139593</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=139593"/>
		<updated>2024-03-31T10:59:08Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ currently working on HDR / multiview rendering, monado pretty stable&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Support [[HDR Pipeline]] and accelerated multiview rendering.&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, Oculus App, Windows 10 --[[User:Necolatis|Necolatis]] ([[User talk:Necolatis|talk]]) 13:22, 7 June 2023 (UTC)&lt;br /&gt;
** Works fine, shadows gets rendered, but move when turning the head.&lt;br /&gt;
** Eye view point is about 0.2 meter above where the view is defined, so I have to duck my head to look out through the HUD and stuff.&lt;br /&gt;
* Oculus Quest 2, SteamVR via Virtual Streamer App, Windows 10, Nightly build --[[User:Skyclmbr]]  18:17, 11 October 2023 (UTC)&lt;br /&gt;
** Head tracking works fine, but right eye screen flickers constantly throughout flight&lt;br /&gt;
** Starting head position is off, depending on how much I move around while it's loading on the SteamVR page.&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Windows 10, SteamVR -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 09 July 2023 (UTC)&lt;br /&gt;
** (Using the Windows nightly build 08-Jul-23)&lt;br /&gt;
** The view follows the direction of the headset, but the image stutters; outside scenery and within the cockpit&lt;br /&gt;
&lt;br /&gt;
* HP Reverb G2, Gigabyte (AMD) RX 6700 XT, Debian (Trixie), Monado -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 16:15, 14 August 2023 (UTC)&lt;br /&gt;
** Compiled from sources: OpenXR-SDK-Source, Monado, osgXR (amalon), SimGear (amalon), FlightGear (amalon)&lt;br /&gt;
** The view follows the direction of the headset with minor stuttering.&lt;br /&gt;
**&amp;lt;s&amp;gt;The viewpoint/perspective drifts clockwise, to the right.&amp;lt;/s&amp;gt; &amp;lt;- Drifting is virtually eliminated by adding '[https://gitlab.freedesktop.org/mateosss/basalt Basalt for Monado]' (provides 6DoF).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
*SteamVR, Linux, AMD graphics:&lt;br /&gt;
**Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
**try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
*Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
***There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
*SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
**Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
**May need --disable-sentry&lt;br /&gt;
**Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
**On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
*If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
**On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
*If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
*Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
*If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
==Implementation Details==&lt;br /&gt;
&lt;br /&gt;
===Concepts===&lt;br /&gt;
&lt;br /&gt;
====Interaction Modes====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
*When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
*When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
*When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
*When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
==Roadmap==&lt;br /&gt;
&lt;br /&gt;
===Development targets===&lt;br /&gt;
*Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
**Bare functionality {{done}}&lt;br /&gt;
**Stability {{done}}&lt;br /&gt;
*Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
*Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
**Make launcher accessible to VR user {{not done}}&lt;br /&gt;
**Make splash screen VR friendly {{done}}&lt;br /&gt;
**Make GUI accessible to VR user {{not done}}&lt;br /&gt;
**Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
*Functionality {{progressbar|40}}&lt;br /&gt;
**Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
**Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
===General tasks ===&lt;br /&gt;
&lt;br /&gt;
*Stability {{done}}&lt;br /&gt;
**Clean shutdown {{done}}&lt;br /&gt;
***SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
***SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
*Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
**SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
**Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
**Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
*Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
**Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
**Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
===User facing features ===&lt;br /&gt;
&lt;br /&gt;
*Display {{progressbar|60}}&lt;br /&gt;
**Show views on HMD {{done}}&lt;br /&gt;
**Configurable mirror on desktop window {{done}}&lt;br /&gt;
***Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
***Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
**Geometry shader multi viewport {{not done}}&lt;br /&gt;
**OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
**Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
*Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
**Dynamic toggling of VR {{done}}&lt;br /&gt;
**Sound settings? {{not done}}&lt;br /&gt;
***Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
**Advanced VR settings {{not done}}&lt;br /&gt;
***validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
***osgXR VR mode {{not done}}&lt;br /&gt;
****Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
***osgXR swapchain mode {{not done}}&lt;br /&gt;
*Platform support {{progressbar|70}}&lt;br /&gt;
**Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
**Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
**Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
**Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
**Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
*GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
**Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
**Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
*Launcher {{not done}}&lt;br /&gt;
**Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
**Transition to flightgear {{not done}}&lt;br /&gt;
**Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
**Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
**More VR friendly environment&lt;br /&gt;
***A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
***A hanger (like xplane11)? {{not done}}&lt;br /&gt;
*Controller support {{progressbar|50}}&lt;br /&gt;
**Basic action support in osgXR API {{done}}&lt;br /&gt;
**Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
**Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
**Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
**Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
**Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
***Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
***Force feedback for haptic gloves {{not done}}&lt;br /&gt;
**Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
***Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
***Ability to specify frictions {{not done}}&lt;br /&gt;
***Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
***Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
**Parabolic arc teleport {{not done}}&lt;br /&gt;
**Snap into seats {{not done}}&lt;br /&gt;
**Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
===Aircraft compatibility===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
====[[Cessna 172P]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Flaps {{progressbar|90}}&lt;br /&gt;
***kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
***correct relative friction {{not done}}&lt;br /&gt;
**Opening of doors {{not done}}&lt;br /&gt;
***reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
**External power on (GUI required) {{not done}}&lt;br /&gt;
**External power off (GUI required) {{not done}}&lt;br /&gt;
**Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
*Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
*Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
***Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
**ELT {{progressbar|50}}&lt;br /&gt;
***Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
***Both can get set though&lt;br /&gt;
**Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
***Add limits&lt;br /&gt;
&lt;br /&gt;
====[[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
*Model&lt;br /&gt;
**Floating switches are very noticeable {{not done}}&lt;br /&gt;
**HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R22]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{progressbar|90}}&lt;br /&gt;
***limit range? {{not done}}&lt;br /&gt;
**Collective awkward to get at {{not done}}&lt;br /&gt;
**Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
====[[Robinson R44]] ====&lt;br /&gt;
*Controls&lt;br /&gt;
**Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137631</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137631"/>
		<updated>2023-04-30T14:28:48Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Aircraft compatibility */ note&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make launcher accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Launcher {{not done}}&lt;br /&gt;
** Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
** Transition to flightgear {{not done}}&lt;br /&gt;
** Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
** Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
** More VR friendly environment&lt;br /&gt;
*** A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
*** A hanger (like xplane11)? {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
*** Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
*** Force feedback for haptic gloves {{not done}}&lt;br /&gt;
** Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
*** Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
*** Ability to specify frictions {{not done}}&lt;br /&gt;
*** Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
*** Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== Aircraft compatibility ===&lt;br /&gt;
&lt;br /&gt;
This section is largely about how usable controls are in VR with direct manipulation.&lt;br /&gt;
&lt;br /&gt;
==== [[Cessna 172P]] ====&lt;br /&gt;
* Controls&lt;br /&gt;
** Flaps {{progressbar|90}}&lt;br /&gt;
*** kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
*** correct relative friction {{not done}}&lt;br /&gt;
** Opening of doors {{not done}}&lt;br /&gt;
*** reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
==== [[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
** External power on (GUI required) {{not done}}&lt;br /&gt;
** External power off (GUI required) {{not done}}&lt;br /&gt;
** Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
* Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
* Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
*** Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
** ELT {{progressbar|50}}&lt;br /&gt;
*** Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
*** Both can get set though&lt;br /&gt;
** Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
*** Add limits&lt;br /&gt;
&lt;br /&gt;
==== [[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
* Model&lt;br /&gt;
** Floating switches are very noticeable {{not done}}&lt;br /&gt;
** HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
==== [[Robinson R22]] ====&lt;br /&gt;
* Controls&lt;br /&gt;
** Tilting T-bar {{progressbar|90}}&lt;br /&gt;
*** limit range? {{not done}}&lt;br /&gt;
** Collective awkward to get at {{not done}}&lt;br /&gt;
** Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
==== [[Robinson R44]] ====&lt;br /&gt;
* Controls&lt;br /&gt;
** Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137630</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137630"/>
		<updated>2023-04-30T14:27:12Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Roadmap */ Add aircraft compatibility section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make launcher accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Launcher {{not done}}&lt;br /&gt;
** Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
** Transition to flightgear {{not done}}&lt;br /&gt;
** Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
** Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
** More VR friendly environment&lt;br /&gt;
*** A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
*** A hanger (like xplane11)? {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
*** Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
*** Force feedback for haptic gloves {{not done}}&lt;br /&gt;
** Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
*** Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
*** Ability to specify frictions {{not done}}&lt;br /&gt;
*** Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
*** Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== Aircraft compatibility ===&lt;br /&gt;
&lt;br /&gt;
==== [[Cessna 172P]] ====&lt;br /&gt;
* Controls&lt;br /&gt;
** Flaps {{progressbar|90}}&lt;br /&gt;
*** kinematic needs to be reversible {{progressbar|90}}&lt;br /&gt;
** Visors {{progressbar|70}}&lt;br /&gt;
*** correct relative friction {{not done}}&lt;br /&gt;
** Opening of doors {{not done}}&lt;br /&gt;
*** reversing of gain expression {{not done}}&lt;br /&gt;
&lt;br /&gt;
==== [[Eurocopter EC130 B4]] ====&lt;br /&gt;
* Engine start&lt;br /&gt;
** Engine cutoff lever reversing (Alt+C required) {{not done}}&lt;br /&gt;
** External power on (GUI required) {{not done}}&lt;br /&gt;
** External power off (GUI required) {{not done}}&lt;br /&gt;
** Throttle roll (middle mouse drag required) {{not done}}&lt;br /&gt;
* Take off &amp;amp; flight&lt;br /&gt;
** Arms &amp;amp; hands get a bit in the way {{not done}}&lt;br /&gt;
* Controls&lt;br /&gt;
** Engine cutoff lever {{not done}}&lt;br /&gt;
*** Uses nasal, needs pick animation binding of some sort&lt;br /&gt;
** ELT {{progressbar|50}}&lt;br /&gt;
*** Both /ELT/test and /ELT/armed can be set to bool&lt;br /&gt;
*** Both can get set though&lt;br /&gt;
** Doors &amp;amp; hatches {{not done}}&lt;br /&gt;
*** Add limits&lt;br /&gt;
&lt;br /&gt;
==== [[McDonnell Douglas F-15 Eagle]] ====&lt;br /&gt;
* Model&lt;br /&gt;
** Floating switches are very noticeable {{not done}}&lt;br /&gt;
** HUD should be at infinity {{not done}}&lt;br /&gt;
&lt;br /&gt;
==== [[Robinson R22]] ====&lt;br /&gt;
* Controls&lt;br /&gt;
** Tilting T-bar {{progressbar|90}}&lt;br /&gt;
*** limit range? {{not done}}&lt;br /&gt;
** Collective awkward to get at {{not done}}&lt;br /&gt;
** Throttle roll &amp;amp; governor switch? {{not done}}&lt;br /&gt;
&lt;br /&gt;
==== [[Robinson R44]] ====&lt;br /&gt;
* Controls&lt;br /&gt;
** Tilting T-bar {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137629</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137629"/>
		<updated>2023-04-30T14:11:45Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ expand on hand tracking work&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make launcher accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Launcher {{not done}}&lt;br /&gt;
** Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
** Transition to flightgear {{not done}}&lt;br /&gt;
** Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
** Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
** More VR friendly environment&lt;br /&gt;
*** A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
*** A hanger (like xplane11)? {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
*** Grasp surfaces {{{progressbar|90}}&lt;br /&gt;
*** Force feedback for haptic gloves {{not done}}&lt;br /&gt;
** Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
*** Direct manipulation mouse mode for testing without VR {{progressbar|90}}&lt;br /&gt;
*** Inverse kinematics of translate and rotate animations {{done}}&lt;br /&gt;
*** Ability to specify frictions {{not done}}&lt;br /&gt;
*** Ability to specify ranges (where can't be deduced) {{not done}}&lt;br /&gt;
*** Ability to hint what aircraft processes/filters/kinematics should be reversible {{progressbar|10}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137628</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137628"/>
		<updated>2023-04-30T14:05:16Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ A bunch of hand tracking and direct manipulation work is ongoing and progressing well&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make launcher accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Launcher {{not done}}&lt;br /&gt;
** Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
** Transition to flightgear {{not done}}&lt;br /&gt;
** Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
** Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
** More VR friendly environment&lt;br /&gt;
*** A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
*** A hanger (like xplane11)? {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{progressbar|90}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{progressbar|90}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{progressbar|90}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Knob_and_Slider_Duplication&amp;diff=137303</id>
		<title>Knob and Slider Duplication</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Knob_and_Slider_Duplication&amp;diff=137303"/>
		<updated>2023-02-11T18:58:02Z</updated>

		<summary type="html">&lt;p&gt;Amalon: example unknown location&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Since 2013, knob &amp;amp; slider animations are effectively duplicated if they already take part in certain animations resulting in exaggerated motion.&lt;br /&gt;
This incorrect behaviour will be removed in a future version, which will reduce the motion of these objects.&lt;br /&gt;
&lt;br /&gt;
Warnings have been added to next when this happens. Aircraft developers can work around the issue and silence the warnings by rearranging the XML so that the knob or slider animation node comes before the other animation node. You may need to multiply the animation factor or property-adjust ranges to match the current range of motion.&lt;br /&gt;
&lt;br /&gt;
== Example warning ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[ALRT]:general    Deprecation Alert: The knob/slider animations listed below are getting duplicated.&lt;br /&gt;
[ALRT]:general        This will be fixed in a future version. Please apply workarounds to ensure compatibility.&lt;br /&gt;
[ALRT]:general        For details see: https://wiki.flightgear.org/Knob_and_Slider_Duplication&lt;br /&gt;
...&lt;br /&gt;
[ALRT]:general    Warning: 2x duplication of knob animation on object &amp;quot;AdjustKnob&amp;quot; is deprecated behaviour (see above)&lt;br /&gt;
[ALRT]:general        Animation node at: .../fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/AI/AI-fg1000.xml:142&lt;br /&gt;
[ALRT]:general        Duplicated due to: .../fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/AI/AI-fg1000.xml:38&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you see mention of unknown locations such as the log output below, please raise it on the mailing list so that the code can be added to report which node is to blame:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[ALRT]:general        Duplicated scene node '&amp;lt;name&amp;gt;' at unknown location&lt;br /&gt;
[ALRT]:general            parent 0 named '&amp;lt;parent0&amp;gt;'&lt;br /&gt;
[ALRT]:general            parent 1 named '&amp;lt;parent1&amp;gt;'&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conditions under which this happens ==&lt;br /&gt;
&lt;br /&gt;
Animation nodes of type &amp;quot;knob&amp;quot; and &amp;quot;slider&amp;quot; are affected (in the example above, the &amp;quot;Animation node&amp;quot; starting at AI-fg1000.xml line 142), for any objects which as a result of another animation (in the example above, the &amp;quot;Duplicated due to&amp;quot; node starting at AI-fg1000.xml line 38) causes the object to appear multiple times in the scene graph. Animations which can cause this duplication in the scene graph include:&lt;br /&gt;
* &amp;quot;material&amp;quot; animations&lt;br /&gt;
* &amp;quot;pick&amp;quot;, &amp;quot;knob&amp;quot; and &amp;quot;slider&amp;quot; animations&lt;br /&gt;
* &amp;quot;range&amp;quot; animations&lt;br /&gt;
&lt;br /&gt;
Note that some knob and slider animations are used purely for pick bindings, relying on rotate or translate animations for the actual motion. These are unaffected, and won't trigger warnings.&lt;br /&gt;
In these cases the knob / slider animation either won't have an axis set, or won't have a property set, in which case they already have no effect and the duplication is already fixed without compatibility issues.&lt;br /&gt;
&lt;br /&gt;
== The incorrect behaviour ==&lt;br /&gt;
&lt;br /&gt;
In versions prior to 2013, the animation will have been applied once.&lt;br /&gt;
In versions since 2013, the animation will be applied multiple times (2 times in the example above), so the effect of the animation will be multiplied.&lt;br /&gt;
When the issue is fixed in some future version, the animation will again only be applied once.&lt;br /&gt;
&lt;br /&gt;
Therefore any affected animations created between 2013 and 2023 will have compatibility issues.&lt;br /&gt;
&lt;br /&gt;
== The workaround ==&lt;br /&gt;
&lt;br /&gt;
The XML can be rearranged such that the knob / slider animation (in the example above, the &amp;quot;Animation node&amp;quot; starting at AI-fg1000.xml line 142) is before any causing nodes (in the example above, the &amp;quot;Duplicated due to&amp;quot; node starting at AI-fg1000.xml line 38).&lt;br /&gt;
&lt;br /&gt;
This causes the knob / slider animation to be applied first, avoiding the issue and resulting in consistent behaviour both now and in future versions.&lt;br /&gt;
&lt;br /&gt;
If the animation has been configured by trial and error since 2013, you will need to multiply the animation factor or property-adjust ranges to match the current range of motion (in the example above, by 2x).&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Knob_and_Slider_Duplication&amp;diff=137300</id>
		<title>Knob and Slider Duplication</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Knob_and_Slider_Duplication&amp;diff=137300"/>
		<updated>2023-02-10T19:13:44Z</updated>

		<summary type="html">&lt;p&gt;Amalon: Some more details&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Since 2013, knob &amp;amp; slider animations are effectively duplicated if they already take part in certain animations resulting in exaggerated motion.&lt;br /&gt;
This incorrect behaviour will be removed in a future version, which will reduce the motion of these objects.&lt;br /&gt;
&lt;br /&gt;
Warnings have been added to next when this happens. Aircraft developers can work around the issue and silence the warnings by rearranging the XML so that the knob or slider animation node comes before the other animation node. You may need to multiply the animation factor or property-adjust ranges to match the current range of motion.&lt;br /&gt;
&lt;br /&gt;
== Example warning ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[ALRT]:general    Deprecation Alert: The knob/slider animations listed below are getting duplicated.&lt;br /&gt;
[ALRT]:general        This will be fixed in a future version. Please apply workarounds to ensure compatibility.&lt;br /&gt;
[ALRT]:general        For details see: https://wiki.flightgear.org/Knob_and_Slider_Duplication&lt;br /&gt;
...&lt;br /&gt;
[ALRT]:general    Warning: 2x duplication of knob animation on object &amp;quot;AdjustKnob&amp;quot; is deprecated behaviour (see above)&lt;br /&gt;
[ALRT]:general        Animation node at: .../fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/AI/AI-fg1000.xml:142&lt;br /&gt;
[ALRT]:general        Duplicated due to: .../fgdata/Aircraft/c172p/Models/Interior/Panel/Instruments/AI/AI-fg1000.xml:38&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Conditions under which this happens ==&lt;br /&gt;
&lt;br /&gt;
Animation nodes of type &amp;quot;knob&amp;quot; and &amp;quot;slider&amp;quot; are affected (in the example above, the &amp;quot;Animation node&amp;quot; starting at AI-fg1000.xml line 142), for any objects which as a result of another animation (in the example above, the &amp;quot;Duplicated due to&amp;quot; node starting at AI-fg1000.xml line 38) causes the object to appear multiple times in the scene graph. Animations which can cause this duplication in the scene graph include:&lt;br /&gt;
* &amp;quot;material&amp;quot; animations&lt;br /&gt;
* &amp;quot;pick&amp;quot;, &amp;quot;knob&amp;quot; and &amp;quot;slider&amp;quot; animations&lt;br /&gt;
* &amp;quot;range&amp;quot; animations&lt;br /&gt;
&lt;br /&gt;
Note that some knob and slider animations are used purely for pick bindings, relying on rotate or translate animations for the actual motion. These are unaffected, and won't trigger warnings.&lt;br /&gt;
In these cases the knob / slider animation either won't have an axis set, or won't have a property set, in which case they already have no effect and the duplication is already fixed without compatibility issues.&lt;br /&gt;
&lt;br /&gt;
== The incorrect behaviour ==&lt;br /&gt;
&lt;br /&gt;
In versions prior to 2013, the animation will have been applied once.&lt;br /&gt;
In versions since 2013, the animation will be applied multiple times (2 times in the example above), so the effect of the animation will be multiplied.&lt;br /&gt;
When the issue is fixed in some future version, the animation will again only be applied once.&lt;br /&gt;
&lt;br /&gt;
Therefore any affected animations created between 2013 and 2023 will have compatibility issues.&lt;br /&gt;
&lt;br /&gt;
== The workaround ==&lt;br /&gt;
&lt;br /&gt;
The XML can be rearranged such that the knob / slider animation (in the example above, the &amp;quot;Animation node&amp;quot; starting at AI-fg1000.xml line 142) is before any causing nodes (in the example above, the &amp;quot;Duplicated due to&amp;quot; node starting at AI-fg1000.xml line 38).&lt;br /&gt;
&lt;br /&gt;
This causes the knob / slider animation to be applied first, avoiding the issue and resulting in consistent behaviour both now and in future versions.&lt;br /&gt;
&lt;br /&gt;
If the animation has been configured by trial and error since 2013, you will need to multiply the animation factor or property-adjust ranges to match the current range of motion (in the example above, by 2x).&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Knob_and_Slider_Duplication&amp;diff=137299</id>
		<title>Knob and Slider Duplication</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Knob_and_Slider_Duplication&amp;diff=137299"/>
		<updated>2023-02-10T18:09:32Z</updated>

		<summary type="html">&lt;p&gt;Amalon: Initial text about this issue&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Since 2013, knob &amp;amp; slider animations are effectively duplicated if they already take part in certain animations resulting in exaggerated motion.&lt;br /&gt;
This incorrect behaviour will be removed in a future version, which will reduce the motion of these objects.&lt;br /&gt;
&lt;br /&gt;
Warnings have been added to next when this happens. Aircraft developers can work around the issue and silence the warnings by rearranging the XML so that the knob or slider animation node comes before the other animation node. You may need to multiply the animation factor or property-adjust ranges to match the current range of motion.&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135550</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135550"/>
		<updated>2022-09-11T17:10:31Z</updated>

		<summary type="html">&lt;p&gt;Amalon: aur packages now depend on osgxr&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, you can use the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make launcher accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Launcher {{not done}}&lt;br /&gt;
** Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
** Transition to flightgear {{not done}}&lt;br /&gt;
** Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
** Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
** More VR friendly environment&lt;br /&gt;
*** A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
*** A hanger (like xplane11)? {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135420</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135420"/>
		<updated>2022-08-31T22:12:58Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Roadmap */ thoughts for vr launcher&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make launcher accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make aircraft center accessible to VR user {{not done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Launcher {{not done}}&lt;br /&gt;
** Show launcher in VR similar to GUI when enabled via command line or launcher option {{not done}}&lt;br /&gt;
** Transition to flightgear {{not done}}&lt;br /&gt;
** Transition to aircraft center with VR already started {{not done}}&lt;br /&gt;
** Transition back to flightgear from aircraft center {{not done}}&lt;br /&gt;
** More VR friendly environment&lt;br /&gt;
*** A simple background cubemap, shared with splash {{not done}}&lt;br /&gt;
*** A hanger (like xplane11)? {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135404</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135404"/>
		<updated>2022-08-22T17:14:58Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Source code */ link to windows nightlies&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
** On Windows, you can use the [[Nightly Build#Windows|Windows nightly builds]].&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135403</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135403"/>
		<updated>2022-08-22T17:10:07Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ link to windows nightlies, since they now work&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 22nd August 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch (e.g. [[Nightly Build#Windows|Windows nightly builds]]):&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135375</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135375"/>
		<updated>2022-07-30T23:18:37Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ some equirect splash background experimentation works well, but monado has issues and no fallback for steamvr&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 31st July 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{progressbar|20}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135374</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135374"/>
		<updated>2022-07-30T23:16:32Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ basic rendering of controllers (cuboids)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 31st July 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{not done}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{progressbar|20}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135373</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135373"/>
		<updated>2022-07-30T23:15:11Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ rendering of cuboid VR controllers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 31st July 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
* Rendering of controllers (as basic cuboids).&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{not done}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{not done}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135308</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135308"/>
		<updated>2022-07-12T22:09:33Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* User facing features */ splash screen using quad&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 12th July 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|80}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{done}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{not done}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{not done}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135307</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135307"/>
		<updated>2022-07-12T22:08:43Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Development targets */ splash screen is vr friendly now&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 12th July 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{done}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|50}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{progressbar|90}} {{priority|2}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{not done}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{not done}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135306</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135306"/>
		<updated>2022-07-12T22:06:46Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Performance */ point to corectrl for improved performance on AMD GPUs in particular&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 12th July 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
* If using an AMD GPU, use [https://gitlab.com/corectrl/corectrl CoreCtrl] and set the GPU to the &amp;quot;Virtual Reality&amp;quot; power profile with GPU and memory clocked to max. You may also benefit from changing the CPU frequency governor to Performance.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{progressbar|90}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|50}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{progressbar|90}} {{priority|2}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{not done}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{not done}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135305</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=135305"/>
		<updated>2022-07-12T22:01:08Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ splash screen is now vr friendly on next&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 12th July 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* VR friendly splash screen.&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;s&amp;gt;Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&amp;lt;/s&amp;gt;&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{progressbar|90}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|50}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{progressbar|90}} {{priority|2}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{not done}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{not done}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=134621</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=134621"/>
		<updated>2022-02-09T00:00:27Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Status */ update status date&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 9th Feb 2022'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{progressbar|90}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|50}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{progressbar|90}} {{priority|2}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{not done}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{not done}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=134620</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=134620"/>
		<updated>2022-02-08T23:57:14Z</updated>

		<summary type="html">&lt;p&gt;Amalon: /* Roadmap */ splash screen progress&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Experimental|disclaimer=VR support in flightgear still comes with a number of caveats.}}&lt;br /&gt;
&lt;br /&gt;
{{infobox subsystem&lt;br /&gt;
|image       = VR screenshot c182s.png&lt;br /&gt;
|name        = Virtual Reality&lt;br /&gt;
|started     = 07/2021&lt;br /&gt;
|description = Virtual Reality support using osgXR / OpenXR&lt;br /&gt;
|status      = Active&lt;br /&gt;
|developers  = James Hogan &amp;lt;ref&amp;gt;https://sourceforge.net/u/amalon/profile/&amp;lt;/ref&amp;gt;&lt;br /&gt;
|changelog = https://sourceforge.net/u/amalon/profile/feed.rss&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The '''Virtual Reality''' project aims to add immersive VR support to FlightGear. This is done using the OpenXR&amp;lt;ref&amp;gt;{{cite web |url=https://www.khronos.org/OpenXR/ |title=OpenXR Overview |publisher=The Khronos Group Inc}}&amp;lt;/ref&amp;gt; API, via an external library called osgXR&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;&amp;gt;{{github source |user=amalon |repo=osgXR |full=1}}&amp;lt;/ref&amp;gt; for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
&lt;br /&gt;
A previous attempt to support some form of VR is described in [[OculusImplementation]].&lt;br /&gt;
&lt;br /&gt;
The portable OpenXR API now seems to be getting widespread adoption, which will allow FlightGear to support a variety of VR devices across multiple platforms.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
&lt;br /&gt;
* osgXR source can be found on github&amp;lt;ref name=&amp;quot;github-osgXR&amp;quot;/&amp;gt;, or the version included in the flightgear 3rdparty directory can be used.&lt;br /&gt;
** On ArchLinux, you can install the osgxr AUR package &amp;lt;ref&amp;gt;https://aur.archlinux.org/packages/osgxr/&amp;lt;/ref&amp;gt; to get the version needed by FlightGear's next branches.&lt;br /&gt;
* Some VR code can now be found in FlightGear's next branches (see below for details).&lt;br /&gt;
** On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.&lt;br /&gt;
* More FlightGear changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=flightgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased). A mirror is available on github for issue tracking&amp;lt;ref&amp;gt;{{github source |user=amalon |repo=flightgear-vr}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* More SimGear changes can be found in James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=simgear |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
* More FGData changes can be found on James Hogan's osgxr branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr |full=1}}&amp;lt;/ref&amp;gt; (non-rebased branch), or osgxr_clean branch&amp;lt;ref&amp;gt;{{sourceforge source |user=amalon |repo=fgdata |branch=osgxr_clean |full=1}}&amp;lt;/ref&amp;gt; (clean history, may be rebased).&lt;br /&gt;
&lt;br /&gt;
== Building &amp;amp; Packaging Notes ==&lt;br /&gt;
&lt;br /&gt;
When CMake runs for FlightGear (next or osgxr/osgxr_clean branches), by default it will attempt to enable VR on Windows and Linux (same as &amp;lt;code&amp;gt;-DENABLE_VR=ON&amp;lt;/code&amp;gt;). It will do the following:&lt;br /&gt;
# Look for the osgXR library, and if found it will link against that (same as &amp;lt;code&amp;gt;-DSYSTEM_OSGXR=ON&amp;lt;/code&amp;gt;).&lt;br /&gt;
# If no osgXR library is found it will check for OpenXR and if found it will build its own static built-in copy of osgXR to use.&lt;br /&gt;
# If no OpenXR is found it will disable VR support.&lt;br /&gt;
&lt;br /&gt;
In any case it will print a message along the lines of &amp;lt;code&amp;gt;-- VR support enabled/disabled...&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To avoid implicit dependencies when packaging, packagers may need to do ONE of the following:&lt;br /&gt;
* preferably depend upon an osgXR package providing the osgXR dynamic library&lt;br /&gt;
* OR depend on OpenXR and GLX, and explicitly pass `-DSYSTEM_OSGXR=OFF` to CMake so the built-in osgXR is built statically&lt;br /&gt;
* OR explicitly pass `-DENABLE_VR=OFF` to CMake to disable VR support altogether&lt;br /&gt;
&lt;br /&gt;
== Status ==&lt;br /&gt;
'''Last updated: 21/01/2021'''&lt;br /&gt;
&lt;br /&gt;
Highly experimental, partially in next, partly out of tree. Development in progress.&lt;br /&gt;
&lt;br /&gt;
Working in next branch:&lt;br /&gt;
* Enable/disable at startup via --enable-vr / --disable-vr command line options, or from GUI (View-&amp;gt;VR Options).&lt;br /&gt;
* Displaying stereo images on the HMD.&lt;br /&gt;
* Motion tracking updates HMD views (but doesn't move main camera).&lt;br /&gt;
* Configurable VR mirror (see View-&amp;gt;VR Settings) shown in default camera view (blank, left, right, side-by-side left &amp;amp; right).&lt;br /&gt;
* Visibility mask support.&lt;br /&gt;
&lt;br /&gt;
Working in osgxr/osgxr_clean branch:&lt;br /&gt;
* Controller support for flight (helicopter collective in left hand, helicopter cyclic in right).&lt;br /&gt;
* Controller pointing support with some mouse emulation.&lt;br /&gt;
&lt;br /&gt;
Current priorities:&lt;br /&gt;
* Improving platform support (Monado in particular).&lt;br /&gt;
* Continue to polish controller flight support, add haptics etc.&lt;br /&gt;
* Get started on other controller interaction and controller rendering.&lt;br /&gt;
&lt;br /&gt;
=== Known issues ===&lt;br /&gt;
&lt;br /&gt;
* Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.&lt;br /&gt;
* Performance could be better so crank down the graphics if frame rate is low.&lt;br /&gt;
* Shadows are broken:&lt;br /&gt;
** When shadows are enabled, the FlightGear window doesn't appear to refresh even though buffers are swapped, but VR output works.&lt;br /&gt;
** Sun position is fixed relative to head, presumably because shadow maps are rendered based on master camera, but osgXR only moves slave cams.&lt;br /&gt;
* Spotlights (taxi/landing lights) are relative to camera in default mode&lt;br /&gt;
** Affects default / scene view mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=AUTOMATIC&amp;lt;/code&amp;gt;), as stereo callbacks position cameras&lt;br /&gt;
** Doesn't affect slave cameras mode (&amp;lt;code&amp;gt;--prop:/sim/vr/mode=SLAVE_CAMERAS&amp;lt;/code&amp;gt;), as slave cameras are positioned correctly&lt;br /&gt;
* ALS filters appear to operate in screen space but don't take into account side by side rendering&lt;br /&gt;
* Still some Monado issues:&lt;br /&gt;
** &amp;lt;s&amp;gt;Saturated output due to not using SRGB textures&amp;lt;/s&amp;gt; (use osgXR 0.3.8)&lt;br /&gt;
** &amp;lt;s&amp;gt;Suboptimal depth format used&amp;lt;/s&amp;gt; (osgXR 0.3.8 should end up using GL_DEPTH32F_STENCIL8)&lt;br /&gt;
** Warnings about suggesting bindings of attached action sets when restarting VR (looks like a monado issue at first glance)&lt;br /&gt;
* Multiple SteamVR issues on Linux:&lt;br /&gt;
** If it doesn't close cleanly on Linux it may be due to a SteamVR bug&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;/&amp;gt;, but a ctrl+c / SIGINT on the command line should close it.&lt;br /&gt;
* osgXR doesn't support Direct3D graphics bindings for WMR (it isn't a priority for me). Contributions welcome.&lt;br /&gt;
&lt;br /&gt;
=== Testing ===&lt;br /&gt;
&lt;br /&gt;
VR has been tested with the following hardware &amp;amp; software configurations:&lt;br /&gt;
* HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 21:43, 27 August 2021 (UTC)&lt;br /&gt;
* Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- [[User:vezza|vezza]] ([[User talk:vezza|talk]]) 16:30 27 August 2021 (UTC)&lt;br /&gt;
* HTC Vive, Monado (to window), Linux/X11 (ArchLinux), nVidia proprietary -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
* Monado dummy driver, Linux/X11 (ArchLinux), Intel mesa -- [[User:Amalon|Amalon]] ([[User talk:Amalon|talk]]) 22:36, 17 December 2021 (UTC)&lt;br /&gt;
** only basic display to window tested&lt;br /&gt;
** osgXR master&lt;br /&gt;
** /sim/vr/depth-info=false&lt;br /&gt;
* Monado Dummy HMD, Linux/X11 (Debian), AMD Mesa Drivers [[User:merspieler|merspieler]] ([[User talk:merspieler|talk]]) 23:27, 17 December 2021 (UTC)&lt;br /&gt;
** Applying the following patch: &amp;lt;syntaxhighlight lang=&amp;quot;diff&amp;quot;&amp;gt;&lt;br /&gt;
diff --git a/src/XRState.cpp b/src/XRState.cpp&lt;br /&gt;
index ce09bcd..5bcbbca 100644&lt;br /&gt;
--- a/src/XRState.cpp&lt;br /&gt;
+++ b/src/XRState.cpp&lt;br /&gt;
@@ -1017,7 +1017,7 @@ XRState::UpResult XRState::upSession()&lt;br /&gt;
         unsigned int thisDepthBits = 0;&lt;br /&gt;
         switch (format)&lt;br /&gt;
         {&lt;br /&gt;
-            case GL_RGBA16:&lt;br /&gt;
+            case GL_RGB10_A2:&lt;br /&gt;
                 // FIXME This one will do for now...&lt;br /&gt;
                 if (!chosenSwapchainFormat)&lt;br /&gt;
                     chosenSwapchainFormat = format;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you've got VR working, feel free to add your configuration above.&lt;br /&gt;
&lt;br /&gt;
The following testing is desired:&lt;br /&gt;
* SteamVR, Linux, AMD graphics:&lt;br /&gt;
** Test that motion smoothing works (its unsupported on NVidia)&lt;br /&gt;
** moving head side to side should reproject using depth buffer&lt;br /&gt;
** try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection&lt;br /&gt;
* Monado, Linux:&lt;br /&gt;
** May be awkward to test as it crashes in latest NVidia proprietary drivers&amp;lt;ref&amp;gt;https://gitlab.freedesktop.org/monado/monado/-/issues/122&amp;lt;/ref&amp;gt;.&lt;br /&gt;
*** There's now a workaround mentioned in that ticket that allows for basic testing&lt;br /&gt;
** Use at least osgXR 0.3.6 for monado workaround, or &amp;lt;code&amp;gt;--disable-vr&amp;lt;/code&amp;gt; and enable VR with GUI&lt;br /&gt;
* SteamVR, Windows, with a headset (I've only attempted to null driver, and it at least partly worked):&lt;br /&gt;
** Needs building with at least osgXR 0.3.7 for Windows bindings, and my osgxr/osgxr_clean branch of flightgear/fgdata/simgear&lt;br /&gt;
** May need --disable-sentry&lt;br /&gt;
** Test headset output and controllers&lt;br /&gt;
&lt;br /&gt;
Issues can be reported:&lt;br /&gt;
* On the flightgear-devel [[Mailing lists|mailing list]]&lt;br /&gt;
* To the {{tickets|FlightGear bug tracker}} if the issue is reproducible on the next branch&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=flightgear-vr}} flightgear-vr issue tracker]&lt;br /&gt;
* To the [{{github issues url |user=amalon |repo=osgXR}} osgXR issue tracker] if it is known to be a non-flightgear specific bug in osgXR&lt;br /&gt;
&lt;br /&gt;
But please be aware of the known caveats mentioned above, and the roadmap below.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
Here are some pointers to get the best VR experience.&lt;br /&gt;
* Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.&lt;br /&gt;
** On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.&lt;br /&gt;
* If your frame rate is being capped at the refresh rate of your desktop monitor, try disabling VSync in both flightgear settings and your driver settings&lt;br /&gt;
** On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.&lt;br /&gt;
* If FlightGear is getting throttled by SteamVR (to try and ensure a consistent, if slow, frame rate), consider switching to fixed throttling (in per-application video settings) and playing with the sliders. You may prefer no frame rate throttling but a higher predicted frame time.&lt;br /&gt;
* Enabling multithreading may get you better performance, e.g. &amp;lt;code&amp;gt;--prop:/sim/rendering/multithreading-mode=CullThreadPerCameraDrawThreadPerContext&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
&lt;br /&gt;
=== Concepts ===&lt;br /&gt;
&lt;br /&gt;
==== Interaction Modes ====&lt;br /&gt;
&lt;br /&gt;
Interaction modes are a way of describing (via XML) how a VR controller should look and behave in a particular context. It roughly corresponds to a virtual control you can hold (and let go of), for example:&lt;br /&gt;
* When you're holding a helicopter collective control, the pitch angle of the controller should control the collective pitch (and look like a collective in your hand).&lt;br /&gt;
* When you're pointing the controller at a GUI or cockpit controls it should pick along a line, rendered in a specific way, and emulate mouse events to those controls (and look like a small laser pointer control or a pointing hand/glove).&lt;br /&gt;
* When you're teleporting around, it should pick along a parabolic arc, rendered a specific way, and teleport there when the button is released.&lt;br /&gt;
* When you're using the flight recorder it should treat the controller trackpad as a rewind/fast forward (and look like a fancy TV remote or something).&lt;br /&gt;
&lt;br /&gt;
The definition of interaction modes should be generic enough that custom ones can be provided with aircraft, or defined separately and work with any aircraft, but also powerful enough that a complex and intuitive control can be defined with a minimum of Nasal scripting.&lt;br /&gt;
&lt;br /&gt;
== Roadmap ==&lt;br /&gt;
&lt;br /&gt;
=== Development targets ===&lt;br /&gt;
* Merge stable &amp;amp; minimally functional code into next ({{Merge-request |project=flightgear |id=253}}, {{Merge-request |project=fgdata |id=238}}) {{done}}&lt;br /&gt;
** Bare functionality {{done}}&lt;br /&gt;
** Stability {{done}}&lt;br /&gt;
* Merge some form of desktop mirroring of VR view ({{Merge-request |project=flightgear |id=260}}, {{Merge-request |project=fgdata |id=241}}) {{done}}&lt;br /&gt;
* Merge visibility mask support ({{Merge-request |project=simgear |id=98}}, {{Merge-request |project=flightgear |id=264}}, {{Merge-request |project=fgdata |id=244}}) {{done}}&lt;br /&gt;
* Polish {{not done}}&lt;br /&gt;
** Make GUI accessible to VR user {{not done}}&lt;br /&gt;
** Make splash screen VR friendly {{progressbar|90}}&lt;br /&gt;
* Functionality {{progressbar|40}}&lt;br /&gt;
** Controller flight support {{progressbar|80}}&lt;br /&gt;
*** Haptic feedback {{not done}}&lt;br /&gt;
** Controller interaction support {{progressbar|40}}&lt;br /&gt;
** Walker locomotion / room scale {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== General tasks ===&lt;br /&gt;
&lt;br /&gt;
* Stability {{done}}&lt;br /&gt;
** Clean shutdown {{done}}&lt;br /&gt;
*** SteamVR for Linux hangs on OpenXR app shutdown&amp;lt;ref name=&amp;quot;github-SteamVR-422&amp;quot;&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=422}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
** Handle OpenXR stopping {{done}}&lt;br /&gt;
*** SteamVR for Linux kills running app even if it ends session&amp;lt;ref&amp;gt;{{github issues url|ValveSoftware|SteamVR-for-Linux|number=461}}&amp;lt;/ref&amp;gt;.&lt;br /&gt;
* Resolve questions around VR mirror switching {{done}}&lt;br /&gt;
* Performance {{progressbar|10}}&lt;br /&gt;
** Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) {{not done}}&lt;br /&gt;
** SceneView mode: Combine culling traversal {{not done}}&lt;br /&gt;
** Check why update isn't proceeding in parallel with multithreading {{not done}}&lt;br /&gt;
** Use OpenXR visibility mask extension to avoid rendering to invisible fragments {{done}}&lt;br /&gt;
* Sound {{progressbar|0}}&lt;br /&gt;
** Ensure surround sound is relative to user's head {{not done}}&lt;br /&gt;
** Investigate a way to use appropriate OpenAL binaural mode automatically {{not done}}&lt;br /&gt;
** Specify separate sound device for VR so it switches automatically? {{not done}}&lt;br /&gt;
&lt;br /&gt;
=== User facing features ===&lt;br /&gt;
&lt;br /&gt;
* Display {{progressbar|60}}&lt;br /&gt;
** Show views on HMD {{done}}&lt;br /&gt;
** Configurable mirror on desktop window {{done}}&lt;br /&gt;
*** Left, Right, Left &amp;amp; Right {{done}}&lt;br /&gt;
*** Composited mirror mode (combine &amp;amp; blend views and allow zooming) {{paused}}&lt;br /&gt;
** Geometry shader multi viewport {{not done}}&lt;br /&gt;
** OVR_multiview2 with OSG branch {{not done}}&lt;br /&gt;
* Motion tracking {{progressbar|50}}&lt;br /&gt;
** Follow motion of HMD {{done}}&lt;br /&gt;
** Move master camera instead of scene slave cameras (presumably would fix surround sound) {{not done}}&lt;br /&gt;
* Settings {{progressbar|20}}&lt;br /&gt;
** Mirror settings {{done}}&lt;br /&gt;
** Dynamic toggling of VR {{done}}&lt;br /&gt;
** Sound settings? {{not done}}&lt;br /&gt;
*** Sound reference frame (user's head or room)? {{not done}}&lt;br /&gt;
** Advanced VR settings {{not done}}&lt;br /&gt;
*** validation layer {{not done}}&lt;br /&gt;
*** submit depth information {{done}} but needs testing (SteamVR+Linux+nVidia doesn't do motion smoothing yet)&lt;br /&gt;
*** osgXR VR mode {{not done}}&lt;br /&gt;
**** Fix slave cameras mode clearing {{not done}}&lt;br /&gt;
*** osgXR swapchain mode {{not done}}&lt;br /&gt;
* Platform support {{progressbar|70}}&lt;br /&gt;
** Linux/X11/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Monado support {{progressbar|60}}&lt;br /&gt;
** Windows/OpenGL graphics bindings {{done}}&lt;br /&gt;
** Windows Mixed Reality render via DirectX bindings {{not done}}&lt;br /&gt;
* Splash screen {{progressbar|50}}&lt;br /&gt;
** Show splash screen as quad layer for runtime to composite {{progressbar|90}} {{priority|2}}&lt;br /&gt;
** Cube map/quads background provided by aircraft {{not done}}&lt;br /&gt;
* GUI {{progressbar|10}} {{priority|2}}&lt;br /&gt;
** Shown over mirror on desktop window {{done}}&lt;br /&gt;
** Expose a menubar &amp;amp; GUI, rendered to a quad or cylinder in front of VR user when they activate {{not done}}&lt;br /&gt;
** Interact with GUI buttons etc using controllers as lasers {{not done}}&lt;br /&gt;
* Controller support {{progressbar|50}}&lt;br /&gt;
** Basic action support in osgXR API {{done}}&lt;br /&gt;
** Tie osgXR actions into FG's input system {{done}}&lt;br /&gt;
** Helicopter flight controls (can use for planes too) {{done}}&lt;br /&gt;
** Plane flight controls {{not done}}&lt;br /&gt;
** Render controllers {{not done}}&lt;br /&gt;
** Hand tracking (robot hand) {{not done}}&lt;br /&gt;
** Render skinned hand {{not done}}&lt;br /&gt;
** Basic interaction with controls {{progressbar|80}}&lt;br /&gt;
** Advanced interaction with animated controls {{not done}}&lt;br /&gt;
** Holding axis controls (joystick, yoke, helicopter collective) {{not done}}&lt;br /&gt;
** Haptic feedback {{not done}}&lt;br /&gt;
* Walker VR locomotion / Room scale {{progressbar|0}}&lt;br /&gt;
** Walker follows user {{not done}}&lt;br /&gt;
** Parabolic arc teleport {{not done}}&lt;br /&gt;
** Snap into seats {{not done}}&lt;br /&gt;
** Easy turning around {{not done}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Appendix}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Core development projects]]&lt;/div&gt;</summary>
		<author><name>Amalon</name></author>
	</entry>
</feed>