google-ar / three.ar.js

A helper three.js library for building AR web experiences that run in WebARonARKit and WebARonARCore
https://developers.google.com/ar/develop/web/getting-started
Apache License 2.0
2.91k stars 366 forks source link

reset AR session #67

Closed jimmy-jam closed 6 years ago

jimmy-jam commented 7 years ago

allow the AR session to be reset, allowing recovery if your tracking gets lost or allowing you to retain the tracking but turn off features like plane finding etc.

jsantell commented 7 years ago

Can you explain more please? If tracking is lost, it'll attempt to recover on its own -- in terms of feature toggling, this is something we may explore for the standardized AR spec (built off of WebVR 2.0 which handles a session request with features), but unlikely for these AR browsers as it'd be a big change, and plane tracking is required for the baseline scene understanding function hitTest anyway

judax commented 7 years ago

WebARonARKit and WebARonARCore both support resetPose in the VRDisplay instance (from the WebVR 1.1 spec). Still, this does not cover all the needs you lay in the issue.

Having more detailed control over the session would be ideal but WebVR 1.1 does not provide much functionality to configure a session (there is no even the concept of a session!) so for now we have decided to go for the basics/default configurations.

What is the use case for all this?

jimmy-jam commented 7 years ago

Use case 1: I only want a single flat surface to place my content on - afterwards I don't want to find any more planes. The idea is that finding planes might use up more processing power and battery life, so don't do it if you don't need it.
https://developer.apple.com/documentation/arkit/arworldtrackingconfiguration/2923548-planedetection https://developers.google.com/ar/reference/java/com/google/ar/core/Config.PlaneFindingMode

Use case 2: same thing for light estimation https://developers.google.com/ar/reference/java/com/google/ar/core/Config.LightingMode https://developer.apple.com/documentation/arkit/arconfiguration/2923546-islightestimationenabled

judax commented 7 years ago

I am not 100% sure but I don't think you can continue having the ARSession and disabling the planes. If you restart the session with the new configuration, I think all the tracking is lost. I might be wrong though... I could try to test it. Still, I agree that it would be great to have granularity in the control of the session configuration.

jimmy-jam commented 7 years ago

In the ARKit case, I know that tracking is not lost when you run with a new configuration, unless you set the runOption to "resetTracking". ARCore, not sure.

code-matt commented 6 years ago

This would be a big help. My project needs all the CPU resources it can get.

In my case, once the user gets an anchor on the floor during setup phase, I no longer care about planes. Would be great to be able to turn that off and just getting pose from there on out.

jsantell commented 6 years ago

AR proposals are now landing in the Immersive Web organization: hit-test, anchor -- closing this, as this will be addressed by the WebXR standard