<?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=Gastcan</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=Gastcan"/>
	<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/Special:Contributions/Gastcan"/>
	<updated>2026-04-19T09:30:15Z</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=138562</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=138562"/>
		<updated>2023-10-29T16:18:36Z</updated>

		<summary type="html">&lt;p&gt;Gastcan: &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;
* 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;
* 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>Gastcan</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=138561</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=138561"/>
		<updated>2023-10-29T16:17:34Z</updated>

		<summary type="html">&lt;p&gt;Gastcan: Added note for monado basalt&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;
* 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;
* 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]' (provide 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>Gastcan</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=138167</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=138167"/>
		<updated>2023-08-14T23:32:13Z</updated>

		<summary type="html">&lt;p&gt;Gastcan: Strike-out comment&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;
* 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;
* 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;&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>Gastcan</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=138153</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=138153"/>
		<updated>2023-08-14T16:30:38Z</updated>

		<summary type="html">&lt;p&gt;Gastcan: Added working configuration&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;
* 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;
* 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;
** The viewpoint/perspective drifts clockwise, to the right.&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>Gastcan</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137887</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137887"/>
		<updated>2023-07-11T16:31:04Z</updated>

		<summary type="html">&lt;p&gt;Gastcan: Corrected the 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: 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;
* 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;
* 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, SteamVR, Windows 10 -- [[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;
&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>Gastcan</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137886</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137886"/>
		<updated>2023-07-10T15:36:24Z</updated>

		<summary type="html">&lt;p&gt;Gastcan: &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;
* 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;
* 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, SteamVR, Windows 10 -- [[User:Gastcan|Gastcan]] ([[User talk:Gastcan|talk]]) 02:15, 17 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;
&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>Gastcan</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137885</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137885"/>
		<updated>2023-07-10T15:06:55Z</updated>

		<summary type="html">&lt;p&gt;Gastcan: Update to my comments&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;
* 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;
* 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, SteamVR, Windows 10 -- [[User:Gastcan|Gastcan]] 22:36, 17 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;
&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>Gastcan</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137884</id>
		<title>Virtual Reality</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Virtual_Reality&amp;diff=137884"/>
		<updated>2023-07-10T03:37:14Z</updated>

		<summary type="html">&lt;p&gt;Gastcan: Added working configuration&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;
* 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;
* 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, SteamVR, Windows 10 -- [[User:Gastcan|Gastcan]] 22:36, 17 July 2023 (UTC)&lt;br /&gt;
** Surrounding scenery stutters a bit&lt;br /&gt;
** (Additional details to follow)&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>Gastcan</name></author>
	</entry>
</feed>