immersive-web / immersive-web/layers
Width and height of XRQuadLayer are actually half width and half height
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 96
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
According to the WebXR Layers API spec the width and height of an XRQuadLayer are the dimension of the layer in meters. In practice however it seems that they are "half" width and height. From the center position of the layer, the quad extends width to the left and right, and height up and down. Resulting in a 2 * width by 2 * height quad.
This can be observed with the Meta Quest Browser on Quest devices, as well as with the webxr-layers-polyfill. Not sure if there are other XR devices/browsers implementing it this way or if they implement it according to the spec.
Spec
The width and height attributes set and return the width and height of the layer in meters.
(Source: https://www.w3.org/TR/webxrlayers-1/#dom-xrquadlayer-width)
Usages
Various libraries and frameworks already account for this discrepancy when creating layers:
- Three.js: https://github.com/mrdoob/three.js/blob/dev/src/renderers/common/XRManager.js#L1523-L1524
- A-Frame: https://github.com/aframevr/aframe/blob/master/src/components/layer.js#L258-L262
- webxr-layers-polyfill: https://github.com/immersive-web/webxr-layers-polyfill/blob/main/src/gl/quad-renderer.ts#L32-L57
- WebXR Samples > Layer Samples > Layer VS Non-Layer
- Quad layer is created with
width = 1andheight = 1: https://github.com/immersive-web/webxr-samples/blob/main/layers-samples/quad-ab-test.html#L173-L174 - Non-layer quad is created with size 2 (= 2x2): https://github.com/immersive-web/webxr-samples/blob/main/layers-samples/quad-ab-test.html#L88
- Quad layer is created with
Ideally the implementation(s) would be fixed so that the width and height properties match the actual dimensions. Though, given the above list, it might be easier to change the wording in the spec instead.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the WebXR Layers API specification's XRQuadLayer width and height definition with the linked webxr-layers-polyfill quad-renderer.ts and WebXR Samples quad-ab-test.html. Check the referenced Three.js and A-Frame layer creation code to understand the existing workaround, then determine whether the repository should clarify the specification or coordinate an implementation fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- api, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100