mbucchia / VirtualDesktop-OpenXR

An implementation of the OpenXR standard for Virtual Desktop
MIT License
209 stars 7 forks source link

XR_EXT_hand_tracking joint positions different from SteamVR #38

Closed oneMillionWorlds closed 1 week ago

oneMillionWorlds commented 3 months ago

Describe the bug

I'm finding that the bone poses as reported by VDXR are different from those obtained when running under SteamVR (reported using XR_EXT_hand_tracking extension).

E.g. here is the hand in XDVR

d2c62bcf2b7929b82f589e1b96d44f77

58b4a8e19b253a0fd0059a4e62906709

And here it is in Steam VR

7e69106f95d68d0ce151c87cb1dbdc95

6f4120e3d2803a4cc55e127364ddc6f9

It's not that different, but its different enough that the hands don't look right. Here they are with the bone positions rendered

VDXR:

0f2d3778a39b9a62494971219667eade

Stream VR: 04f6bdeff7165f6832d3bdc81ad03957

Environment

To Reproduce

  1. Run TamarinTestBed
  2. Look at hands
  3. See odd positioning

Expected behaviour

Expected that SteamVR and VDXR would produce the same bone positions

OpenXR.log

mbucchia-msft commented 3 months ago

Not really sure what I am looking at here. SteamVR doesn't support "real hands" AFAICT, so this must be while holding a controller?

VDXR "hand joints simulation" is pretty cheap, and I don't really plan on improving it at this time. This is really meant for when a real hand is being tracked, the "hand joints simulation" code is based on Valve's own sample code here to provide a best-effort fallback for apps that rely on fake hand joints when holding a controller. I unfortunately don't have the time nor expertise to provide a better simulation model.

mbucchia-msft commented 3 months ago

The relevant code calling Valve's code is here: https://github.com/mbucchia/VirtualDesktop-OpenXR/blob/0d2a45704aa847f62d819cdbc546237b7c235ccb/virtualdesktop-openxr/hand_tracking.cpp#L305

oneMillionWorlds commented 3 months ago

Yes, this is while holding the controller. They aren't physically accurate (its the best guess based on touch points on the controller) but they look physically plausible from SteamVR. It's interesting that its up to the runtime to figure out the hand positions, I had always assumed (clearly incorrectly) that the device provided its option on them.

mbucchia-msft commented 3 months ago

There might be some simple tweaking in the code I pointed above to make it better. If you feel like experimenting.

I will try a couple of adjustments later if I find some time.

oneMillionWorlds commented 3 months ago

If its going to be cheap and cheerful less might be more. Tamarin itself has a hand joints simulation that it uses when XR_EXT_hand_tracking isn't available. It uses only the grip strength and uses that to open and close the hands. It's simultaneously better and worse; better in that the hands always look physically plausible, worse in that certain poses like pointing the index finger are impossible.

Tamarin grip based bone simulation. It works just by having a number of recorded way points at different grip strengths and interpolating between them.

Although arguably that's going down a dead end.

No worries if its not on the roadmap though.

mbucchia commented 3 months ago

Please note - I added support for XR_EXT_hand_tracking_data_source to manually activate when to retrieve simulated hand joints. This will no longer be done by default, unless the user selects "Emulate index controller".

mbucchia commented 1 week ago

I don't plan on making more changes to this feature.