I was wondering if anyone has been playing around with OF and the Vive on Linux. I finally got the ofxOpenVR addon to work but I only get 30 FPS which will make you very nauseous, very quickly.
The computer I’m using is quite powerful and doesn’t have any trouble running the Vive on Windows. The SteamVR tutorial in Linux also seems a bit slower than the Windows version (though not much) so I’m wondering if this delay is somehow caused by the addon, or if this comes from Steam’s OpenVR-for-Linux (seeing as the author of ofxOpenVR is using Windows and there hasn’t been any activity in the repo for 5 months I guess the Windows version doesn’t have this problem).
To get ofxopenvr to work (using the gcc-6 nightly of OF) I had to make some small changes to the code, which you can find in my fork over here ).
Reading over the README.md of the SteamVR-for-Linux repo again, I noticed the following line:
OpenGL applications are currently too slow to use interactively; only the Vulkan Submit path is optimal.
The version of gcc depends on what you have installed; run gcc -v to see what version you have.
I trief a lot of different things to get this (+ some other VR options) to work, so I might have have taken steps that are unnecessary or did something I forgot (hope not). I don’t have access to my machine that uses the Vive right now so this is all from memory. What I THINK should be a working route is:
Get the 775.27.15 NVidia Vulkan Driver from >this page<. You’ll need to exit the graphical part of your OS to be able to install the driver, I think on Ubuntu that’s something like CTRL + ALT + F3 to open a terminal, then sudo /etc/init.d/gdm stop. After that you should be able to run the installer file.
I had some trouble installing them because of existing drivers, so ended up running apt-get remove "nvidia-*" to get rid of those. Keep in mind this is a very destructive command that might remove more than you intended (like also remove X)! Don’t use this if you don’t know how to repair your system if you run into trouble.
When running the ofxopenvr example I noticed it was looking for certain config files I wasn’t able to find any documentation for. It seems installing SteamVR was an easy way to get these files created (see next steps).
Install Steam. After install go to settings and opt-in to the beta (there is a dropdown where you can select this). Then, go to Library -> Tools, right-click SteamVR, go to its settings and also opt in to that beta (again, using a dropdown). Then rightclick SteamVR again and install.
After installation, you should be able to run SteamVR (for me, the VR button in the top right hand corner of Steam didn’t work and would actually break things sometimes. Instead, select SteamVR in your library and hit the play button there).
A menu pops up showing the status of your device. It has a dropdown menu where you can select Room Setup to setup up the play area, or run Tutorial to see if everything is working.
Clone my repo into the addons folder of your OF installation. It already contains the openvr headers.
Copy libudev.so.0 into your project folder (like example-simple). Use locate libudev.so.0 to find its location; in my case I copied the files using: cp /home/javl/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/libudev.so.0 path/to/addons/ofxopenvr/example-simple
With SteamVR running in the background, you can then start your example. Again, I’m not (yet) sure of this setup so using your feedback we might be able to pinpoint the actual steps. Though I think it will be worth checking if the Vulkan Renderer will work first, because at the moment you get 30FPS which is absolutely unworkable for VR.
The problem with the Vulkan renderer only outputting 60 FPS was because of its rendermode: the one specified in the examples is not available on Linux, which made the Vulkan renderer fall back to the default one.
The available options on my system are FIFO_KHR, FIFO_RELAXED_KHR and IMMEDIATE_KHR. The first one is the default one which is available on all Vulkan systems and is quite slow. The second ramped the speed up to about 80 FPS, but the last one took it all the way to 6000(!). This rendermode can lead to tearing as it tried to output images as fast as possible, but I can imagine this won’t be a problem if you limit the FPS to the needed 90/100FPS.
The problem I’m facing now is that ofxOpenVR does not work with this new renderer as it uses openGL. I’d love to try and port it, but I have no idea if I’ll be able to do so with my limited knowledge.
I haven’t, to be honest. I’ve been doing some small experiments in Unity, but it would still be great to be able to use OF instead.
I believe my main problem at the time, after getting the VK renderer to work, was that it means you can’t use opengl, which was used by the VR add-on. I don’t really have the know-how / time to port it to Vulkan.
The text you linked to is a great read with a lot of background info on the whole process. Thanks for that.