immersive-web / webxr-hand-input

A feature repo for working on hand input support in WebXR. Feature lead: Manish Goregaokar
https://immersive-web.github.io/webxr-hand-input/
Other
104 stars 17 forks source link

Radius for finger tips #90

Closed cabanier closed 2 years ago

cabanier commented 3 years ago

Currently the spec is silent what the radius for finger tips should be so it's up to the UA to put in a value. Can we define it to be 0? That way we can have a consistent experience.

Manishearth commented 3 years ago

I think that's fine, cc @thetuvix

thetuvix commented 3 years ago

I don't believe that HoloLens or Quest uses 0 tip radii in OpenXR - I believe instead the finger tip position is placed at the right spot inside the finger so that a sphere of that radius roughly touches the tip and pad of that finger for collision purposes.

Manishearth commented 3 years ago

Should we just allow both then?

cabanier commented 3 years ago

I don't believe that HoloLens or Quest uses 0 tip radii in OpenXR - I believe instead the finger tip position is placed at the right spot inside the finger so that a sphere of that radius roughly touches the tip and pad of that finger for collision purposes.

The internal API that the Oculus implementation is based on, is returning a 0 radius. I will ask internally what we did for the OpenXR implementation.

cabanier commented 3 years ago

Should we just allow both then?

Yes Maybe the spec should state what @thetuvix said and not that the radius can be 0.

cabanier commented 3 years ago

I don't believe that HoloLens or Quest uses 0 tip radii in OpenXR - I believe instead the finger tip position is placed at the right spot inside the finger so that a sphere of that radius roughly touches the tip and pad of that finger for collision purposes.

@thetuvix you're correct that OpenXR for Quest doesn't return 0 for the radius of the tip but the older API (which is used by the browser) does. I can't find your definition of the radius in the OpenXR document. Can you point me to where it says that this is for collision purposes?

Maksims commented 3 years ago

The radius of a fingertip that would approximate distance from the tip and a pad of a finger seems a reasonable approach to this, based on few use cases I have experimented demos with:

  1. Identify different fingertips touching (pinch gesture), is easier when dealing with two tip radii and checking if the distance is less than a sum. If it is a tip with 0 radii, then we will have to calculate a point closer to the parent joint and estimate a radius. Or checking a distance between two tips will trigger when they even don't touch.
  2. Physics created using capsules, is simple enough by using the centre of joints and radius of it. If the tip is an actual tip, then we again need to make the capsule a bit shorter and estimate the tip radius.

In fact, integrating Hands API, I've assumed that 0 radius of a tip, is somewhat a "bug" of early spec/implementation, and hard-coded a radius: https://github.com/playcanvas/engine/blob/master/src/xr/xr-joint.js#L138 because otherwise, it was harder to do maths for gestures, collision detection and other use cases.

Manishearth commented 3 years ago

So when I was designing this my assumption would be that tip would be a sphere to allow collisions. I think if we can go in that direction, that would be better, but I'm not sure what the variation across platforms is.

cabanier commented 3 years ago

So when I was designing this my assumption would be that tip would be a sphere to allow collisions. I think if we can go in that direction, that would be better, but I'm not sure what the variation across platforms is.

I think that's reasonable. A radius of '0' would still be allowed but as @mrmaxm noted, it might require some additional fudging to get reliable collisions.

thetuvix commented 3 years ago

@cabanier:

I can't find your definition of the radius in the OpenXR document. Can you point me to where it says that this is for collision purposes?

Here is the relevant language in the OpenXR XR_EXT_hand_tracking spec, specifically calling out the case of collision testing using a sphere centered at the index finger tip location:

The radius of each joint is the distance from the joint to the skin in meters. The application can use a sphere at the joint location with joint radius for collision detection for interactions, such as pushing a virtual button using the index finger tip.

cabanier commented 3 years ago

Does that mean that the tip joint would be inset by the radius?

Manishearth commented 3 years ago

Yes

cabanier commented 2 years ago

@Manishearth did this result in a change to the spec? The Oculus browser's OpenXR implementation no longer returns 0 so we're ok with the @thetuvix's suggestion

Manishearth commented 2 years ago

I don't think so!

Manishearth commented 2 years ago

https://github.com/immersive-web/webxr-hand-input/pull/111