Skip to content

optimize the performance (fps) of mesh detector in xrblocks#144

Merged
JFGVL1187 merged 2 commits intogoogle:mainfrom
JFGVL1187:webxr-mesh-support
Apr 8, 2026
Merged

optimize the performance (fps) of mesh detector in xrblocks#144
JFGVL1187 merged 2 commits intogoogle:mainfrom
JFGVL1187:webxr-mesh-support

Conversation

@JFGVL1187
Copy link
Copy Markdown
Collaborator

For work collaboration, not for merge yet.

@JFGVL1187 JFGVL1187 requested a review from dli7319 February 4, 2026 22:23
@dli7319
Copy link
Copy Markdown
Collaborator

dli7319 commented Feb 4, 2026

I'd prefer to hold off on this change until your Chromium CL is submitted.

When we're not rendering anything, we should still be able to get 72 fps on Galaxy XR but it's not the case yet.

@JFGVL1187
Copy link
Copy Markdown
Collaborator Author

No Problem. I published this PR so that you can also fetch it and try other optimization methods, e.g. batch rendering if needed.

@ruofeidu
Copy link
Copy Markdown
Collaborator

ruofeidu commented Feb 4, 2026

also do an npm run format :)

@JFGVL1187 JFGVL1187 force-pushed the webxr-mesh-support branch 3 times, most recently from 38a7a31 to 6cb5dad Compare February 5, 2026 00:03
@dli7319 dli7319 removed their request for review February 5, 2026 00:03
}
}

dispose() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good catch.

@JFGVL1187 JFGVL1187 force-pushed the webxr-mesh-support branch 3 times, most recently from 60ff834 to 1cf93c2 Compare February 17, 2026 08:31
@JFGVL1187 JFGVL1187 force-pushed the webxr-mesh-support branch 5 times, most recently from 4603d59 to 845a4e7 Compare April 7, 2026 22:29
Comment thread src/world/mesh/MeshDetector.ts Outdated
this.lastMeshUpdateTime = now;

// Remove meshes no longer in detectedMeshes (from Blink layer)
// this.cleanupUndetectedMeshes(meshes);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we still need this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Have removed this.

Comment thread src/world/mesh/MeshDetector.ts Outdated
frame,
referenceSpace
);
// const isVisible = this.shouldShowMeshInViewWithFrustum(xrMesh, frame, referenceSpace);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we still need this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Have removed this.

Comment thread src/world/mesh/MeshDetector.ts Outdated

// Compute mesh bounding box (AABB)
private computeMeshBoundingBox(xrMesh: XRMesh): {
min: THREE.Vector3;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why don't we use THREE.Box3?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Have switched to THREE.Box3

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is helper func for shouldShowMeshInViewWithFrustum() which should not be used. For efficiency, we are using an approximate method of shouldShowMeshInViewWithFrustum().

Comment thread src/world/mesh/MeshDetector.ts Outdated
const SEMANTIC_COLORS = [0x00ff00, 0xffff00, 0x0000ff];

// Frustum plane structure: plane equation ax + by + cz + d = 0
interface FrustumPlane {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why don't we just use THREE.Plane?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Have switched to THREE.Plane

@JFGVL1187 JFGVL1187 force-pushed the webxr-mesh-support branch from 845a4e7 to 08963b5 Compare April 7, 2026 23:37
@JFGVL1187 JFGVL1187 force-pushed the webxr-mesh-support branch from 08963b5 to 9fa2529 Compare April 7, 2026 23:43
@dli7319
Copy link
Copy Markdown
Collaborator

dli7319 commented Apr 8, 2026

Fyi there is https://threejs.org/docs/#Frustum

@JFGVL1187 JFGVL1187 merged commit 6517109 into google:main Apr 8, 2026
4 checks passed
@JFGVL1187 JFGVL1187 deleted the webxr-mesh-support branch April 8, 2026 00:15
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.

4 participants