microsoft / OpenXR-MixedReality

OpenXR samples and preview headers for HoloLens and Windows Mixed Reality developers familiar with Visual Studio
https://aka.ms/openxr
MIT License
335 stars 95 forks source link

Howto access presence/proximity sensors of windows mixed reality HMDs? #94

Closed diekleinekuh closed 1 year ago

diekleinekuh commented 2 years ago

Hello, I'm trying to access the proximity sensor of a HDM using the windows mixed reality openxr runtime to determine if the headset is currently worn or not.

It is possible with the windows mixed reality plugin for SteamVR. There is a "windows mixed reality HMD" device and it has a proximity sensor control that can be mapped to a button like action. So the plugin for steam vr somehow can access the proximity sensor but I didn't find any way to do this via openxr. Is there a way to do this?

I'm sorry if this is not the right place to ask about this. But any help or a tip where to aks this question would be highly appreciated.

Thanks!

yl-msft commented 2 years ago

openxr API currently doesn't support proximity sensor. The working group is not convince on a good usage scenario. Your feedback can be valuable for the future direction on this feature. @diekleinekuh

You can see some discussion on https://www.reddit.com/r/OpenXR/comments/ocz0xm/userpresent_always_returns_true_in_openxr/

We can help you to route your feedback to the working group. First is to understand your usage scenario.

diekleinekuh commented 2 years ago

Hi, thanks for getting back. My usage scenario is as follows:

We are making a VR based simulation for driving schools. The whole driving school lesson should be a guided experience where the student starts a lesson in a mobile app. This app then gives you access to a simulator setup (hardware installation of some kind) and instructs you to put on the HMD. After that the simulation takes over. When the user first puts on the HMD a calibration procedure is started. If the student puts off the headset the simulation is paused. When putting the headset back on a control is displayed asking for the student to accept continuing the lesson. We do not have any other controls to pause the simulation. Taking off the headset would be the natural thing to do. Also there is no second screen available to do it with a UI control after the HMD was taken off.

Currently we have two options:

  1. go with SteamVR as it supports the worn state. It doesn't do it properly but at least the proximity sensor is exposed as a button so it can be queried.
  2. go with OpenXR but add platform specific code to get the worn state of the headset somehow which defeats the purpose of having a platform independent API

Besides our use case there are some other use cases I found while googling for a solution in the last week:

As a bonus the HMD interfaces in Unity and Unreal support a worn state/user presence with SteamVR and WMR. As they are the leading tooling used to access VR/AR content and there is currently a shift from SteamVR/WMR to using OpenXR in both engines this functionality isn't working anymore even though the hardware supports it. To me this looks like a case of the API getting in the way. Of course this cannot be a mandatory feature but allowing for a generic way to detect the worn state of a HMD seems useful to me.

Thanks for routing this feedback to the working group. Much appreciated.

diekleinekuh commented 2 years ago

Addition: It seems to me that when using OpenXR there is no other additional API to get the worn state of the HMD. With WMR I would need access to the HolographicSpace. But that's not possible. It might exist somewhere internally in the WMR OpenXR runtime but is not exposed. I tried creating a dummy HolographicSpace from a dummy HWND. But unfortunately the reporting of UserPresence in HolographicSpace isn't only the worn state of the headset but a combination of proximity sensor and if the content of the HWND is actually displayed which doesn't work with this setup.

So actually the only alternative is SteamVR. Ideally there would be and extension that will expose the worn state as an input.

mbucchia-msft commented 1 year ago

The feedback from this thread (and many others) has been presented to the Khronos members. There is nothing left that is actionable on this issue.