|Caution The feature discussed below is currently considered experimental, i.e. must be considered proof-of-concept for the time being. VR support in flightgear still comes with a number of caveats. It's just to showcase what's being worked on. If you'd like to learn more, please get in touch via the developers mailing list.|
|Description||Virtual Reality support using osgXR / OpenXR|
|Contributor(s)||James Hogan |
The Virtual Reality project aims to add immersive VR support to FlightGear. This is done using the OpenXR API, via an external library called osgXR for handling OpenXR and OpenSceneGraph specifics, which is being developed in parallel.
A previous attempt to support some form of VR is described in OculusImplementation.
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.
- osgXR source can be found on github.
- On ArchLinux, you can install the osgxr AUR package  to get the version needed by FlightGear's next branches.
- Some VR code can now be found in FlightGear's next branches (see below for details).
- On ArchLinux, if you're using the -git AUR packages, i.e. flightgear-git, simgear-git, flightgear-data-git, as long as flightgear-git was built from scratch after installing osgxr it should use it.
- More FlightGear changes can be found on James Hogan's osgxr branch (non-rebased branch), or osgxr_clean branch (clean history, may be rebased). A mirror is available on github for issue tracking.
- More SimGear changes can be found in James Hogan's osgxr branch (non-rebased branch), or osgxr_clean branch (clean history, may be rebased).
- More FGData changes can be found on James Hogan's osgxr branch (non-rebased branch), or osgxr_clean branch (clean history, may be rebased).
Last updated: 08/10/2021
Highly experimental, partially in next, partly out of tree. Development in progress.
Working in next branch:
- Enable/disable at startup via --enable-vr / --disable-vr command line options or /sim/vr/enabled property.
- Displaying stereo images on the HMD.
- Motion tracking updates HMD views, but doesn't move main camera.
- Configurable VR mirror (see View->VR Settings) shown in default camera view (blank, left, right, side-by-side left & right).
- Visibility mask support.
Working in osgxr/osgxr_clean branch:
- Improved osgXR detection and VR enable/disable with CMake.
- osgXR currently only supports Linux/X11. Adding alternative graphics bindings should be fairly simple, but isn't a priority for me. Contributions welcome.
- Splash screen is rendered directly onto the left eye viewport which isn't very pleasant in VR.
- Performance could be better so crank down the graphics if frame rate is low.
- If it doesn't close cleanly it may be due to a SteamVR bug, but a ctrl+c / SIGINT on the command line should close it.
- Get started on controller support
VR has been tested with the following hardware & software configurations:
- HTC Vive, SteamVR, Linux/X11 (ArchLinux), nVidia proprietary -- Amalon (talk) 21:43, 27 August 2021 (UTC)
- Oculus Quest 2, SteamVR (ALVR), Linux/X11 (Fedora 34) -- vezza (talk) 16:30 27 August 2021 (UTC)
If you've got VR working, feel free to add your configuration above.
The following testing is desired:
- SteamVR, Linux, AMD graphics:
- Test that motion smoothing works (its unsupported on NVidia)
- moving head side to side should reproject using depth buffer
- try suspending fgfs with Ctrl+Z in terminal (resume with fg) to force reprojection
- Monado, Linux:
- I can't test as it crashes in latest NVidia proprietary drivers.
Issues can be reported:
- On the flightgear-devel mailing list
- To the FlightGear bug tracker if the issue is reproducible on the next branch
- To the flightgear-vr issue tracker
- To the osgXR issue tracker if it is known to be a non-flightgear specific bug in osgXR
But please be aware of the known caveats mentioned above, and the roadmap below.
Here are some pointers to get the best VR experience.
- Ensure your runtime supports asynchronous reprojection, which may alleviate the nausea induced by lower frame rates.
- On Linux / SteamVR / NVidia proprietary driver, ensure you have at least driver version 270.
- 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
- On Linux / NVidia proprietary driver, its found in OpenGL settings in nvidia-settings.
- 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.
- Enabling multithreading may get you better performance, e.g.
- Merge stable & minimally functional code into next (MR #253 (flightgear), MR #238 (fgdata)) Done
- Merge some form of desktop mirroring of VR view (MR #260 (flightgear), MR #241 (fgdata)) Done
- Merge visibility mask support (MR #98 (simgear), MR #264 (flightgear), MR #244 (fgdata)) Done
- Polish Not done
- Functionality Not done
- Stability Done
- Resolve questions around VR mirror switching Done
- Handle shouldRender=false by somehow disabling VR cameras (maybe setting cull mask to 0) Not done
- SceneView mode: Combine culling traversal Not done
- Check why update isn't proceeding in parallel with multithreading Not done
- Use OpenXR visibility mask extension to avoid rendering to invisible fragments Done
User facing features
- Motion tracking
- Mirror settings Done
- Dynamic toggling of VR Done
- Sound settings? Not done
- Advanced VR settings Not done
- Platform support
- Splash screen
- Controller support
- Basic action support in osgXR API Done
- Tie osgXR actions into FG's input system Not done
- Render controllers Not done
- Hand tracking (robot hand) Not done
- Render skinned hand Not done
- Basic interaction with controls Not done
- Advanced interaction with animated controls Not done
- Holding axis controls (joystick, yoke, helicopter collective) Not done
- Haptic feedback Not done
- Walker VR locomotion / Room scale