Skip to content

Conversation

@munozco
Copy link
Contributor

@munozco munozco commented Feb 19, 2025

This adds a WebXR Helper widget to enable VtkView and VtkLocalView to be used for a WebXR session.
vue-vtk-js PR: Kitware/vue-vtk-js#9

The new VtkWebXRHelper class contains the XrSessionTypes enum that has the same values as XrSessionTypes in vtk.js.

Here's an example that uses the new VtkWebXRHelper widget in a TrameApp:

with vuetify3.VContainer(fluid=True, classes="pa-0 fill-height"):
  with vtk.VtkView() as view:
      self.xr_widget = vtk.VtkWebXRHelper(draw_controllers_ray=True, enterXR=self.ctrl.enterXR, exitXR=self.ctrl.exitXR)
      with vtk.VtkGeometryRepresentation():
          vtk.VtkAlgorithm(vtk_class="vtkConeSource")

# [...]

# start a HmdVR WebXR session
self.xr_widget.startXR(vtk.VtkWebXRHelper.XrSessionTypes.HmdVR)

# stop the session
self.xr_widget.stopXR()

@jourdain
Copy link
Collaborator

You need to update the version of vue-vtk-js in that PR

https://github.com/Kitware/trame-vtk/blob/master/.fetch_externals.sh

Copy link
Member

@finetjul finetjul left a comment

Choose a reason for hiding this comment

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

I do not understand how it knows on which view the helper applies...

@munozco
Copy link
Contributor Author

munozco commented Feb 20, 2025

The helper has a vtkView (or a vtkLocalView) as its parent. It can get the corresponding ClientView (or LocalView) thanks to the Vue.js provide/inject mechanism. For instance, the vtkView Vue component is providing the ClientView object here

@jourdain
Copy link
Collaborator

It would be nice to add an example in this repo showcasing the usage of XR

@munozco
Copy link
Contributor Author

munozco commented Jun 18, 2025

I added an example, let me know if I need to change anything.
I'm not sure why the tests fail... I cannot reproduce this on my machine

@munozco
Copy link
Contributor Author

munozco commented Jun 19, 2025

@jourdain do you think tests failures are related to this change or is the CI unstable ?

@jourdain
Copy link
Collaborator

CI is unstable for remote rendering of volume rendering. (slow and image capture happen before the resized image is retrieved) We may have to disable that test or figure out a way to wait longer before doing image comparison of the browser.

@munozco munozco force-pushed the webxr-helper branch 2 times, most recently from 937543a to 9a08db3 Compare June 20, 2025 13:02
@munozco
Copy link
Contributor Author

munozco commented Aug 13, 2025

Is the CI missing a apt-get update ? It failed while installing OSMesa

@jourdain
Copy link
Collaborator

yes that was the solution for trame-vtklocal
Kitware/trame-vtklocal@0545876

@munozco
Copy link
Contributor Author

munozco commented Sep 19, 2025

I can't find a way to fix the CI. @jourdain do you have any idea ?

@jourdain
Copy link
Collaborator

@psavery

@jourdain
Copy link
Collaborator

We need to update the CI to do what I recently did in trame-tauri

@psavery
Copy link
Collaborator

psavery commented Sep 22, 2025

The failing CI is due to an issue with Selenium. We are switching over to Playwright soon where the issue will be resolved.

@psavery
Copy link
Collaborator

psavery commented Sep 23, 2025

@munozco if you rebase on master, it should fix your CI issues.

@jourdain
Copy link
Collaborator

I'm not sure why the color mapping is a little bit different, but probably because of some vtk.js update/fix?

You may want to add a new baseline to the repo

Currently produced image

test_image

vs baseline

ref2

@munozco
Copy link
Contributor Author

munozco commented Sep 25, 2025

test_big_int.py also seems broken. The produced image is missing the local view on the left...

ref3

@jourdain
Copy link
Collaborator

Are the tests working for you locally?

@munozco
Copy link
Contributor Author

munozco commented Sep 26, 2025

No, they are not working locally. The big int test is having a TypeError: can't convert BigInt to number error. That might also be due to a vtk.js update.

Also, on my machine, 3 tests on master are failing (big int, lookup table and volume rendering) because output image doesn't match with any of the baselines. They are failing for a few pixels.

@jourdain
Copy link
Collaborator

Can you double check that "older" vtk.js version work and that is indeed a regression?

@munozco
Copy link
Contributor Author

munozco commented Sep 30, 2025

I checked with older and newer vtk.js versions, and with both versions the "BigInt" test works. So this looks like I should bump vtk.js in vue-vtk-js. What do you think ?

@jourdain
Copy link
Collaborator

A bump of vtk.js could indeed be good for vue-vtk-js. The strange thing is that this test was working before. So I'm not sure why changed.

@munozco
Copy link
Contributor Author

munozco commented Oct 1, 2025

Sorry, I mixed things up. This doesn't work using newer vtk.js versions.
The BigInt test doesn't work on my branch because I have vtk.js 32.2.0 (vue-vtk-js 3.3.0). It works with vtk.js 29.4.5 (vue-vtk-js 3.2.2), but this version of vtk.js lacks WebXR features.
So yes, this is a regression.

@jourdain
Copy link
Collaborator

jourdain commented Oct 1, 2025

Here is the answer

Kitware/vtk-js@2d322e5

the latest code, don't have that piece anymore.

@jourdain jourdain merged commit 84b2bb3 into Kitware:master Oct 2, 2025
3 checks passed
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