w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.52k stars 673 forks source link

[mediaqueries-5] Introduce a media feature to detect an immersive or virtual environment #2723

Closed rcabanier closed 6 years ago

rcabanier commented 6 years ago

add feature to section https://drafts.csswg.org/mediaqueries-5/#mf-environment

We've heard from many authors that they want to change the look of web pages when they are displayed in an immersive display and there is currently no way to do this using CSS media queries. For an example, see the section "Pull the Web Out of the Screen" on magicleap.com

https://github.com/w3c/csswg-drafts/pull/2719 is a rough proposal

frivoal commented 6 years ago

I've made a couple of low level comments on the pull request itself. Here are higher level observations:

AmeliaBR commented 6 years ago

What kind of adjustments do people typically want to make? ... In what ways are VR environments special?

I think these are important questions to answer. It might turn out that it is more useful to break this down into multiple independent features.

For example, the ability to include stereoscopic content is obviously one feature that comes with VR/AR headsets, but regular smartphones often also have a stereoscopic mode. An author might want to be able to detect whether stereoscopic mode is available, versus whether it is currently active.

Another aspect is whether the webview is overlaid on reality in a semi-transparent display. This can be used in AR environments, but it can also be used in car displays (projecting on the inside of the windshield) and "Google glass" style headsets which don't support stereoscopic effects in the display itself.

I'm sure people who are more familiar with VR/AR work could come up with other, specific features of these displays. We need to consider that the current common grouping of features into "VR" and "AR" won't necessarily persist in the future.

astearns commented 6 years ago

This seems like something that the Immersive Web Community Group may have some thoughts on. @NellWaliczek, @toji, or @dontcallmedom have media queries come up there?

rcabanier commented 6 years ago

For example, the ability to include stereoscopic content is obviously one feature that comes with VR/AR headsets, but regular smartphones often also have a stereoscopic mode. An author might want to be able to detect whether stereoscopic mode is available, versus whether it is currently active.

CSS doesn't have any features that apply to stereoscopic viewing so it's unclear why an author would like to detect this. Maybe there's a need to detect it for script driven content but that will rely on other features such as WebXR

Another aspect is whether the webview is overlaid on reality in a semi-transparent display. This can be used in AR environments, but it can also be used in car displays (projecting on the inside of the windshield) and "Google glass" style headsets which don't support stereoscopic effects in the display itself.

Yes, I think that would be applicable. Maybe we should go for a transparent display feature instead of "reality"

rcabanier commented 6 years ago

Can we start by listing what types of VR devices exist and how they present web pages? You suggest that we group them in 2, with an open issue on whether the second category is useful. You may be right, but I am not sufficiently familiar with all what's out there to be sure without further research that this is the right way to go about it.

I am unsure as well which is why I put an issue on VR. Current VR/AR browsers don't seem to be doing anything special for regular layout.

What kind of adjustments do people typically want to make? The example you give is a contrast inversion, and we are already discussing another media feature for that purpose.

It's not just contrast inversion (although that does come close to the desired color scheme). Typically, authors want to present information in a less dense fashion with bigger and lighter colored text.

In what ways are VR environments special?

We don't have a VR environment so I don't really know :-)

What aspect of that calls for differentiated styling?

For immersive, it's a lot like looking at your TV or a poster. You could walk closer and read tiny text but it's more comfortable to sit on your couch and scroll more. So, it's a lot like looking at your TV except you can see right it when no light is added.

I think our concept video shows it pretty well, especially around the 1:25 mark: https://www.youtube.com/watch?v=GmdXJy_IdNw

rcabanier commented 6 years ago

This seems like something that the Immersive Web Community Group may have some thoughts on.

I think @AmeliaBR might be onto something. Our issue is more with the transparent nature of the display and not really with being immersive.

blairmacintyre commented 6 years ago

I made some comments over on the PR to answer some of these questions. (@astearns I'm part of the WebXR community, so while I don't speak for them, I'm coming from that viewpoint).

I like this media query. There are two kinds of things we need in the web to deal with XR devices:

The WebXR API is concerned with the later. Regardless of how the page itself is presented (e.g., on a 2D desktop, on a computer with a Vive/WindowsMR/Rift attached; in 3D in VR in WindowsMR's "Cliff House" home space; in 3D in AR on Hololens or Magic Leap, etc), WebXR is about telling the web page what displays are available and allowing them to draw 3D graphics with WebGL on that display in a "full 3D immersive" mode.

This media query, and (I think the motivation behind it) is concerned with the former: what is the sort of display environment in which we are rendering a web page (HTML content).

In the case of a display attached to a computer (e.g., the Vive), the web page is still 2D on a traditional display, but the VR display used by WebXR is 3D VR. So this media query would return something indicating a traditional 2D display.

I mention this because things like stereoscopic seem outside the scope of this, without much more dramatic changes to HTML/CSS: there is no way to cause the page to appear differently to the 2 eyes from the viewpoint of the web developer. That is something the browser itself would deal with (e.g., you could imagine the text or images being rendered slightly differently, not just in slightly different locations, to give the best combined appearance).

What the dev cares about, as highlighted by the original post, is much more mundane: what is the sort of display environment?

This media query is "the most basic" one and needed as a starting point to handle the big-picture adaptations across these 4 sorts of different environments: traditional, VR, video-mixed, optically-mixed.

Beyond that, there are other things we might want to add, but they start to tell pages about the world, and have privacy implications:

These both feel beyond the scope of this particular query, and it's less clear how they would work.

There are also ideas around "popping 3D objects out of the page into the world" (e.g., that the Meta CEO showed demos of in TED talks, for example). These would require more substantial changes to CSS or new HTML elements. But, you could imagine wanting to change tagging automatically based on a query (e.g., if you had a DOM element that somehow could pop out into the 3D world, you might want to enable it in VR/Mixed but not on a traditional 2D display).

kearwood commented 6 years ago

Perhaps the media query could inform content when the page is displayed in augmented reality with a display that has an additive brightness effect. In this case, "Additive" means that black is essentially transparent/invisible and white always has the most visible contrast. Pages that normally use a dark on light background will likely want to use a light on dark background in this case.

This may not be the ideal for VR immersive displays; however, which can render dark images over light backgrounds.

In both cases, content would likely use a variation of the formatting normally used for touch-optimized phone and tablet interfaces. Unlike phones and tablets; however, scrolling is not as ergonomic in AR and VR.

rcabanier commented 6 years ago

Perhaps the media query could inform content when the page is displayed in augmented reality with a display that has an additive brightness effect.

We shouldn't even mention augmented reality since it applies to head up displays as well. I like you suggestion of environment-blending. (It could even be just "environment")

What do people think of: environment: opaque | additive

rcabanier commented 6 years ago

@blairmacintyre I agree that there is a lot of work on the CSS/HTML front to make web pages that can take advantage of an immersive environment. A media query for 2D/VR/AR should be part of that work.

We're very interested in collaborating with other people on exploring this but I don't think there's a group that is working on this particular problem.

frivoal commented 6 years ago

given that #2719 has been merged, can this be closed?

rcabanier commented 6 years ago

Yes.

On Sun, Jul 1, 2018 at 8:10 AM Florian Rivoal notifications@github.com wrote:

given that #2719 https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_w3c_csswg-2Ddrafts_pull_2719&d=DwMCaQ&c=0ia8zh_eZtQM1JEjWgVLZg&r=jahSgznxrAL5kPgsRvs7bhKUEd9M5X0d-NE2WJg7VT0&m=pzHu9hSX0ZbSkDw0qlLxFG9qTjEzN9t2yGWjWOMLycc&s=4UZ4l7Nw4LvxvLKJBJBhnqlcEzRH5ouAvUmb6vQluf8&e= has been merged, can this be closed?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_w3c_csswg-2Ddrafts_issues_2723-23issuecomment-2D401612820&d=DwMCaQ&c=0ia8zh_eZtQM1JEjWgVLZg&r=jahSgznxrAL5kPgsRvs7bhKUEd9M5X0d-NE2WJg7VT0&m=pzHu9hSX0ZbSkDw0qlLxFG9qTjEzN9t2yGWjWOMLycc&s=S1ixLZrdssNFyhE5KNMGgUt12x3942RKb37Hlit_fak&e=, or mute the thread https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AlHhyWJidzvOujTWvE-2DuX8Bg8v-5Fy7CHOks5uCOZ0gaJpZM4UUVMe&d=DwMCaQ&c=0ia8zh_eZtQM1JEjWgVLZg&r=jahSgznxrAL5kPgsRvs7bhKUEd9M5X0d-NE2WJg7VT0&m=pzHu9hSX0ZbSkDw0qlLxFG9qTjEzN9t2yGWjWOMLycc&s=lwXSFZsvmQb9RC6_ridqXBIRJBaa_smlLRxC3pLG--g&e= .