openvr icon indicating copy to clipboard operation
openvr copied to clipboard

Any way to get controller input into OpenVR from HMD without using a tracked device?

Open TheDeveloperGuy opened this issue 9 years ago • 9 comments

My custom HMD has a DPad etc. which do not register as any kind of input device on Windows. I can read the input from the HMD in my OpenVR HMD driver, but I can't do anything useful with it. I've created a IVRControllerComponent driver and mapped my controller to axes, buttons etc.

However, this doesn't seem to be the right way to get controller input into OpenVR, as I have to position this 'virtual' controller somewhere (it needs a pose), which gets it drawn in 'virtual space' (don't want, could keep it mapped behind the 'head' but that's not right). Also, apart from getting the 'A' button recognised, I can't really interact with SteamVR (moving around in the UI etc.) with the DPad (although this is possible with an XBox controller).

What I want is for these inputs to appear to SteamVR and VR titles as a game controller. I can hook XInput and possibly fool some things that way, but it also seems like a suboptimal way to get controller input (from an HMD) into a VR title.

Is there a non-tracked controller interface that the HMD can send input to? Something that appears to some/most/any VR titles as a gamepad?

TheDeveloperGuy avatar Jan 18 '17 19:01 TheDeveloperGuy

This issue is directly related too https://github.com/ValveSoftware/openvr/issues/284

One workaround is described at https://youtu.be/UZNttWbTiu4

There are many solutions for adding googlevr devices to steamvr. Make your hmd support googlevr and then use vridge to access steamvr. It is even possible to use touch input from a selection of many input options to choose from vridge ui when using a tegra k1 tablet as a hmd for SteamVR content. Using touch in steamvr ui is a novelty but is just not a solution.

There is no solution AFAIK that adds PC vr hardware to googlevr. Nvidia shield android tv and razers android powered console are two such devices that would be capable of allowing connection of tethered PC vr hmds.

You definitely need your input devices working at operating system level before you can expect it too work in vr.

How do you expect

... these inputs to appear to SteamVR and VR titles as a game controller.

If your operating system does not see that device at all?

You need to provide drivers. Once you provide drivers your input device will still not work in things like steam overlays due to issue284

Balderick avatar Jan 18 '17 21:01 Balderick

The Vive controllers are not operating system level (XInput) controllers, they have drivers within SteamVR (using the IVRControllerComponent interface). I have made a driver with that interface, and I can get input into SteamVR from my HMD driver that way. However, that interface is not suitable for non-tracked devices (apps insist on rendering a representation of the controller in VR space etc.). Hence the question.

The answer, (it seems for now) is that there is no public controller interface for other types of controllers in Steam/SteamVR. Steam has internal drivers for Playstation controllers for instance, but there is no way (that I can see) for anyone outside of Valve to add support for other controllers. Another issue is that VR apps that support non-tracked controllers talk directly to XInput, so it seems one may have to hook XInput.

TheDeveloperGuy avatar Jan 19 '17 03:01 TheDeveloperGuy

Steam has internal drivers for Playstation controllers for instance, but there is no way (that I can see) for anyone outside of Valve to add support for other controllers.

Valve open sourced hydra drivers so that any input device can be used to emulate vive controllers. Though expecting devs to support vive controllers so users can emulate them using freepie or other means by use of the hydra drivers just seems a long way round ...

Valve developer highlighted why hydra drivers were open sourced and made available in steam store at DevDays 2016 SteamVR Hardware talk.

Balderick avatar Feb 13 '17 13:02 Balderick

Any way to get controller input into OpenVR from HMD without using a tracked device?

Hydra is a tracked device...

TheDeveloperGuy avatar Feb 13 '17 14:02 TheDeveloperGuy

All the APIs are centered around a Tracked Device Index, so no.

But if you provide a "controller" device in your driver you could just never give it a valid pose. Is the device framework problematic, or is it specifically the "tracked" part that doesn't really work?

JoeLudwig avatar Feb 13 '17 23:02 JoeLudwig

If the buttons are coming from the HMD, then your HMD driver can provide the IVRControllerComponent in addition to the display component.

JeffLeinbaugh avatar Feb 14 '17 00:02 JeffLeinbaugh

@JoeLudwig Ok, well strangely I never thought of giving it an invalid pose, just a unit one. Giving it no valid pose fixes the issue of apps rendering a representation of a controller :)

I'd like to map the controls to something that would at least be useful for the SteamVR UI, but I've been unable to get anything apart from the 'A' button recognised (although I am sending axis and d-pad events to OpenVR).

TheDeveloperGuy avatar Feb 14 '17 21:02 TheDeveloperGuy

@JoeLudwig Also, the framework doesn't seem to have a gamepad idiom, so no mappings for 'X' 'Y' 'B' etc., and no apps are using OpenVR to read a gamepad type controller.

It seems a better fit (and more useful) to somehow (hooking etc.) get the gamepad type controls into XInput.

TheDeveloperGuy avatar Feb 14 '17 21:02 TheDeveloperGuy

Very few VR apps use OpenVR APIs to read gamepads (even SteamVR is inconsistent in this regard), so anything useful regards gamepads needs to be done at an XInput level.

TheDeveloperGuy avatar Feb 01 '21 12:02 TheDeveloperGuy