Skip to content

Conversation

@dli7319
Copy link
Collaborator

@dli7319 dli7319 commented Dec 13, 2025

Setting matchDepthView to false allows us to use depth without incurring the performance penalty of Chrome reprojecting the depth. Now, we reproject the depth samples when running object detection which should be much faster.

Tested on Moohan only.

@dli7319
Copy link
Collaborator Author

dli7319 commented Dec 13, 2025

I want to test something before I submit.

const depthUV = transformRgbToDepthUv(rgbUv, xrDeviceCamera);
const depthUV = transformRgbToDepthUv(
rgbUv,
viewProjectionMatrix.clone().invert(),
Copy link
Collaborator

@nsalminen nsalminen Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're currently inverting viewProjectionMatrix both times we use it. For a minor optimization, we could move the line that creates viewProjectionMatrixInverse up and use that so we only invert once.

this.depthProjectionMatrices[viewId].copy(camera.projectionMatrix);
this.depthViewMatrices[viewId].copy(camera.matrixWorldInverse);
}
this.depthViewProjectionMatrices[viewId].multiplyMatrices(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to double-check during testing: the depth view-projection matrix currently seems to built as view * projection. Given how it's later passed around and applied as a clip-from-world transform, I wonder if it may need to be the other way around (projection * view)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes good catch. Thanks.

@dli7319 dli7319 force-pushed the depth_view_object_detection branch 3 times, most recently from 1bdf8e1 to 4283965 Compare December 17, 2025 22:31
@dli7319
Copy link
Collaborator Author

dli7319 commented Dec 17, 2025

@nsalminen @ruofeidu Can you review this again? I made tons of changes. You can now change the simulator depth fov.

@dli7319 dli7319 force-pushed the depth_view_object_detection branch from 4283965 to a9ba290 Compare December 17, 2025 23:16
Copy link
Collaborator

@ruofeidu ruofeidu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Nels for the catch!

@dli7319 dli7319 merged commit 689e2f0 into main Dec 18, 2025
7 checks passed
@dli7319 dli7319 deleted the depth_view_object_detection branch December 18, 2025 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants