Irrlicht working with OpenXR for Virtual Reality

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
bridgeco
Posts: 13
Joined: Fri Mar 19, 2004 8:19 pm
Location: London
Contact:

Irrlicht working with OpenXR for Virtual Reality

Post by bridgeco »

Hi all, I managed to get my program using Irrlicht working with VR headsets using OpenXR. OpenXR is the API that's now supported across all the main PCVR headsets.

Image

My implementation doesn't yet use the VR controllers, but everything is available to add them. Of course Irrlicht doesn't provide 3d VR menus and other features, so the details of user interaction need implementing directly.

I didn't have to modify the Irrlicht source at all, as an outline, you start up as normal, using OpenGL, then pass the OpenGL context information to OpenXR, which generates textures in a swapchain, and in the main loop we get 'pose' information, set the camera position and direction based on these, render to these textures, and submit them back to OpenXR.

Most of the OpenXR runtimes seem to support OpenGL directly (I've tested tested with the Oculus Rift CV1 using the Oculus runtime, I think the Vive runtime supports OpenGl as well, although I don't have one to test it). Windows Moxed Reality only supports DirectX 12, but there's a little tool from https://github.com/mbucchia/OpenXR-Vk-D3D12 which acts as in interface layer and adds OpenGL support (requires a 64-bit build).

The VR part of my code is mostly below, called from main.cpp in the same folder. It's definitely not finished and tidy, but it works, which I'm really pleased with:
https://github.com/bridgecommand/bc/blo ... erface.cpp

It's very closely based on the example code in https://gitlab.freedesktop.org/monado/d ... e-example/
-------------------------------------
Bridge Command

a 3d ship simulator for navigation training
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Re: Irrlicht working with OpenXR for Virtual Reality

Post by Brainsaw »

Nice. Back in the day I added VR to an old game of mine (using Oculus Rift DK 1+2), but then I sort of lost interest. At the moment I am thinking about adding VR to my current game, namely the "cheapest" version using Android phones as VR headsets. Does OpenXR support this?
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
bridgeco
Posts: 13
Joined: Fri Mar 19, 2004 8:19 pm
Location: London
Contact:

Re: Irrlicht working with OpenXR for Virtual Reality

Post by bridgeco »

I'm not aware of any official Android phone support for OpenXR, although there was a post from a few years ago about Monado (an open source OpenXR runtime) with initial android support (https://www.collabora.com/news-and-blog ... -more.html). I must admit that I haven't looked into it that much, as I haven't ported my program to Android.
-------------------------------------
Bridge Command

a 3d ship simulator for navigation training
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Re: Irrlicht working with OpenXR for Virtual Reality

Post by Brainsaw »

I think I'll try the Android Virtual Reality SDK provided by Google and maybe OpenXR later to get a Windows VR version as well. But I think this is still not going to happen soon.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Post Reply