Free software support for virtual and augmented reality
A talk at the recent X.Org Developers Conference in Montréal, Canada looked at support for "XR" in free software. XR is an umbrella term that includes both virtual reality (VR) and augmented reality (AR). In the talk, Joey Ferwerda and Christoph Haag from Collabora gave an overview of XR and the Monado project that provides support for those types of applications.
Ferwerda started by defining the term "HMD", which predates VR and AR. It is a head-mounted display, which basically means "taking a screen and some sensors and duct-taping it to your face". All of the devices that are being used for XR are HMDs. They typically include some kind of tracking system to determine the position and orientation of the HMD itself. Multiple different technologies, including inertial measurement units (IMUs), photodiodes, lasers, and cameras, are used to do the tracking depending on the device and its use case.
AR is intended to augment the real world with extra information; the user sees the real world around them, but various kinds of status and additional data is tagged to objects or locations in their view of the world. AR is a rather over-hyped technology these days, he said. The general idea is that users would wear glasses that would augment their view in some fashion, but, unfortunately, what most people think of as AR is Pokémon Go.
VR uses two screens, one for each eye, to create a 3D world that the user inhabits and can interact with in some fashion. Instead of seeing the real world, the user sees a completely separate world. There are two words that are often used to describe the feel of VR, he said: "presence" and "immersion". That means users are aware of themselves as being part of the VR environment.
XR encompasses both. Ferwerda said that he is not really sure what the "X" stands for; he has heard "cross reality" and "mixed reality" for XR. Haag said that "extended reality" was another definition that he had heard.
Monado and OpenXR
The project that they have been working on is Monado, which is a free-software OpenXR runtime for Linux. OpenXR is a standard from the Khronos Group, which is also the organization behind OpenGL, Vulkan, and various other graphics-related standards.
![Christoph Haag [Christoph Haag]](https://static.lwn.net/images/2019/xdc-haag-sm.jpg)
Ferwerda made way for Haag, who said that prior to OpenXR, each XR engine had to support each different XR runtime. The XR runtimes are generally device-specific. That creates something of a combinatorial explosion to support all of the devices from each engine, as can be seen on slide 16 in their slides [PDF]. With OpenXR, the device runtimes provide an application interface that allows any XR engine to work with any device runtime that supports the standard. Eventually, the OpenXR standard will add a device layer between the device runtimes and the hardware, he said.
The stack for XR handling consists of three layers. There is a program that does VR or AR sitting atop a software platform that does rendering and handles the input devices. That platform interfaces with the hardware that has the sensors to provide the input as well as the devices to display the rendered data.
Haag went through a brief introduction to the application API, which is similar in some ways to the Vulkan API for 3D graphics. More information can be found in the slides, in the YouTube video from XDC, or on the OpenXR site. The standard is still a work in progress, he said, so it doesn't support everything needed for AR yet, for example.
An application will start by creating an XR instance that is a handle to be used throughout. There are modes for handheld devices, such as smartphones, and for HMDs, as well as view modes for single or dual displays, which can be attached to the instance. Sessions are created for a particular rendering type; there are multiple types available, such as OpenGL, OpenGL ES, Vulkan, and several versions of Direct3D. There is no support for multiple sessions at this point, so you cannot overlay two (or more) application's output, though he thinks that will change in the future. VR desktops will need that ability, for example.
![Joey Ferwerda [Joey Ferwerda]](https://static.lwn.net/images/2019/xdc-ferwerda-sm.jpg)
Rendering is handled by a cycle of three calls: waiting for the previous frame to finish rendering, beginning the next frame, and ending it. The position data for the next frame will be predicted by OpenXR so that the scene can be rendered for the expected orientation and position (i.e. "pose") when the frame will be displayed. Inputs from controllers are handled in the API as "actions", which are similar to those in the OpenVR API from Valve for its SteamVR platform.
The last year or two have been "really good" in terms of supporting XR graphics on Linux, Ferwerda said, taking back the microphone; there have been additions to the kernel and the display drivers to make things work better. Extended mode has been around for a while; in that mode, the VR display is treated as another screen where windows can be placed to display the content. That works, but there is somewhat painful manual setup for users and it introduces extra latency, he said.
Direct mode for VR graphics has been added more recently. It relies on Keith Packard's work to allow device "leases" for rendering using kernel modesetting (KMS) drivers without X or Wayland getting in the way. In order to get a "less nausea-inducing" display when the generated frame rate is lower than the rate supported by the device, reprojection is used to duplicate frames or make small changes to existing frames based on movement predictions to fill in, he said.
The VR hardware is pretty much all Vulkan-based, so that is what is used for rendering. If the application is OpenGL-based, it can use the Vulkan-OpenGL interoperability mode, but that only works for some hardware, Ferwerda said. Display correction is another piece of the puzzle; lenses are not perfect, they have distortion and chromatic aberrations that need to be corrected for.
Hardware support
For hardware, Monado supports "whatever we can find". That includes the Open Source Virtual Reality (OSVR) Hacker Developer Kit (HDK), which is no longer available but well supported. There has been a lot of reverse-engineering work done by the project for supporting other devices. In addition, the OpenHMD project has a C library that has at least some partial support for a wide range of hardware.
The project has also gotten the Razer Hydra game controller "working to some degree". That week, support for the PlayStation VR and PlayStation Move controller was merged, he said. This is the first full-featured support for a device that people already have or can fairly easily get their hands on (for less than €300), he said.
There are other notable free and open-source software projects, he said. One is libsurvive, which supports the lighthouse tracking used by the HTC Vive HMD. Another is maplab, which supports tracking using simultaneous mapping and tracking (SLAM). For SLAM tracking, the headset is actually mapping the room it is in; it is the "next big thing" in XR.
Even though XR is relatively new, Ferwerda said, there has been a community looking at the devices from a free and open standpoint for some time now. People have gotten the devices and been frustrated that there was no driver for them, so they started reverse engineering them. He has been part of that community since 2013, going to FOSDEM and other events, "getting an apartment and a lot of beer" with like-minded folks to work on making the hardware work on various operating systems. He noted that an OpenBSD developer spent a lot of time getting that system ready for VR, which put it ahead of Linux at the time.
![Monado demo [Monado demo]](https://static.lwn.net/images/2019/xdc-monado-sm.jpg)
Reverse engineering is a major part of getting the hardware to work, but there is hope that this will eventually change. There have been efforts to create more open platforms, but that is not a reality yet, he said. These devices share a fair amount of the same components, which makes it somewhat easier, but it still takes a lot of looking at Wireshark traces to see if you can find accelerometer and gyroscope information from the IMU, for example. Figuring out how to access the camera and how to interface with the display modes is also part of the fun.
Next up was a demo, of sorts, which can be seen in the photo (and in the video, of course). It was a recording of the classic glxgears running in a VR context. It is displayed by a custom compositor, displaying output rendered by Vulkan, and was shown in the orientation required by a particular VR headset. Each display is rotated and corrected for the needs of that device.
It has been a lot of fun working on Monado, Ferwerda said. The project was able to release an OpenXR implementation at the same time the specification was released. Only Monado and Microsoft were able to release a usable implementation at that time, "which was really cool". They hope to continue working on Monado to add more support for OpenXR and XR hardware; he asked for those interested to get in touch with the project to help make that a reality.
[I would like to thank the X.Org Foundation and LWN's travel sponsor, the Linux Foundation, for travel assistance to Montréal for XDC.]
Index entries for this article | |
---|---|
Conference | X.Org Developers Conference/2019 |
Posted Oct 10, 2019 15:25 UTC (Thu)
by admalledd (subscriber, #95347)
[Link] (1 responses)
Posted Oct 10, 2019 18:24 UTC (Thu)
by simcop2387 (subscriber, #101710)
[Link]
Posted Oct 13, 2019 16:21 UTC (Sun)
by nix (subscriber, #2304)
[Link] (5 responses)
This may be my paranoia speaking, but this has always seemed to me to be incompatible with people who need glasses that *act like glasses*. If you can't see more than six inches in front of you without £600 of prescription lenses, you're not going to be able to wear VR glasses instead, glasses over glasses are terrible at best, and it is enormously unlikely that you'll ever be able to convince the optical lens makers to support VR glasses (hell, the ones I'm forced to use only let me use about 10% of available frames -- obviously, the most expensive -- because the others "won't fit the lenses", yeah right, it's odd the ones that won't fit the lenses are always the ones that don't cost £200 for the frames alone. Will they support VR frames or whatever? Not in the next fifty years, I fear.)
Not that I'll ever be using this stuff anyway. I don't even have stereo vision: what does VR buy me over a screen? Not a lot. (Other than seasickness.)
Posted Oct 13, 2019 20:14 UTC (Sun)
by excors (subscriber, #95769)
[Link]
Unlimited field of view. A sense of scale. Depth perception due to parallax shifts during small subconscious movements of your head and body. Directional audio which reacts to your head. All that stuff gives you a stronger sense of presence within the virtual world than is possible with a standard monitor. Plus hand-tracking controllers, so you can pick up and look at and interact with virtual objects using your hands as if they were real. Stereo vision is only a minor part of VR.
Posted Oct 14, 2019 16:15 UTC (Mon)
by madscientist (subscriber, #16861)
[Link] (1 responses)
Posted Oct 14, 2019 16:45 UTC (Mon)
by excors (subscriber, #95769)
[Link]
(One related issue is that your eyeball's lens changes shape when trying to focus on a nearby object, but the VR headset's lenses are designed to make the screen look like it's at a fixed distance (maybe a couple of meters in front of you). When holding a virtual object near your face, that mismatch makes the image blurry. It can be helpful to close one eye, because then you lose the parallax depth cues that trigger the change in lens shape, and then it's easy to focus at the right distance. But if you have poor eyesight, you're permanently in that state of not being able to focus at the right distance.)
Posted Oct 15, 2019 14:15 UTC (Tue)
by tao (subscriber, #17563)
[Link] (1 responses)
This isn't a new situation. Deaf people won't be able to make use of audible UI cues. People with limited tactile sense won't benefit from tactile feedback. Colour-blind people won't benefit from colour coding.
Anyway, while I'm sure that you're right about early generation augmented vision not being accessible to people with the extremer forms of corrective lenses, googling found me a report that almost 50% of the population in Europe are reported to wear glasses (yes, I'm totally surprised that it is that high). Missing out on half of all customers isn't an option, long-term.
Posted Oct 16, 2019 15:17 UTC (Wed)
by nix (subscriber, #2304)
[Link]
Yeah, that's why I expect someone will fix this soon enough. Half the development teams for these products probably wear glasses. Perhaps 10% of them likely wear rather strong ones..
Free software support for virtual and augmented reality
Free software support for virtual and augmented reality
Free software support for virtual and augmented reality
Free software support for virtual and augmented reality
Free software support for virtual and augmented reality
Free software support for virtual and augmented reality
Free software support for virtual and augmented reality
Free software support for virtual and augmented reality