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 OpenXR support is done. Should work on Windows: Index, Vive, WMR (via SteamVR) and Oculus Rift (not tested) and Linux: Index or Vive + AMD GPU. Update: there is a workaround for Nvidia/Linux now.
You can download Windows build.
This is a release introducing OpenXR support. Open View->FreeCAD-XR to view scene in a virtual reality headset. Click View->FreeCAD-XR second time to close the viewer.
virtual reality headset
OpenXR runtime supporting OpenGL (XR_KHR_opengl_enable extension) eg. SteamVR. Windows Mixed Reality users have to use SteamVR, since the WMR runtime does not support OpenGL directly
(optionally) motion controllers
Scene navigation using motion controllers:
Press the left trigger (first controller) to activate the menu (one of bars will become green), select navigtion scheme and press the trigger second time to apply changes. You cannot move when the menu is active.
analog stick/trackpad of the first (usually left) controller moves viewer forward or backward along the controller axis
analog stick/trackpad of the second (usually right) controller rotates viewer around center of the controller
analog stick/trackpad of the first controller (usually left) moves viewer up/down and left/right
analog stick/trackpad of the second controller (usually right) rotates viewer around center of the HMD and moves forward/backward.
Teleport ray is now available. Point the place when you want to move and press the right (second controller) trigger. Release the trigger and your feet will go to the selected point. Ray stays after teleport to show where you was before teleportation.
Rotation and translation speed can be adjusted now. Press the left trigger (first controller) to activate the menu, adjust speed and press the trigger second time to apply changes.
How to start:
Enable/run your OpenXR runtime (eg. by starting SteamVR) - make sure that OpenXR loader path is set up (Windows registry key "ActiveRuntime" in HKEY_LOCAL_MACHINE\SOFTWARE\Khronos\OpenXR\1, Linux: /etc/xdg/openxr/1/active_runtime.json)
Turn on motion controllers if you want use them
Run FreeCAD, open a 3D model
Start OpenXR session clicking View->FreeCAD-XR menu
Known limitations and issues:
[Linux] Linux users have to use SteamVR 1.14 because of these issues ValveSoftware/SteamVR-for-Linux#421 ValveSoftware/SteamVR-for-Linux#422
[Linux] Nvidia is not supported because of lack of asynchronous reprojection support in SteamVR 1.14.
If you want to run on Nvidia/Linux you have to compile from git and use the latest SteamVR. The workaround is in this commit 5517192
Viewer may crash if reopened several times.
The code can be found in this fork https://github.com/kwahoo2/FreeCAD
Notes about compilation:
0. Download and install OpenXR SDK from https://github.com/KhronosGroup/OpenXR-SDK (note: on Windows build the OpenXR Loader as a DLL)
1. Set BUILD_OPENXR to ON
Commands to build and run from git (recommended):
Code: Select all
git clone https://github.com/kwahoo2/FreeCAD.git cd FreeCAD mkdir -p build cd build cmake .. -DBUILD_OPENXR make -j`nproc` ./bin/FreeCAD
Code: Select all
git clone https://github.com/kwahoo2/FreeCAD.git cd FreeCAD git checkout LinkDaily mkdir -p build cd build cmake .. -DBUILD_OPENXR make -j`nproc` ./bin/FreeCAD
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
Outdated: OpenVR python demo
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
- disable touchpads on WMR - done
- adjustment options for movement, rotation speed - done
- save/load speed values from a config file - done
- remove/comment out experimental code - done
- second, arch-friendly movement scheme - done
- teleport movement - done
- a new testing Windows build - done 22.08.2021, next after collecting feedback
- fix performance issues - partially done, needs deeper investigation. There is a new build a top of the LinkDev branch.
- ability to reopen closed window - TODO crashes at 3rd attempt (SteamVR linux v 1.14) Update: this seems not happen with Monado?
- fix rotation center issue - done
- better navigation for small parts based on user feedback 1, 2 - TODO - the simplest idea is probably a movable center of rotation that can be placed anywhere in the scene
- rotate menu forward for better visibility - TODO
- improve lighting for better visibility of a model, some ambient light? - TODO
- autostart of Oculus software - TODO, not sure if can be done?
- fix issues on exit - TODO
- fix the mirror viewer on Windows (is this AMD-only issue?), it should not be semi-transparent TODO