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: Add AR plane detection. #24855

Merged
merged 1 commit into from
Nov 3, 2022
Merged

WebXRManager: Add AR plane detection. #24855

merged 1 commit into from
Nov 3, 2022

Conversation

richardanaya
Copy link
Contributor

@richardanaya richardanaya commented Oct 26, 2022

Related #24792.

Description

Added support for Meta Quest Pro and Quest 2 support for plane detection API along with an example.

image

@richardanaya richardanaya changed the title Adding ar plane detection event to WebXRManager and plane detection demo Adding WebXR AR plane detection event to WebXRManager and plane detection demo Oct 26, 2022
@richardanaya richardanaya force-pushed the dev branch 4 times, most recently from cdb8017 to 9a24e15 Compare October 26, 2022 07:36
@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 26, 2022

Please add the new example to https://github.com/mrdoob/three.js/blob/dev/examples/files.json so it appears at the side menu.

Also create a thumbnail via npm run make-screenshot webxr_ar_plane_detection (even if the screenshot will be black for now).

@richardanaya
Copy link
Contributor Author

@Mugen87 Added files.json and screenshot :)

I think there might be a problem with that link you sent to test since this example depends upon a compiled threejs. I made a test branch here that has my change to WebXRManager compiled in.

https://raw.githack.com/richardanaya/three.js/test/examples/webxr_ar_plane_detection.html

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 26, 2022

Thanks for updating the link!

How do I test this with a Quest 2? I've only used the device for VR so far. When opening the example, I see the same output like on my desktop (black screen and the "AR not supported" message).

@richardanaya
Copy link
Contributor Author

richardanaya commented Oct 26, 2022

@Mugen87 right now there's a step you have to do for Quest:

  1. Go to Settings -> Experimental -> Setup Room
  2. Add some walls and doors or anything.
  3. Restart device and you should see the option for AR when you go to try examples in Quest Browser

If it works in the reference demo:
https://immersive-web.github.io/webxr-samples/proposals/plane-detection.html

it should work in:
https://raw.githack.com/richardanaya/three.js/test/examples/webxr_ar_plane_detection.html

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 26, 2022

Thanks for the instruction! Indeed it works as expected.

/cc @cabanier

@Mugen87 Mugen87 added this to the r146 milestone Oct 26, 2022
@cabanier
Copy link
Contributor

  1. Go to Settings -> Experimental -> Setup Room
  2. Add some walls and doors or anything.
  3. Restart device and you should see the option for AR when you go to try examples in Quest Browser

You don't need to restart the device after setting up walls and doors. They are pulled each time you start an immersive session.

@cabanier
Copy link
Contributor

Thanks for the instruction! Indeed it works as expected.

Does this mean that you get a plane event each frame?

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 26, 2022

Thanks for the instruction! Indeed it works as expected.

Does this mean that you get a plane event each frame?

I wanted to say that the rendering looks as expected. Meaning the configured walls are correctly displayed.

The new detectedPlanes event is fired each frame. Isn't that optimal?

@cabanier
Copy link
Contributor

Thanks for the instruction! Indeed it works as expected.

Does this mean that you get a plane event each frame?

I've wanted to say that the rendering looks as expected. Meaning the configured walls are correctly displayed.

The new detectedPlanes event is fired each frame. Isn't that optimal?

It might be nice to get an event each time the planes change.
On Quest, this is only once. On Android this happens constantly.

@richardanaya richardanaya force-pushed the dev branch 2 times, most recently from 24a32ac to 5779791 Compare October 26, 2022 16:37
@richardanaya
Copy link
Contributor Author

richardanaya commented Oct 26, 2022

@Mugen87 added some new events as per @rcabanier 's recommendation and updated example and test deploy.

@richardanaya richardanaya force-pushed the dev branch 6 times, most recently from dbd5ba7 to aba3526 Compare October 26, 2022 22:08
@richardanaya
Copy link
Contributor Author

richardanaya commented Oct 26, 2022

Fixed a small issue related to removing planes while iterating and trying to conserve allocations. Should be good to merge to my knowledge.

@Mugen87 Mugen87 modified the milestones: r146, r147 Oct 27, 2022
@richardanaya richardanaya force-pushed the dev branch 2 times, most recently from b9fac3d to 71438fb Compare October 29, 2022 17:04
@richardanaya richardanaya force-pushed the dev branch 2 times, most recently from 342066c to 3c509d2 Compare October 29, 2022 17:47
@richardanaya
Copy link
Contributor Author

added getKnownPlanes method as a way to acquire known planes outside of event responses.

@richardanaya richardanaya force-pushed the dev branch 5 times, most recently from 0d38a31 to 090d117 Compare October 30, 2022 05:51
@richardanaya
Copy link
Contributor Author

@Mugen87 I went through once more, and tried to make sure style in example and code was consistent. I think this is ready for a review.

@richardanaya
Copy link
Contributor Author

richardanaya commented Oct 30, 2022

@Mugen87 resolved requests with name changes/deprecations and re-tested and updated test branch :)

@richardanaya
Copy link
Contributor Author

Added documentation.

@cabanier
Copy link
Contributor

cabanier commented Nov 3, 2022

LGTM!

@Mugen87 Mugen87 changed the title Adding WebXR AR plane detection event to WebXRManager and plane detection demo WebXRManager: Add AR plane detection. Nov 3, 2022
@Mugen87 Mugen87 merged commit d231f77 into mrdoob:dev Nov 3, 2022
@mrdoob
Copy link
Owner

mrdoob commented Dec 1, 2022

@richardanaya Seems like you can have multiple rooms if you enter/exit XR.

Should the example delete the previous generated geometry when entering XR?

@0b5vr 0b5vr mentioned this pull request Dec 7, 2022
12 tasks
0b5vr added a commit to three-types/three-ts-types that referenced this pull request Dec 19, 2022
@mrdoob
Copy link
Owner

mrdoob commented May 20, 2023

@richardanaya Seems like you can have multiple rooms if you enter/exit XR.

Should the example delete the previous generated geometry when entering XR?

Just took care of this in #26098

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