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

The webxr example is broken when enabling VR #2473

Open
AnthonyGlt opened this issue Dec 4, 2024 · 3 comments
Open

The webxr example is broken when enabling VR #2473

AnthonyGlt opened this issue Dec 4, 2024 · 3 comments
Assignees
Labels

Comments

@AnthonyGlt
Copy link
Contributor

Since the bump of the three.js version f7303de
The view_3d_map_webxr example doesn't work anymore when entering the VR mode

Screencast.from.04-12-2024.17.30.28.webm

Context

Steps to Reproduce

  1. Run the view_3d_map_webxr example
  2. Click on Enter VR
  3. Blank screen

Possible Cause/Fix/Solution

Since this merge in three.js, there is a condition on matrixWorldAutoUpdate .

To fix it, we should somehow set
view.scene.matrixWorldAutoUpdate = true;
either in the file view_3d_map_webxr.html
or in WebXR.js, using this kind of workaround
So in WebXR.js , above these lines

view.camera.camera3D.updateMatrix();
view.camera.camera3D.updateMatrixWorld(true);
view.notifyChange(view.camera.camera3D, true);

we could add

                const prevMatrixWorldAutoUpdate = view.scene.matrixWorldAutoUpdate;
                view.scene.matrixWorldAutoUpdate = true;
                view.scene.updateMatrix();
                view.scene.updateMatrixWorld();
                view.scene.matrixWorldAutoUpdate = prevMatrixWorldAutoUpdate;
@jailln
Copy link
Contributor

jailln commented Dec 5, 2024

I wonder how there aren't more things broken as I read the comments from mrdoob/three.js#28533.

In my opinion, we should harmonize the xr and non-xr behaviour: either set autoupdate to false in both cases and manage matrices updates ourselves, or set autoupdate to true for both context.

I haven't looked into it yet but first we need to remember why we set the autoupdate to false and if there's really a performance gain or if we'd be better off setting it to true and avoiding the hassle and bugs.

@Desplandis wdyt?

@AnthonyGlt
Copy link
Contributor Author

It should be noted that we set scene.matrixWorldAutoUpdate = false; in View.js

itowns/src/Core/View.js

Lines 193 to 195 in 683e55d

if (!options.scene3D) {
this.scene.matrixWorldAutoUpdate = false;
}

@jailln
Copy link
Contributor

jailln commented Dec 16, 2024

After discussing it online, we need to check:

  • what is the real perf gain of setting matrixWorldAutoUpdate to true in the context of itowns (measure it)
  • decide if we set it to true or find a pattern to set it to false and avoid bugs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants