WebXR Depth Sensing API dont work in three js r168

Hello everyone,

I’m working with the WebXR Depth Sensing API to obtain depth data in my project. I’ve been using Three.js version r148 with the following session initialization:

const sessionInit = {
  requiredFeatures: ["hit-test", "local-floor", "depth-sensing"],
  optionalFeatures: ["dom-overlay", "light-estimation", "anchors"],
  depthSensing: {
    usagePreference: ["cpu-optimized", "gpu-optimized"],
    dataFormatPreference: ["luminance-alpha", "float32"],
  },
  domOverlay: {
    root: elementsOverlay as HTMLElement,
  },
};

With this setup, everything works perfectly.

Recently, I needed to update Three.js to the latest version (r168). However, after updating, the WebXR session no longer starts, and I receive the following error:

Cannot read properties of null (reading 'getDepthInformation')

It seems that the method getDepthInformation is returning null, causing the error.

I’m looking for guidance on how to properly use the depth-sensing API with Three.js version r168. Have there been any changes or deprecations in the API that I need to be aware of? How should I modify my code to make it work with the latest version?

Any help or pointers would be greatly appreciated!

Thank you in advance.