Godot Engine

Godot Engine

Not enough ratings
[WIP] Using SteamVR OpenXR (Monado) with Godot on Linux
By ⑨
This guide is mainly focused on explaining how to use SteamVR OpenXR implementation, within Godot, on Linux systems, using the plugin provided here : https://github.com/GodotVR/godot_openxr

Yes, it's a 100% hipster guide.

It's currently in progress, since I'm just at a state where "I got it working". Compiling the OpenXR plugin can be quite tricky if you don't already have an OpenXR development setup ready.

Also, if you're able to compile and get the Godot OpenXR plugin working on Windows (with a nice screenshot), I'm all for upgrading this guide to Windows/Linux. Same thing for Mac OS X.

Requirements

TODO : Get the complete list of requirements for Ubuntu and Arch Linux.

You'll need, at least :
  • build tools (build-essential on Debian);
  • git
  • OpenXR development headers in /usr/include/openxr ( libopenxr-dev on Ubuntu Groovy, openxr-headers-git on Arch Linux AUR repository ) ;

    The way it seems to be working

    Basically, the whole setup seems to be :

    Godot -> OpenXR plugin -> libopenxr_loader.so (provided by SteamVR) -> libopenxr_steamvr.so -> your hardware (headset, knuckles, base stations).

    Switch to SteamVR OpenXR

    Currently, the only way is to switch to SteamVR Beta, as stated on SteamVR news hub : https://store.steampowered.com/newshub/app/250820/view/2396425843528787269

    Here's a copy-paste of the procedure :
  • Right click on SteamVR in your Steam library and select Properties
  • Click on the Betas tab
  • Pick "beta - SteamVR Beta Update" from the list

    Since it's a beta, you understand that it might break unexpectedly and create unknown problems.

    Start vrmonitor and see if it detects your hardware.
    If it cannot start, check for /tmp/monado_* (ls /tmp/monado_*) lock files. Delete them if they're present.

    Compile the Godot OpenXR plugin

    The plugin is available here : https://github.com/GodotVR/godot_openxr

    Forget about the whole "let's recompile godot with debug support", since the plugin is working with Steam version of Godot just fine (on my setup).

    The whole "git" and compile setup is quite simple, though don't forget to get the "submodules", else you'll get compilation errors about unavailable godot headers.

    git clone --depth 1 https://github.com/GodotVR/godot_openxr cd godot_openxr git submodule init git submodule update scons platform=linux

    Test the setup with the plugin demo project

    Fire up Godot, through Steam, and import the project located at /where/you/git/godot_openxr/demo.
    Start the game (using the play button on the top right) and check that :

  • The game scene is displayed through your VR headset
  • You can move your arms with the knuckles controllers (or whatever VR controller you're using).
  • You can slightly move inside the scene by moving the VR headset (you can hold it in your hands, if you get motion sick)

    This demo scene has no support for teleportation, or just moving with the controllers, so forget about that.

    If things don't work here... something's wrong but I have no idea how to determine what's wrong.
    Paste the debug output you get in the "Output" and "Debugger" pane of the Godot project in these comments, and someone *might* be able to help you.

    Copy the plugin somewhere

    If you got the plugin working, you'll now have to copy addons/godot-openxr (current path : /where/you/git/godot_openxr/demo/addons/godot-openxr ) into a specific folder.
    Then, for every Godot project where you'd like to use OpenXR, you'll have to copy godot-openxr in the addons/ subfolder of these projects.

    Get the official Godot VR demo working with the OpenXR plugin

    Grab the tutorial scene ( VR_Starter_Tutorial_Complete.zip ) at the bottom of this page : https://docs.godotengine.org/en/3.1/tutorials/vr/vr_starter_tutorial.html#final-notes

    Unzip it somewhere, copy your previously saved godot-openxr addon into /where/you/unzipped/VR_Starter_Tutorial_Complete/addons.

    Open Godot, import the unzipped and prepared VR_Starter_Tutorial_Complete. Then, BEFORE RUNNING IT, edit the script Game.gd attached to the Game root node (click the script icon at the right of the node) and replace "OpenVR" by "OpenXR" inside
    var VR = ARVRServer.find_interface("OpenXR")
    .THEN run the example and have fun with the default example.

    Note that moving in this demo is still tricky (with the Valve knuckles at least), since they implemented teleportation by pressing the trigger, aiming at a teleportation point, then releasing the trigger.
    Grabbing is done with the A button, and you cannot teleport if you grabbed two elements.
    Also the first text texture in front of you is upside-down...

    Still, you can move around, grab the sword, the guns, the shotgun and the grenades and test them.
    The pink spheres have to be attacked with a weapon multiple times before they break.
    The green cubes can be grabbed or shot.

    TODO

  • Find a way to prebuild the OpenXR plugin (Docker/Podman + Github/Gitlab CI might do the trick).
  • Provide the actual list of dependencies for Ubuntu and Arch Linux
  • Test this on others setups
   
Award
Favorite
Favorited
Unfavorite
Requirements
TODO : Get the complete list of requirements for Ubuntu and Arch Linux.

You'll need, at least :
  • build tools (build-essential on Debian)
  • git
  • OpenXR development headers in /usr/include/openxr and loader /usr/lib/libopenxr_loader.so ( libopenxr-dev libopenxr-loader1 on Ubuntu Groovy, openxr-headers-git openxr-loader-git on Arch Linux AUR repository )
Some ideas of how it seems to be working
Basically, the whole setup seems to be :

Godot -> OpenXR plugin -> libopenxr_loader.so -> ??? -> SteamVR ( vrclient.so ) -> your hardware (headset, knuckles, base stations).

I still have no idea how SteamVR is able to divert libopenxr_loader.so (the library the Godot plugin is linked to) to their vrclient.so .
Switch to SteamVR OpenXR
Currently, the only way is to switch to SteamVR Beta, as stated on SteamVR news hub : https://store.steampowered.com/newshub/app/250820/view/2396425843528787269

Here's a copy-paste of the procedure :
  • Right click on SteamVR in your Steam library and select Properties
  • Click on the Betas tab
  • Pick "beta - SteamVR Beta Update" from the list

Since it's a beta, you understand that it might break unexpectedly and create unknown problems.

Start vrmonitor (the VR button at the top right of the main Steam window) and see if it detects your hardware.

On my setup, the presence of old /tmp/monado_* lock files prevented SteamVR OpenXR to boot up. So, just in case, if vrmonitor is not starting correctly and ask you to reboot your headset every time, check for such files and delete them if they're present.
Compile the Godot OpenXR plugin
The plugin is available here : https://github.com/GodotVR/godot_openxr

Forget about the whole "let's recompile godot with debug support" in their README, since the plugin is working with Steam version of Godot just fine (on my setup).

The whole "git" and compile setup is quite simple, though don't forget to get the "submodules", else you'll get compilation errors about unavailable godot headers.

git clone --depth 1 https://github.com/GodotVR/godot_openxr cd godot_openxr git submodule init git submodule update scons platform=linux
Test the setup with the plugin demo project
Fire up Godot, through Steam, and import the project located at /where/you/git/godot_openxr/demo.
Start the game (using the play button on the top right) and check that :

  • The game scene is displayed through your VR headset
  • You can move your arms with the knuckles controllers (or whatever VR controller you're using).
  • You can slightly move inside the scene by moving the VR headset (you can hold it in your hands, if you get motion sick)

This demo scene has no support for teleportation, or even moving with the controllers, so forget about that. Just check if you can move the 3D arms with your controllers, and move the character (slightly) by moving the headset around.

If things just don't work here... something's wrong but I have no idea how to determine what's wrong with your setup.
You can paste in the comments the debug output you get in the "Output" and "Debugger" panes of the Godot project, and someone *might* be able to help you.
Copy the plugin somewhere
If you got the plugin working, you'll now have to copy addons/godot-openxr ( current path : /where/you/git/godot_openxr/demo/addons/godot-openxr ) into a specific folder.
Then, for every Godot project where you'd like to use OpenXR, you'll have to copy godot-openxr in the addons/ subfolder of these projects.
Get the official Godot VR demo working with the OpenXR plugin
Grab the tutorial scene ( VR_Starter_Tutorial_Complete.zip ) at the bottom of this page : https://docs.godotengine.org/en/3.1/tutorials/vr/vr_starter_tutorial.html#final-notes

Unzip it somewhere, copy your previously saved godot-openxr addon into /where/you/unzipped/VR_Starter_Tutorial_Complete/addons.

Open Godot, import the unzipped and prepared VR_Starter_Tutorial_Complete project. Then, BEFORE RUNNING IT, edit the script Game.gd attached to the Game root node (click the script icon at the right of the node) and replace "OpenVR" by "OpenXR" inside
var VR = ARVRServer.find_interface("OpenVR")
so that it looks like
var VR = ARVRServer.find_interface("OpenXR")

THEN run the example and have fun with the default example.

Note that moving in this demo is still "weird" (with the Valve knuckles at least), since they implemented teleportation by pressing the trigger, aiming at a teleportation point, then releasing the trigger.
Grabbing is done with the A button, and you cannot teleport if you grabbed something, since the trigger button is then used to generate actions on the grabbed elements (like shooting the guns you grabbed).
Also the first text texture in front of you is upside-down...

Still, you can move around, grab the sword, the guns, the shotgun and the grenades and test them.
The pink spheres have to be attacked with a weapon multiple times before they break.
The green cubes can be grabbed or shot.

TODO
  • Understand how SteamVR diverts openxr_loader.so to their libraries, since they don't seem to even provide that library themselves.
  • Find a way to prebuild the OpenXR plugin (Docker/Podman + Github/Gitlab CI might do the trick), in order to lower the entry barrier.
  • Provide the actual list of dependencies for Ubuntu and Arch Linux.
  • Test this on others setups.
4 Comments
 [author] Dec 10, 2020 @ 10:00am 
For the Anti Aliasing part, while MSAA x16 and Anistropic filtering x16 are available, however I'm still not impressed by them. You can still see jaggies on close quarter objects actually. I've seen a few people tackling this with shaders on Youtube but, again, I haven't tested them.
 [author] Dec 10, 2020 @ 10:00am 
Hey !

Actually, I started to use Godot seriously just a week ago, so I'm not a good source of information for that. I'm still planning to use it for a VR application, but a lot of features still need third-party packages here and there, along with modified versions of Godot, so I can't recommend it for a simple VR game creation experience.

Note that OpenXR support for Godot is still a Work In Progress, and if you want to know more about it, I'd highly suggest following Bastiaan Olij on Youtube, which has a Godot VR videos. He's also present on the official Godot Discord channels and so far, he's open to questions,

Named input exist in Godot and are actually the way to go for most projects. These input can then be remapped depending on the controller, so if that's what you're looking for, yes Godot suports it. Though, I don't know how it fares if you hop from one controlling scheme to another in a middle of a game (like switching from keyboard to VR knuckles).
GreenMan36 Dec 9, 2020 @ 6:30am 
Developing for Windows btw, just thought you would know more about VR dev in Godot in general
GreenMan36 Dec 9, 2020 @ 6:28am 
I'm interested in using Godot for a SteamVR game but how's the input system?
I know unity has great VR support, thats why its the standard right now for VR games. And it has single variables for the trigger, ab, etc buttons. And its easy to swap models depending on the hardware used. How does this compare to the state of VR in Godot?

Also, how's the AA? I see jaggies in the screenshot whichis a big no for a VR game, which unity has pretty good and lightweight default stuff for, unreal a bit less.