three.js icon indicating copy to clipboard operation
three.js copied to clipboard

Enable Depth Sensing for immersive-ar applications.

Open listdo opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe.

In my research project we are looking for a way to use depth sensing and access depth data from immersive ar applications. Currently it seems like it is not possible to enable the optional feature "depth-sensing" provided by the api of modern browsers.

Describe the solution you'd like

I would like to be able to use the new "depth-sensing"-feature provided by the modern chrome browser api described in: https://www.w3.org/TR/webxr-depth-sensing-1/

Describe alternatives you've considered

All alternatives that lead to the same result.

listdo avatar Apr 11 '22 12:04 listdo

@listdo Which modern browsers support this feature? Is there a demo we can try?

mrdoob avatar Apr 12 '22 17:04 mrdoob

@mrdoob As far as i understood it is currently only supported by Chrome and Chrome for Android. In the following link is the feature status for chrome and there are two examples linked that use the browser api.

https://chromestatus.com/feature/5742647199137792

listdo avatar Apr 12 '22 18:04 listdo

here is the WebXR sample: https://storage.googleapis.com/chromium-webxr-test/r1067245/proposals/phone-ar-depth-gpu.html this feature is available since Chrome 90 and can be enabled session.depthDataFormat != "luminance-alpha"

with a bit of work, this would allow occlusion of threejs scenes with the real world, like this: https://developers.google.com/ar/develop/unity/depth/quickstart

julapy avatar Jan 03 '23 05:01 julapy

it looks like this is supported today by passing { 'optionalFeatures': [ 'depth-sensing'] } to XRButton.createButton()

https://github.com/search?q=repo%3Amrdoob%2Fthree.js%20depth-sensing&type=code

zz85 avatar Feb 13 '24 17:02 zz85

A first approach of depth sensing has been implemented via #27586 (r161).

Mugen87 avatar Feb 27 '24 09:02 Mugen87

Hi, I just tried the Dragging demo: https://threejs.org/examples/webxr_xr_dragging.html

and got the following warning:

XRButton.js:69 Feature 'depth-sensing' is not supported for mode: immersive-ar

billleap avatar May 14 '24 04:05 billleap

@billleap Any chance you can share the device you got that error with?

mrdoob avatar May 14 '24 05:05 mrdoob

@billleap Any chance you can share the device you got that error with?

I am seeing the same error on Magic Leap 2 device. I think the issue is because depth-sensing implementation in threejs does not use XRDepthStateInit, while using depth-sensing feature.

idrisshah avatar May 15 '24 14:05 idrisshah

@mrdoob @idrisshah I was using S21 5G (SM-G991U) Android 13. I used ADB and 'chrome://inspect/#devices' to see the warning.

billleap avatar May 15 '24 14:05 billleap

I am seeing the same error on Magic Leap 2 device. I think the issue is because depth-sensing implementation in threejs does not use XRDepthStateInit, while using depth-sensing feature.

@cabanier Are we missing a check before using depth-sensing?

mrdoob avatar May 16 '24 06:05 mrdoob

I am seeing the same error on Magic Leap 2 device. I think the issue is because depth-sensing implementation in threejs does not use XRDepthStateInit, while using depth-sensing feature.

@cabanier Are we missing a check before using depth-sensing?

It looks like the Quest browser is not requiring that this dictionary is passed. Strange, because I would expect the existing Chromium code to enforce this. We should fix up three.js and pass an empty dict. I'll file an issue to make this optional.

cabanier avatar May 16 '24 14:05 cabanier

Strange, because I would expect the existing Chromium code to enforce this.

Chromium does seem to enforce it here:

idrisshah avatar May 16 '24 14:05 idrisshah