-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does originOffset behave differently for identity reference space? #477
Comments
Sorry for the delay in commenting on this. This issue highlights the fact that there's actually two valid ways to think about this, and we need to:
And in order sort that out I'm going to subject you all to my scribbles. 😁 This is, I hope we can all agree, the default state of things. No My assumption when writing the Specifically, in this case the Alex's interpretation (or at least my interpretation of his interpretation) is the inverse, which is also a valid reading of it. In this world view the same In this scenario the origin of the virtual space is offset from the origin of the tracking space by the The TL;DR of the above is: Interpretation A thinks of the Either can be wholly mathematically consistent, and either can be made clear by the spec text, I'm just curious which approach the WG as a whole finds to be the most intuitive. |
This is a FANTASTIC explanation of the confusion. And whichever one we decide, that image is going into the explainer. Talking to the Sumerian folks, it sounds like either would really be fine. If anything, we have a slight preference for Interpretation A. |
Thanks for the awesome drawings! Agreed that Option A (where the offset is applied to all returned poses) is more likely what the developer was looking to accomplish in the first place. However, I notice that only in Option B does @toji's description of the Regarding the tl;dr, I've thought of If we do decide to go with Option A, we should probably rename the attribute to something like |
This issue was discussed and the Jan 2019 F2F and it seemed that Interpretation B was the more popular understanding. (If I recall correctly the straw poll was 12 to 7.) So that's the interpretation that we'll be working with moving forward. I'll post some PRs soon to update the spec language to make this clearer. |
As awesome as Brandon's images are, I think they are still potentially ambiguous due to not including a rotation. Does this picture look like a correct interpretation? It shows the player teleported to position (-1, 0, +0.5) in virtual world space, meaning that's where the feet will be located, and then rotated in place 45 degrees left (+45 degree rotation around +y axis) so that they are looking towards the (-1, 0, -1) direction. (The Y axis points up as per the usual convention.) If I'm interpreting it right, this would mean I'd need to set originOffset to position (+1.06, 0, +0.35), with an orientation of (-45 degree rotation around +y axis). Here's what this calculation would look like in three.js:
And to apply this in WebXR, I'd do something like this:
Does that look right? |
That looks right to me, though I'd be happy to hear from anyone that feels it's incorrect. Oh, and for what it's worth if your orignOffsetPos has an x, y, and z attribute then the constructor signature should just accept it as-is, even if it's not a DOMPoint variant:
|
Brandon, thanks for confirming. I think the explainer and spec definitely need more explicit descriptions to be unambiguous. For example, currently the explainer says: Teleport the user a certain number of meters along the X, Y, and Z axes, but we have two sets of axes (the virtual world space and the tracking space) which may be oriented differently, and it's also unclear what sign is supposed to be used for the movement. In case it helps, the following appear to be true for the proposed interpretation according to testing:
Here's a code snippet using glmatrix as used in webxr-samples:
|
After some more experiments with the implementation, it turns out that my descriptions earlier in this thread were incomplete and/or misleading due to assuming that the user is standing at the origin. On a 6DoF headset where the player is at an arbitrary position in the tracked volume, things get a bit more complicated. Here's an updated sketch: The originOffset calculations themselves still remain the same, but are based on moving the tracking space origin location in world space. That's a valid implementation (IIRC the game "Budget Cuts" does something like this), but it's only intuitive if the user knows their location relative to the tracking space origin. If you want to teleport the user's feet to a specific world position, or rotate the user in place, there's some additional application logic necessary to adjust the offset correctly when the user isn't centered in tracking space. Here's an example of a more complex teleportation with rotation around the Y axis added: In this example, the user teleports from point U to point U' in world space, combined with rotating the tracking space a bit to the left. For that to work correctly, the tracking space origin needs to move from point T to T' in world space. We can get the needed adjustment by transforming the tracking space player position to world space. The offsetOrigin matrix transforms coordinates from world space to tracking space, and its inverse transforms from tracking space to world space. However, there's a chicken-and-egg problem here - we're trying to calculate the new originOffset from an origin position and rotation, so we can't use its inverse for calculating the origin position. However, we do know the old originOffset for the pre-teleport state, and we know the change of rotation angle for the tracking space, so we can just rotate the old TU vector around the Y axis by the difference of tracking space orientation angles:
|
Should be fixed by #612 |
Isn't this the reverse of what we defined
originOffset
to do for all other reference spaces?For the
"bounded"
space:Imagine that the viewer is located at position (2, 2, 2) within the default
"bounded"
reference space. If I then "offset" the bounded reference space's "origin" by (2, 2, 2), I would expect the viewer to now be at position (0, 0, 0), since I shifted that space's origin over by (2, 2, 2) to now coincide with the viewer.This means that applying an
originOffset
of (2, 2, 2) to the"bounded"
reference space causes the viewer's pose to translate by (-2, -2, -2).For the
"identity"
space:However, per this PR, if I apply an
originOffset
of (2, 2, 2) to the"identity"
reference space, the viewer's position changes from (0, 0, 0) to (2, 2, 2).This means that applying an
originOffset
of (2, 2, 2) to the"identity"
reference space causes the viewer's pose to translate by (2, 2, 2), the opposite behavior as with the"bounded"
reference space.Originally posted by @thetuvix in #459
The text was updated successfully, but these errors were encountered: