# Python rendering scene to VR

**URL:** https://discourse.vtk.org/t/python-rendering-scene-to-vr/340
**Category:** VR/AR
**Created:** [February 27, 2019, 1:46am UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340 "2019-02-27T01:46:09Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [February 27, 2019, 1:46am UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/1 "2019-02-27T01:46:09Z")

</div>

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`](http://docs.vtki.org/)

---

<div class="post-metadata">

### Author: ![ken-martin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ken-martin/32/884_2.png) [@ken-martin](https://discourse.vtk.org/u/ken-martin)
#### Post date: [February 27, 2019, 3:12pm UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/2 "2019-02-27T15:12:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [October 26, 2019, 11:51pm UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/4 "2019-10-26T23:51:36Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![ken-martin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ken-martin/32/884_2.png) [@ken-martin](https://discourse.vtk.org/u/ken-martin)
#### Post date: [October 28, 2019, 2:11pm UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/5 "2019-10-28T14:11:14Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Soujanya\_Shetty](https://discourse.vtk.org/user_avatar/discourse.vtk.org/soujanya_shetty/32/1150_2.png) [@Soujanya\_Shetty](https://discourse.vtk.org/u/Soujanya_Shetty)
#### Post date: [December 2, 2019, 10:59am UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/6 "2019-12-02T10:59:10Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ken-martin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ken-martin/32/884_2.png) [@ken-martin](https://discourse.vtk.org/u/ken-martin)
#### Post date: [January 8, 2020, 7:04pm UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/7 "2020-01-08T19:04:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![banesullivan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/banesullivan/32/7143_2.png) [@banesullivan](https://discourse.vtk.org/u/banesullivan)
#### Post date: [January 29, 2020, 9:44pm UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/9 "2020-01-29T21:44:16Z")

</div>

What might be the CMake option to turn on the OpenVR module if I wanted to slightly modify [this recipe](https://github.com/conda-forge/vtk-feedstock/blob/f3f4058c0c2ef3b9f92a877978c52dfe6696c7f6/recipe/build.sh#L31)?

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [January 29, 2020, 11:18pm UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/10 "2020-01-29T23:18:34Z")

</div>

VTK\_MODULE\_ENABLE\_VTK\_RenderingOpenVR

---

<div class="post-metadata">

### Author: ![1118](https://discourse.vtk.org/user_avatar/discourse.vtk.org/1118/32/1577_2.png) [@1118](https://discourse.vtk.org/u/1118)
#### Post date: [April 6, 2020, 9:27am UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/11 "2020-04-06T09:27:32Z")

</div>

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

Finally, I want to make Paraviewweb + VR system

---

<div class="post-metadata">

### Author: ![ken-martin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ken-martin/32/884_2.png) [@ken-martin](https://discourse.vtk.org/u/ken-martin)
#### Post date: [April 6, 2020, 1:17pm UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/12 "2020-04-06T13:17:58Z")

</div>

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

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

```

and it seemed to do the right thing

---

<div class="post-metadata">

### Author: ![1118](https://discourse.vtk.org/user_avatar/discourse.vtk.org/1118/32/1577_2.png) [@1118](https://discourse.vtk.org/u/1118)
#### Post date: [April 13, 2020, 3:53am UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/13 "2020-04-13T03:53:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ken-martin](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ken-martin/32/884_2.png) [@ken-martin](https://discourse.vtk.org/u/ken-martin)
#### Post date: [April 13, 2020, 1:20pm UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/14 "2020-04-13T13:20:40Z")

</div>

vtk master built locally

---

<div class="post-metadata">

### Author: ![1118](https://discourse.vtk.org/user_avatar/discourse.vtk.org/1118/32/1577_2.png) [@1118](https://discourse.vtk.org/u/1118)
#### Post date: [April 20, 2020, 1:21am UTC](https://discourse.vtk.org/t/python-rendering-scene-to-vr/340/15 "2020-04-20T01:21:25Z")

</div>

Thank you
