WebXR Depth Sensing API

Working on WebXR Depth Sensing, that allows to get depth texture of an AR session camera.
It works way more reliably than hit test on platforms where Depth API is supported, as it constructs depth texture all the time, so at least some information is available constantly, although can vary in precision and resolution based on hardware and underlying AR system.

PR: https://github.com/playcanvas/engine/pull/2561

6 Likes

Made some progress, added GPU path, and here is two tweets with a video:
https://twitter.com/mrmaxm/status/1328786959511195654 - depth visualized as gradient
https://twitter.com/mrmaxm/status/1329151944540254208 - depth occlusion with objects placement

And the demo, but first, make sure you have:

  1. Android Chrome 87+
  2. Navigate to chrome://flags and enable webxr-incubations
  3. Make sure you have device that supports ARCore Depth API: https://developers.google.com/ar/discover/supported-devices
  4. If all ok, go to: https://playcanv.as/p/UN0z1XE2/

2 Likes

Tested it, on a Samsung Galaxy S10 and it works beautifully! Nice work Max.

1 Like