Re: [w3ctag/design-reviews] WebXR Dynamic Viewport Scaling (#588)

@atanassov asked:
> What is the event mode for when a scale changes for a particular view - like a DPI change on a particular display? Not apparent that the view object has an event for it?

I'm not familiar with "event mode" in this context - are you referring to [MediaQueryList](https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList) `change` events?

In short, I don't think this is applicable. XR views don't have associated DPI values, and the closest equivalent (angular resolution in pixels per degree) is a fixed property of the display device that doesn't change during the session. WebXR applications typically scale objects in real-world sizes, not based on pixel counts.

The details get a bit complicated. XR views are used for WebGL drawing which doesn't have any text output operations. Applications can get an angular resolution estimate (pixels per degree) by calculating an overall field-of-view angle from the view's associated [projectionMatrix](https://immersive-web.github.io/webxr/#ref-for-dom-xrview-projectionmatrix%E2%91%A1) combined with the corresponding [viewport](https://immersive-web.github.io/webxr/#ref-for-dom-xrwebgllayer-getviewport%E2%91%A2) pixel size. This current angular resolution can change as a result of applying a [framebufferScaleFactor](https://immersive-web.github.io/webxr/#dom-xrwebgllayerinit-framebufferscalefactor) or a dynamic viewport scale, but these changes are all fully under the application's control and won't change unless the application changes the scale actively. The actual angular resolution of a headset is fixed in hardware as a property of its lenses and physical display and doesn't change during an XR session, so there are no associated events. The application can get baseline values for scaling if needed by referring to the [native WebGL framebuffer resolution](https://immersive-web.github.io/webxr/#native-webgl-framebuffer-resolution) via [getNativeFramebufferScaleFactor](https://immersive-web.github.io/webxr/#ref-for-dom-xrwebgllayer-getnativeframebufferscalefactor).

For background, WebXR view objects basically correspond to rectangular subsections of the opaque framebuffer object associated with the current session's [XRWebGLLayer](https://immersive-web.github.io/webxr/#xrwebgllayer). For example, a typical VR headset would split the framebuffer into one half for the left eye, and the other half for the right eye. The framebuffer is passed to the XR device for display, and device-specific code is then responsible for presenting the appropriate content to each eye.

When dynamic viewport scaling is in use, the application uses a smaller subsection of the overall framebuffer for rendering which is then scaled to fit the final view, effectively reducing resolution while keeping angular sizes constant. This is under the application's control. An application could choose to adjust font sizes in response to a scaling change, but this would likely appear jarring and unexpected.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/588#issuecomment-801253226

Received on Wednesday, 17 March 2021 17:05:23 UTC