Skip to content

Width and height of XRQuadLayer are actually half width and half height #324

@mrxz

Description

@mrxz

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions