Python rendering scene to VR

Is it possible to implement a way to send a rendering scene (made in Python) to VR kind of like ParaView’s “Send to OpenVR” button?

If so, I’m definitely going to try to implement this for vtki

1 Like

Yes, just replace your code as follows

vtkRendererWindow --> vtkOpenVRRenderWindow
vtkRenderer --> vtkOpenVRRenderer
vtkRenderWindowInteractor --> vtkOpenVRRenderWindowINteractor
vtkCamera --> vtkOpenVRCamera

You need all four of those classes to be created and set for it to work. You cannot rely on the default camera/interactor creation. But make those 4 changes and you should be good.

1 Like

So all of those classes are located under VTK/Rendering/OpenVR/ on the master branch of VTK. Would I need to build VTK with a specific option to enable those? And is this supported on all operating systems?

You have to turn on the RenderingOpenVR module and they are supported on windows. I have heard of them being built on Linux but never tried it personally.

1 Like

Hello sir,

vtkOpenVRRenderWindow ,
vtkOpenVRRenderer
,vtkOpenVRRenderWindowINteractor,
vtkOpenVRCamera

these functions are not available in python it would be a great helpful if you update VTK for these functions.

I think this is fixed in vtk master. I can create them in python at least.

What might be the CMake option to turn on the OpenVR module if I wanted to slightly modify this recipe?

VTK_MODULE_ENABLE_VTK_RenderingOpenVR

1 Like

So can’t we make OpenVR using vtk wrapping Python code?

Finally, I want to make Paraviewweb + VR system

I think you can. Seems to work for me. I just tried

>>> cam2 = vtk.vtkOpenVRCamera()
>>> win = vtk.vtkOpenVRRenderWindow()
>>> ren = vtk.vtkOpenVRRenderer()

and it seemed to do the right thing

2 Likes

Which version of vtk did you use?
The vtk version I am using is vtk 8.1.2 which I pip installed through the following command:
pip install vtk

vtk master built locally

2 Likes

Thank you