Skip to content
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

WebXRManager: support more than 2 views #23972

Merged
merged 3 commits into from
May 26, 2022

Conversation

CodyJasonBennett
Copy link
Contributor

@CodyJasonBennett CodyJasonBennett commented Apr 29, 2022

Related issue: #19387

Description

I was chatting with @BryanChrisBrown about WebXRManager's limitation to two XRCameras (also noted in three-types/three-ts-types#169) and found @brianpeiris's previous work sufficient enough to support multiview as described in kainino0x/holoplay-webxr#9 (comment).

I tested this with a few demos and a (webxr) emulator equipped with multiview to try:

r140 dev (baseline)

Demo: https://webxr-multicam-4zetdnsmg-codyb.vercel.app/
Code: https://github.com/CodyJasonBennett/webxr-multicam/blob/r140dev-baseline/index.html

image

fix/webxr-multicamera (PR)

Demo: https://webxr-multicam.vercel.app/
Code: https://github.com/CodyJasonBennett/webxr-multicam/blob/main/index.html

image

The only notable changes since have been with RGB depreciations, internal encoding changes, and foveation & reference space features so this worked OOTB.

@CodyJasonBennett CodyJasonBennett changed the title fix: webxr multicamera @CodyJasonBennett WebXRManager: support WebXR multi-view Apr 29, 2022
@CodyJasonBennett CodyJasonBennett changed the title @CodyJasonBennett WebXRManager: support WebXR multi-view WebXRManager: support WebXR multi-view Apr 29, 2022
@cabanier
Copy link
Contributor

Awesome work!
Does this also work if the scene has reflections?

@mrdoob mrdoob added this to the r141 milestone May 11, 2022
@CodyJasonBennett
Copy link
Contributor Author

@cabanier, I haven't noticed anything wrong with rendering. Is there a specific example I can look at?

@cabanier
Copy link
Contributor

@cabanier, I haven't noticed anything wrong with rendering. Is there a specific example I can look at?

try https://threejs.org/examples/?q=vr#webxr_vr_sandbox

@CodyJasonBennett
Copy link
Contributor Author

I'd have to ask @BryanChrisBrown for what this would look like on a real device, but looks fine with multiple views.

Demo: https://webxr-multicam-2v9u5dip5-codyb.vercel.app
Code: https://github.com/CodyJasonBennett/webxr-multicam/blob/reflections/index.html

image

@CodyJasonBennett
Copy link
Contributor Author

@BryanChrisBrown
Copy link

Confirming refraction & reflection work on the Looking Glass as well, we can probably crank the default view resolution a little bit in the config, I’ll submit a PR to HoloPlay WebXR for that though.

IMG_0316.mov

@cabanier
Copy link
Contributor

Can you point me to all the changes that were made to support multiview? Your PR just mentions the perspective camera.
Even though MV is great, we can't make it the default because it doesn't support multisampled output.

@BryanChrisBrown
Copy link

ac56591

So the changes to support adding multiple cameras are here, the request for multiple cameras comes from WebXR’s Device API.

So the HoloPlay WebXR library is essentially acting as the Device in this case and requesting n number of views.

I think there may be a miscommunication with the term multi-view here, I think we’re using it in “this supports multiple views” where as multi-view is an actual render optimization right?

@CodyJasonBennett CodyJasonBennett changed the title WebXRManager: support WebXR multi-view WebXRManager: support multiple views May 11, 2022
@cabanier
Copy link
Contributor

ah. I see :-)
We're still planning on doing gl based multiview. Would that interfere with this change?

@CodyJasonBennett
Copy link
Contributor Author

CodyJasonBennett commented May 11, 2022

Sorry for the confusing language, I updated the title. This PR implements support for multiple XRViews, I do not implement OVR_multiview2, but would be interested in what that would entail (although for another PR).

We're still planning on doing gl based multiview. Would that interfere with this change?

Not if you're setting the number of views based on pose, seems that's all we'd need. Although it looks like there's a MAX_VIEWS_OVR which I'm not sure if you'd prefer to read from (or how that would interact with devices like the looking glass where it may not be using all of its hardware capabilities).

I'd be happy to put together a demo with both if you think that would help to greenlight the change. I experimented with a basic XR renderer before which I can A/B with (will have to port to three, syntax is slightly different):

image

@BryanChrisBrown
Copy link

Having a 4 view limitation would definitely hurt us here since the Looking Glass requires a minimum of 45 views, going over 45 isn’t required on the Looking Glass Portrait device, but the larger Looking Glass 4K & 8K device do benefit from a slightly larger number of views.

So it doesn’t look like going the multi-view route would work for our case given the current four view limitation, is this something that could be amended or is it a hardware limitation for graphics processors?

@CodyJasonBennett
Copy link
Contributor Author

I suppose see #24048 for an implementation.

@CodyJasonBennett
Copy link
Contributor Author

CodyJasonBennett commented May 25, 2022

Are there any outstanding issues with this PR? AFAIK OCULUS_multiview (see #24048) would be limited to headsets like the Quest, but it looks like the code path for other WebXR devices would remain intact.

@mrdoob mrdoob merged commit 997637f into mrdoob:dev May 26, 2022
@mrdoob
Copy link
Owner

mrdoob commented May 26, 2022

All good. Thanks!

@mrdoob mrdoob changed the title WebXRManager: support multiple views WebXRManager: support more than 2 views May 26, 2022
@CodyJasonBennett CodyJasonBennett deleted the fix/webxr-multicamera branch May 26, 2022 05:31
abernier pushed a commit to abernier/three.js that referenced this pull request Sep 16, 2022
* WebXRManager: support WebXR multi-view

* WebXRManager: cleanup camera init

* WebXRManager: cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants