pmndrs / xr

🤳 VR/AR for react-three-fiber
https://pmndrs.github.io/xr/docs/
Other
2.12k stars 152 forks source link

Support for WebXR Depth Sensing? #309

Closed Patrick-van-Halm-360Fabriek closed 3 weeks ago

Patrick-van-Halm-360Fabriek commented 5 months ago

Will there be support for WebXR Depth Sensing, since currently there are issues with it?

toggleSession("immersive-ar", {
  sessionInit: {
    optionalFeatures: ["light-estimation", "depth-sensing"],
    requiredFeatures: ["hit-test", "local"],
    // @ts-ignore
    depthSensing: {
      usagePreference: ["cpu-optimized", "gpu-optimized"],
      dataFormatPreference: ["luminance-alpha", "float32"],
    },
  }
});

Causes an error as soon as the XR session is started. Within Three JS it seems like the XRManager:

if ( enabledFeatures && enabledFeatures.includes( 'depth-sensing' ) ) {
  const depthData = glBinding.getDepthInformation( views[ 0 ] ); // Throws error since glBinding is null/undefined
  if ( depthData && depthData.isValid && depthData.texture ) {
    depthSensing.init( renderer, depthData, session.renderState );
  }
}

Depth Sensing has been added to Three JS since r161

bbohlender commented 3 weeks ago

this has now an official API in react-three/xr v6.2 via depthSensing: true when creating a xr store