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:
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.
According to the WebXR Layers API spec the
widthandheightof anXRQuadLayerare 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 extendswidthto the left and right, andheightup and down. Resulting in a2 * widthby2 * heightquad.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
Usages
Various libraries and frameworks already account for this discrepancy when creating layers:
width = 1andheight = 1: https://github.com/immersive-web/webxr-samples/blob/main/layers-samples/quad-ab-test.html#L173-L174Ideally the implementation(s) would be fixed so that the
widthandheightproperties match the actual dimensions. Though, given the above list, it might be easier to change the wording in the spec instead.