Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebXRHand recreates mesh and shader on construction #10453

Closed
rgerd opened this issue Jun 3, 2021 · 0 comments · Fixed by #10481
Closed

WebXRHand recreates mesh and shader on construction #10453

rgerd opened this issue Jun 3, 2021 · 0 comments · Fixed by #10481
Assignees
Labels
Milestone

Comments

@rgerd
Copy link
Member

rgerd commented Jun 3, 2021

Repro

  • Test a scene on HoloLens using BabylonNative, and inside the call to createDefaultXRExperienceAsync, call:
xr.baseExperience.featuresManager.enableFeature(
                        BABYLON.WebXRFeatureName.HAND_TRACKING,
                        "latest",
                        { xrInput: xr.input });
  • Move your hands in and out of view, paying attention to the console, which will signal that shaders are being recompiled, and notice that performance dips considerably.

This is due to the following call in the WebXRHand constructor:

this._generateDefaultHandMesh();

Which causes a mesh import:
const loaded = await SceneLoader.ImportMeshAsync("", "https://assets.babylonjs.com/meshes/HandMeshes/", filename, this._scene);

And a material compilation:
handShader.build(false);

We should be pre-loading the meshes and materials and enabling/disabling them as hands go in and out of view, instead of recreating them every time.

@rgerd rgerd self-assigned this Jun 3, 2021
@deltakosh deltakosh added this to the 5.0 milestone Jun 3, 2021
@mergify mergify bot closed this as completed in #10481 Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants