Skip to content

Consolidate reference space types and interfaces #587

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

Merged
merged 5 commits into from
May 1, 2019

Conversation

toji
Copy link
Member

@toji toji commented Apr 12, 2019

Since #574 leaves XRStationaryReferenceSpace with nothing else in it, taking the opportunity to consolidate it and XRUnboundedReferenceSpace into XRReferenceSpace, as was discussed in #514.

Originally was part of #574 but separated the consolidation out at Nell's request.

index.bs Outdated
An {{XRReferenceSpace}} is obtained by calling {{XRSession/requestReferenceSpace()}}, which creates an instance of an interface extending {{XRReferenceSpace}}, determined by the {{XRReferenceSpaceOptions/type}} value of the {{XRReferenceSpaceOptions}} dictionary passed into the call:
An {{XRReferenceSpace}} is obtained by calling {{XRSession/requestReferenceSpace()}}, which creates an instance of an {{XRReferenceSpace}} or an interface extending it, determined by the {{XRReferenceSpaceOptions/type}} value of the {{XRReferenceSpaceOptions}} dictionary passed into the call. The {{XRReferenceSpaceOptions/type}} indicates the tracking behavior that the reference space will exhibit:

- Passing a {{XRReferenceSpaceOptions/type}} of <dfn enum-value for="XRReferenceSpaceType">identity</dfn> creates an {{XRReferenceSpace}} instance. It represents a reference space without any tracking behavior. The {{XRPose/transform}} of any {{XRPose}} queried from an {{identity}} reference space MUST be an [=identity transform=] offset by the {{originOffset}}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the discussion in #565 this characterization seems inaccurate? The pose queried changes based on the base space used, a more accurate characterization is that "getViewerPose" should always return the identity transform (potentially offset with originOffset).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked this text, though I think it's going to need to be updated again when we land some of the planed changes re: describing these spaces in terms of the native origin as you've started looking at.

@toji toji force-pushed the remove-empty-ref-spaces branch from e6159ee to 7a51b4e Compare April 15, 2019 22:17
@toji toji force-pushed the remove-echoes branch 3 times, most recently from a3341f2 to 6714aa2 Compare April 18, 2019 18:26
@toji toji force-pushed the remove-empty-ref-spaces branch from 7a51b4e to e8828d1 Compare April 19, 2019 17:58
@toji toji force-pushed the remove-empty-ref-spaces branch from e8828d1 to 8c0b47e Compare April 26, 2019 21:41
@toji toji changed the base branch from remove-echoes to master April 26, 2019 21:42
@toji toji changed the title Consolidate reference space interfaces Consolidate reference space types and interfaces Apr 26, 2019
@toji
Copy link
Member Author

toji commented Apr 26, 2019

Combined this PR with another one that I had in progress to consolidate the reference space type and subtype enums because @NellWaliczek and I both think these changes make the most sense when taken together. As a result this PR now fully fixes #514 and fixes #542.

Copy link
Member

@NellWaliczek NellWaliczek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on board with this approach. A few minor nits to fix and then I'll sign off!

index.bs Outdated

- Passing a {{XRReferenceSpaceOptions/type}} of <dfn enum-value for="XRReferenceSpaceType">unbounded</dfn> creates an {{XRUnboundedReferenceSpace}} instance if supported by the [=/XR device=] and the {{XRSession}}.
- Passing a type of <dfn enum-value for="XRReferenceSpaceType">eye-level</dfn> creates an {{XRReferenceSpace}} instance. It represents a tracking space with it's origin near the user's head at the time of creation. The exact position and orientation will be initialized based on the conventions of the underlying platform. When using this reference space the user is not expected to move beyond their initial position much, if at all, and tracking is optimized for that purpose. For devices with [=6DoF=] tracking, {{eye-level}} reference spaces should emphasize keeping the origin stable relative to the user's environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exact position and orientation will be initialized based on the conventions of the underlying platform.

Should we change this to say that the originOffset should be set such that the behavior is always the same?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually raises a good question about our understanding of the native origin: I guess I had been viewing it as the "base" origin for a reference space, regardless of if the UA had to apply some internal tweaks to get it there. This comment suggests you see the native origin as a function of the underlying XR backend and completely out of the UAs control, with origin offsets being applied in any case where the desired reference space does not already happen to match the platform-provided one. I'm fine with that interpretation, though if that's the case we should not land this PR until after #612 lands and removes the originOffset attribute.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been viewing it the same way (and in fact Nell's comment didn't initially make sense to me since I wasn't sure what the behavior was supposed to be the same to).

Her interpretation makes sense too, though it surprises me a bit.

I guess I'm unclear on when such a situation can occur.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it really strongly matters either way, but the term "native" origin implies to me that it's the origin as defined by the underlying tracking system...

@toji toji force-pushed the remove-empty-ref-spaces branch from 1001365 to ff5a111 Compare April 30, 2019 06:04
@toji
Copy link
Member Author

toji commented Apr 30, 2019

Made a few tweaks in response to Nell's comments, but had an open question about the native origin/origin offset thing.

Copy link
Member

@NellWaliczek NellWaliczek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that all my remaining comments would more appropriately be addressed in the next milestone when we fix #597, i'm good to merge as is.

@@ -766,21 +766,21 @@ Each {{XRReferenceSpace}} has a <dfn for="XRReferenceSpace">type</dfn>, which is

An {{XRReferenceSpace}} is obtained by calling {{XRSession/requestReferenceSpace()}}, which creates an instance of an {{XRReferenceSpace}} or an interface extending it, determined by the {{XRReferenceSpaceType}} enum value passed into the call. The type indicates the tracking behavior that the reference space will exhibit:

- Passing a type of <dfn enum-value for="XRReferenceSpaceType">identity</dfn> creates an {{XRReferenceSpace}} instance. It represents a reference space where the [=viewer=] is always at the origin (prior to applying the {{originOffset}}). Only the {{XRSession/viewerSpace}} and {{XRInputSource/targetRaySpace}}'s of {{XRInputSource}}'s with an {{XRInputSource/targetRayMode}} of {{XRTargetRayMode/screen}} can be spatially related to an {{identity}} reference space.
- Passing a type of <dfn enum-value for="XRReferenceSpaceType">identity</dfn> creates an {{XRReferenceSpace}} instance. It represents a reference space where the [=viewer=] is always at the [=native origin=]. Only the {{XRSession/viewerSpace}} and {{XRInputSource/targetRaySpace}}'s of {{XRInputSource}}'s with an {{XRInputSource/targetRayMode}} of {{XRTargetRayMode/screen}} can be spatially related to an {{identity}} reference space.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It represents a reference space where the [=viewer=] is always at the [=native origin=]

And that the [=native origin=] is a constant.. or doesn't vary.. or something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that matter, in this case, if it can't relate to anything else?

- Passing a type of <dfn enum-value for="XRReferenceSpaceType">unbounded</dfn> creates an {{XRReferenceSpace}} instance if supported by the [=/XR device=] and the {{XRSession}}. It represents a tracking space where the user is expected to move freely around their environment, potentially even long distances from their starting point. Tracking in an {{unbounded}} reference space is optimized for stability around the user's current position, and as such the tracking origin may drift over time.
- Passing a type of <dfn enum-value for="XRReferenceSpaceType">unbounded</dfn> creates an {{XRReferenceSpace}} instance if supported by the [=/XR device=] and the {{XRSession}}. It represents a tracking space where the user is expected to move freely around their environment, potentially even long distances from their starting point. Tracking in an {{unbounded}} reference space is optimized for stability around the user's current position, and as such the [=native origin=] may drift over time.

Devices that support any of the following {{XRReferenceSpaceType}}s MUST support all three: {{XRReferenceSpaceType/position-disabled}}, {{XRReferenceSpaceType/eye-level}}, {{XRReferenceSpaceType/floor-level}}. The minimum sensor data necessary for supporting all three reference spaces is the same.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The minimum sensor data necessary for supporting all three reference spaces is the same.

Not necessarily the case for the floor-level type, yes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word "minimum" is doing a lot of lifting in that sentence. You can get an emulated floor-level with nothing but orientation data and a static offset.

@Manishearth
Copy link
Contributor

Manishearth commented Apr 30, 2019

Btw, I've rebased this over #612 in https://github.com/Manishearth/webxr/tree/consolidate, feel free to use.

(I need this to start working on https://github.com/immersive-web/editor-collab/pull/38 )

@toji toji merged commit 4b44c1a into master May 1, 2019
@toji
Copy link
Member Author

toji commented May 1, 2019

Apologies, @Manishearth. I actually merged this in the opposite order (resolving the conflicts along the way.) Hopefully you can rebase your change onto the new master without much trouble?

@Manishearth
Copy link
Contributor

Oh, that's fine, I hadn't made any major changes yet :)

@toji toji deleted the remove-empty-ref-spaces branch May 2, 2019 18:07
@AdaRoseCannon AdaRoseCannon added ed:explainer Include in newsletter, explainer change ed:spec Include in newsletter, spec change labels May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ed:explainer Include in newsletter, explainer change ed:spec Include in newsletter, spec change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants