OpenXR/OpenVR (virtual reality support)

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
mittkonto
Posts: 6
Joined: Sun Nov 17, 2019 3:05 pm

Re: OpenXR/OpenVR (virtual reality support)

Postby mittkonto » Sat Jan 25, 2020 12:52 pm

Oh my :shock:

I have a dell visor and would love to serve as a guinea pig for this!
User avatar
Kunda1
Posts: 7548
Joined: Thu Jan 05, 2017 9:03 pm

Re: OpenXR/OpenVR (virtual reality support)

Postby Kunda1 » Sun Mar 15, 2020 4:25 pm

Hows this effort proceeding?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
kwahoo
Posts: 276
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: OpenXR/OpenVR (virtual reality support)

Postby kwahoo » Sat Mar 21, 2020 10:51 pm

I made the first step towards truly vendor-independent VR implementation in the FreeCAD. This commit implements initial OpenXR support: https://github.com/kwahoo2/FreeCAD/comm ... e70ab1faaf

To compile the code, OpenXR SDK is needed https://github.com/KhronosGroup/OpenXR-SDK The BUILD_OPENXR option has to be set to ON.
To run an OpenXR runtime and loader is needed. On Linux this is delivered by Monado. Monado has limited support for a bunch of HMD's including HTC Vive, Valve Index and Sony Playstation VR.
Path for the OpenXR loader have to be defined before running the FreeCAD, eg.:

Code: Select all

XR_RUNTIME_JSON=/usr/local/share/openxr/1/openxr_monado.json freecad
On Windows OpenXR is supported by Windows Mixed Reality and Oculus headsets. I have NOT tested them due lack of hardware.

The initial OpenXR support I've implemented does not cover motion controllers and positional tracking is not tested. View can be moved by keyboard, same way as in the JR's original Rift implementation. This is because of limited support of my hardware in Monado library.

I hope, I'll see full OpenXR support by mine HMD manufacturer (Valve) in the near future. This is the main thing stopping me now:(
In the future the OpenXR should replace all VR backends in the FreeCAD, including original Rift support by Juergen and my OpenVR implementation.

Note: the openxr.hpp header requires C++14. This may (or not?) be an issue during merge.
vocx
Posts: 4364
Joined: Thu Oct 18, 2018 9:18 pm

Re: OpenXR/OpenVR (virtual reality support)

Postby vocx » Sat Mar 21, 2020 11:05 pm

kwahoo wrote:
Sat Mar 21, 2020 10:51 pm
...
Note: the openxr.hpp header requires C++14. This may (or not?) be an issue during merge.
Werner, the main developer of FreeCAD, has mentioned that FreeCAD isn't exactly the best place to try newer C++ features. He wants FreeCAD to be C++11 compliant but I'm not sure how much other standards are allowed.
wmayer wrote:
Wed Feb 19, 2020 2:29 pm
FreeCAD is rather conservative with respect to the compiler version it uses because it emphasizes that it can be built on all supported releases of the most important Linux distributions (Debian, Ubuntu, openSuse, Fedora, ...). So, at the moment no C++ language features that require a higher version than C++14 should be used in the code.

If your units library requires C++20 or higher then it's not an option for FreeCAD at the moment.
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
User avatar
Kunda1
Posts: 7548
Joined: Thu Jan 05, 2017 9:03 pm

Re: OpenXR/OpenVR (virtual reality support)

Postby Kunda1 » Mon Mar 23, 2020 2:44 pm

Nevertheless, VR is the future. Blender is now getting more VR integration
see https://twitter.com/blender_org/status/ ... 6237722626
So this is an enormous step in the right direction. I hope we can sort out the c++ standard issues as we roll in to the future.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
kwahoo
Posts: 276
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: OpenXR/OpenVR (virtual reality support)

Postby kwahoo » Sun May 03, 2020 6:39 pm

Sad news for Mac users:
SteamVR has ended macOS support so our team can focus on Windows and Linux.
We recommend that macOS users continue to opt into the SteamVR [macos] branches for access to legacy builds.
Users can opt into a branch by right-clicking on SteamVR in Steam, and selecting Properties... -> Betas.
With lack of OpenXR support this means basically death of VR on Mac.
kwahoo
Posts: 276
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: OpenXR/OpenVR (virtual reality support)

Postby kwahoo » Sat Jun 13, 2020 3:01 pm

Small update:
Valve released OpenXR Developer Preview for SteamVR
Unfortunately there is an issue. An OpenGL app (like FreeCAD) needs XR_KHR_opengl_enable extension. But it isn't supported by some runtimes.

At this moment:
  • SteamVR runtime on Windows supports XR_KHR_vulkan_enable, XR_KHR_D3D11_enable and XR_KHR_D3D12_enable is planned
  • SteamVR runtime on Linux supports XR_KHR_vulkan_enable
  • Windows Mixed Reality runtime on Windows supports XR_KHR_D3D11_enable and XR_KHR_D3D12_enable
I asked about OpenGL support in SteamVR-OpenXR.

Blender workaround this issue by OpenGL-Direct3D shim. At this point Blender VR can run on Windows/SteamVR but not Linux/SteamVR.

If we cannot get XR_KHR_opengl_enable support, we need similar shim, but probably OpenGL-Vulkan instead OpenGL-Direct3D makes more sense because of cross-platform support.

EDIT 19.06.2020

https://store.steampowered.com/newshub/ ... 1406562401
OpenXR:

Added support for OpenGL on Linux. (Windows support for OpenGL is on the way.)
User avatar
Kunda1
Posts: 7548
Joined: Thu Jan 05, 2017 9:03 pm

Re: OpenXR/OpenVR (virtual reality support)

Postby Kunda1 » Wed Jul 08, 2020 4:00 pm

Any progress? :)
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features