-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add feature for secondary views #1083
Add feature for secondary views #1083
Conversation
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
5cd82aa
to
fe28994
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think you should rephrase the intro section that mentions "we expect a significant..."
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
Done |
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
I also made that entire part a note. I don't quite like notes that are of this form, but it's fine, it wasn't normative anyway. |
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
Discussed in the call. The current distinction being made is "additional views", i.e. views that are not the first mono/stereo views. Instead, this should be shifted to be "secondary views": views that you do not have to render to. This applies to bionic displays and FPO views, but not e.g. CAVE. The expectations of the content are the same. The layers spec can also rely on this concept to handle some of the issues in immersive-web/layers#160 , and add additional expectations of code which opts in to secondary-views + layers. We were effectively saying this anyway, given the note about CAVE systems, but the underlying spec concept was less tangible/useful. |
So the idea would be to have an API where each view would have a |
@asajeffrey No, content has no way to distinguish between primary and secondary views in general, though we can add that if requested. If a view is being surfaced to content, content must render to it. Instead, content is able to pass in a feature hinting to the UA that it would like to receive any secondary views, promising to handle it correctly. The changes are going to be similar to what the spec is saying now, with some nuance around the precise definitions of "secondary". |
Ah, makes sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Some minor nits.
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
Co-authored-by: Rik Cabanier <cabanier@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall. Two non-blocking questions:
If [=secondary views=] have lower underlying frame rates, the {{XRSession}} MAY choose to do one or more of the following: | ||
|
||
- Lower the overall frame rate of the application while the [=secondary views=] are active. | ||
- Surface [=secondary views=] in the {{XRViewerPose/views}} array only for some of the frames. Implementations doing this SHOULD NOT have frames where the [=primary views=] are not present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we list a third option, which is to return secondary views every frame, even if they'll be discarded? Obviously not the optimal thing but I can imagine that on some systems that may be the default behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obviously not the optimal thing but I can imagine that on some systems that may be the default behavior.
Do you know of a system that does this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@toji I felt this was implied, and it was with the older language, but I'll make this explicit, thanks.
</div> | ||
|
||
<div class=note> | ||
While content should be written to assume that there may be any number of views, we expect a significant amount of content to make incorrect assumptions about the {{XRViewerPose/views}} array and thus break when presented with more than two views. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recognizing that https://github.com/immersive-web/webxr-ar-module/pull/57/files is still in progress, is there a compelling reason to identify which views are primary/secondary in cases other than the first person observer scenario? My gut says yes, but I can't identify a scenario where you'd need to know other than the first person observer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some other cases I've heard discussed:
- Third-person observer (e.g. similar to Spectator View, although that particular implementation uses app-side state sync to a different device rather than this secondary views mechanism on one device)
- 360-degree screenshot/video (triggered by user in system UI)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@toji I don't see a good reason to identify bionic (quad) views. I think third-person observer would need to be independently identified.
|
||
When "[=secondary views/secondary-views=]" is enabled, the user agent MAY surface any [=secondary views=] the device supports to the {{XRSession}}. The user agent MUST NOT use reprojection to reconstruct [=secondary views=] in such a case, but instead rely on whatever the content decides to render. | ||
|
||
Note: We recommend content use {{XRSessionInit/optionalFeatures}} to enable "[=secondary views/secondary-views=]" to ensure maximum compatibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing we should discuss here is whether to share one big secondary-views
opt-in, or have an opt-in per secondary view scenario. For example, an app might harden itself to render for "first-person observer", but if some other system asks it to render "third-person observer", it may now need to render an avatar or other annotations around the user, and it's unlikely the app is already ready to do that. However, opt-ins that are too granular limit where these platform features can be applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If [=secondary views=] have lower underlying frame rates, the {{XRSession}} MAY choose to do one or more of the following: | ||
|
||
- Lower the overall frame rate of the application while the [=secondary views=] are active. | ||
- Surface [=secondary views=] in the {{XRViewerPose/views}} array only for some of the frames. Implementations doing this SHOULD NOT have frames where the [=primary views=] are not present. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toggling on/off per-frame brings up another issue about whether web apps will need to prepare when they are first told to render to a secondary view. If the app has any spin-up/spin-down (e.g. allocate/release an extra intermediate framebuffer), toggling on/off could aggravate that. Even in the steady-on case, an app may need a frame or two to get its affairs in order before actually providing a frame for that view.
I believe we don't have any way to know if the app is submitting pixels for secondary views, right? Once the UA asks the app to fill them in, it has to assume they are filled, and would end up with black pixels if not? OpenXR is one step more explicit here, having apps decide to submit any given view at the end of the frame, which gives the app frames if needed to warm up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we don't have any way to know if the app is submitting pixels for secondary views, right?
In the case of regular WebXR, yes we don't know.
For WebXR Layers, we will.
Once the UA asks the app to fill them in, it has to assume they are filled, and would end up with black pixels if not?
I believe so.
OpenXR is one step more explicit here, having apps decide to submit any given view at the end of the frame, which gives the app frames if needed to warm up.
Yes, with layers getViewSubImage
indicates that that the view should be submitted. We don't have that with plain WebXR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thetuvix you are correct, we don't have a way of knowing in WebXR. Folks would end up with black pixels here. That might be okay for a few frames IMO.
@toji do you think we can land this? This approach was mostly agreed upon during the meeting AIUI. |
Yeah, I think we can. The only possible concern is #1085 determining that a single big opt in isn't appropriate, but I think we have backwards compatible paths available there. (For example, "secondary-views" would be a primary opt-in that auto-selects an appropriate mode, but a hypothetical "secondary-views-quad" would only enable quad-view style displays and "secondary-views-observer" would only enable observer views, etc.) |
Sounds good! The AR module side (immersive-web/webxr-ar-module#57) also needs to be reviewed, fwiw. |
Allow support for secondary views to be toggled by a pref Implements immersive-web/webxr#1083 , and moves the constant to a pref to be toggled by the user. For now I'd like to keep it a pref since there are perf implications of always enabling this.
Alternate to #1080
This PR adds an additional-views feature that can be used as a hint that the content is expecting additional views.
Related: immersive-web/webxr-ar-module#57
Fixes #1045