pmndrs / react-xr

🤳 VR/AR with react-three-fiber
https://npmjs.com/@react-three/xr
MIT License
1.98k stars 137 forks source link

Support for WebXR Depth Sensing? #309

Open Patrick-van-Halm-360Fabriek opened 3 months ago

Patrick-van-Halm-360Fabriek commented 3 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