This thread continues discussion from a thread about Oculus Rift.
I would like discuss here about wider VR hardware support. A few weeks ago an open VR/AR standard has been was presented: OpenXR.
Waiting for OpenXR hardware adoption (manufacturers like Oculus or Valve announced future support) I've started experimenting with another API: OpenVR.
OpenVR is not quite open as name suggest - it still needs a proprietary runtime (SteamVR), but unlike Oculus SDK it is supported on different operating systems and supports hardware from other manufacturers.
The Windows binary and Linux AppImage
release can be downloaded here https://github.com/kwahoo2/FreeCAD/rele ... 19_preVR-1
Connect headset, run SteamVR and then start bin/FreeCAD.exe. Open a model and run View->FreeCAD OpenVR. A new, preview window should appear as soon as SteamVR detects active HMD.
Use analog stick or touchpad of first controller to translate world. Move stick forward - view will move where the controller is pointing. Use second controller to rotate world around two axes. Position of the controller sets center of rotation.
The implementation should work with all OpenVR compatible headsets, including Oculus Rift, HTC Vive, Valve Index and Windows Mixed Reality HMD's. Please report if this works (or not) for you.
I stopped working on the Python script and moved to C++. The code can be found in this fork https://github.com/kwahoo2/FreeCAD
Notes about compilation:
0. Download and install OpenVR SDK from https://github.com/ValveSoftware/openvr
1. Set BUILD_OPENVR to ON
2. Set BUILD_QT5 to ON
3. You may need to specify OpenVR_INCLUDE_DIR (/usr/local/include/openvr in my case)
4. You may need to specify OpenVR_LIBRARY (/usr/local/lib/libopenvr_api.a in my case)
Additional notes about compilation on Windows:
1. OpenVR_LIBRARY should point to lib/win64/openvr_api.lib distributed with the OpenVR SDK
2. openvr_api.dll can be found in openvr\bin\win64
End of update.
1. The code renders two exactly same pictures - wrong buffer configuration?
2. Head tracking is not implemented yet
3. SoFrustumCamera needs further investigation. I'm trying to get necessary variables for the camera from IVRSystem::GetProjectionMatrix and IVRSystem::GetEyeToHeadTransform matrices, but maybe there is a better way? Update:
1. Fix issues
2. Remove SDL dependency, use QOpenGLWidget (?) Update: Check the new offscreen rendering driver in SDL https://hg.libsdl.org/SDL/rev/9692ad570003
3. Port to C++
Initial OpenVR C++ port https://github.com/kwahoo2/FreeCAD/comm ... b8ab0c1e28
4. Add basic navigation
5. Add controllers support (for navigation)
Initial work done
6. Improve rendering quality (antialiasing etc.) and performance - Initial work done
7. Move to OpenXR - initial OpenXR support done https://forum.freecadweb.org/viewtopic. ... 03#p379203
Initially, I started tinkering with jriegel Rift's implementation, but later i found Python bindings for OpenVR pyopenvr
. Basic idea is: write (and experiment with) an implementation in pyopenvr, and then port the code to C++.
Here is the repository: https://github.com/kwahoo2/freecad-pyopenvr
Steps to run the code:
1. Install pyopenvr, and SDL + OpenGL Python packages
2. Run SteamVR
3. Paste the code into FreeCAD