KEMBAR78
Updated the explainer with new origin offset mechanics. by toji · Pull Request #642 · immersive-web/webxr · GitHub
Skip to content

Conversation

@toji
Copy link
Member

@toji toji commented May 14, 2019

/fixes #634

@toji toji added this to the May 2019 milestone May 14, 2019
@toji toji requested a review from NellWaliczek May 14, 2019 20:53
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.

A few questions/comments...

@toji
Copy link
Member Author

toji commented May 14, 2019

Addressed feedback. PTAL!

y: currentOrigin.position.y + deltaY,
z: currentOrigin.position.z + deltaZ },
currentOrigin.orientation);
xrReferenceSpace = xrReferenceSpace.getOffsetReferenceSpace(

Choose a reason for hiding this comment

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

I'd love to see a super-specific example of how a reference space and an offset reference space interact, not just how they can be used. Would it make sense to add something like this?

For example:
offsetSpace = xrReferenceSpace.getOffsetReferenceSpace(new XRRigidTransform({x: 1, y:0, z:0});
// (0,0,0) in offsetSpace coordinates is (1,0,0) in xrReferenceSpace coordinates.

Similar for chained offsets to make it extra clear how they are chained.
offsetSpace1 = xrReferenceSpace.getOffsetReferenceSpace(new XRRigidTransform({x: 1,y: 0, z: 0});
offsetSpace2 = offsetSpace1.getOffsetReferenceSpace(<rotation around y axes by 180>);
(0,0,0) in offsetSpace2 is (0,0,0) in offsetspace1 is (1, 0, 0) in xrReferenceSpace, but
(1,0,0) in offsetSpace2 is (-1,0,0) in offsetSpace1 is (0,0,0) in xrReferenceSpace.

@klausw
Copy link
Contributor

klausw commented May 15, 2019 via email

@toji toji force-pushed the explainer-offset branch from 74f14e8 to 582f805 Compare May 15, 2019 21:02
@toji toji force-pushed the explainer-offset branch from 582f805 to bf53273 Compare May 20, 2019 17:38
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.

Are we close to landing this one? I know that @thetuvix is blocked so he can rebase on it...

Frequently developers will want to provide an additional, artificial transform on top of the user's tracked motion to allow the user to navigate larger virtual scenes than their tracking systems or physical space allows. This effect is traditionally accomplished by mathematically combining the API-provided transform with the desired additional application transforms. WebXR offers developers a simplification to ensure that all tracked values, such as viewer and input poses, are transformed consistently.

Developers can specify application-specific transforms by setting the `originOffset` attribute of any `XRReferenceSpace`. The `originOffset` is initialized to an identity transform, and any values queried using the `XRReferenceSpace` will be offset by the `position` and `orientation` the `originOffset` describes. The `XRReferenceSpace`'s `originOffset` can be updated at any time and will immediately take effect, meaning that any subsequent poses queried with the `XRReferenceSpace` will take into account the new `originOffset`. Previously queried values will not be altered. Changing the `originOffset` between pose queries in a single frame is not advised, since it will cause inconsistencies in the tracking data and rendered output.
Developers can specify application-specific transforms by calling the getOffsetReferenceSpace() method of any XRReferenceSpace. This returns a new XRReferenceSpace where the XRRigidTransform passed to getOffsetReferenceSpace() describes the position and orientation of the offset space's origin in relation to the base reference space's origin. Specifically, originOffset.position contains the coordinates of the new origin relative to the base reference space's origin. If the base reference space was also created with getOffsetReferenceSpace(), the overall offset is the combination of both transforms.
Copy link
Member

Choose a reason for hiding this comment

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

Specifically, originOffset.position contains the coordinates of the new origin relative to the base reference space's origin.

Seems strange to be calling out position, but not orientation. Almost implies that orientation is ignored.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems strange to be calling out position, but not orientation. Almost implies that orientation is ignored.

That wasn't the intent, a reason for having this here is that it's a fairly straightforward example that's easy to sanity check in terms of coordinates, and the previous sentence already mentioned "position and orientation". It's difficult to make a short-but-concrete example based on quaternions.

We could add something along these lines, but I think this may get clunky?

... and originOffset.orientation is a quaternion representing a rotation that transforms vectors in offset space coordinates to their coordinate values in the base reference space.

Copy link
Contributor

Choose a reason for hiding this comment

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

In general, if we could centrally establish once in the spec that a "pose" is a position and orientation applied in a specific order within a base space, we could easily and consistently describe all such use of poses throughout the spec in a straightforward manner:

This returns a new XRReferenceSpace where the XRRigidTransform passed to getOffsetReferenceSpace() describes the pose of the offset space's origin within the base space.

@AdaRoseCannon AdaRoseCannon added the agenda Request discussion in the next telecon/FTF label May 23, 2019
@toji toji merged commit 87d4e55 into master May 25, 2019
@toji toji deleted the explainer-offset branch May 25, 2019 21:46
@AdaRoseCannon AdaRoseCannon added ed:explainer Include in newsletter, explainer change ed:spec Include in newsletter, spec change and removed agenda Request discussion in the next telecon/FTF labels Jun 17, 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.

Update origin offset handling in the explainer.

6 participants