# VR scenes are rotated

**URL:** https://discourse.vtk.org/t/vr-scenes-are-rotated/10451
**Category:** VR/AR
**Created:** [January 14, 2023, 5:02am UTC](https://discourse.vtk.org/t/vr-scenes-are-rotated/10451 "2023-01-14T05:02:17Z")
**Posts on this page:** 5
**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: [January 14, 2023, 5:02am UTC](https://discourse.vtk.org/t/vr-scenes-are-rotated/10451/1 "2023-01-14T05:02:17Z")

</div>

Whenever rendering with OpenVR, the scene is rotated. This is clearly visible with an `vtkAxesActor`. The Z axis is parallel to the floor… this is not expected.

 ![Screenshot_20230113_095943](https://discourse.vtk.org/uploads/default/original/2X/1/1121fb829f555500b7cdc2258443e09ffea4e8ca.png)

```nohighlight
import vtk

from vtkmodules.vtkRenderingOpenVR import (
    vtkOpenVRCamera,
    vtkOpenVRRenderer,
    vtkOpenVRRenderWindow,
    vtkOpenVRRenderWindowInteractor,
)

renderer = vtk.vtkOpenVRRenderer()
renderWindow =vtk.vtkOpenVRRenderWindow()
iren = vtk.vtkOpenVRRenderWindowInteractor()
cam = vtk.vtkOpenVRCamera()
renderer.SetShowFloor(True)
renderer.SetBackground(0.2, 0.3, 0.4);
renderWindow.AddRenderer(renderer);
iren.SetRenderWindow(renderWindow);
renderer.SetActiveCamera(cam);

light = vtk.vtkLight()
light.SetLightTypeToSceneLight();
light.SetPosition(1.0, 1.0, 1.0);
renderer.AddLight(light);

#crazy frame rate requirement
#need to look into that at some point
renderWindow.SetDesiredUpdateRate(350.0);
iren.SetDesiredUpdateRate(350.0);
iren.SetStillUpdateRate(350.0);

renderer.RemoveCuller(renderer.GetCullers().GetLastItem());

axes = vtk.vtkAxesActor()
renderer.AddActor(axes)

# the HMD may not be turned on/etc
renderWindow.Initialize();
# if renderWindow.GetHMD():

renderer.ResetCamera();
renderWindow.Render();

iren.Start()

```

---

<div class="post-metadata">

### Author: ![mau\_igna\_06](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mau_igna_06/32/8064_2.png) [@mau\_igna\_06](https://discourse.vtk.org/u/mau_igna_06)
#### Post date: [January 14, 2023, 6:09pm UTC](https://discourse.vtk.org/t/vr-scenes-are-rotated/10451/2 "2023-01-14T18:09:08Z")

</div>

Did you try this → [https://vtk.org/doc/nightly/html/classvtkCamera.html#afa796c8d6a66e0c26515e30f47c8897d](https://vtk.org/doc/nightly/html/classvtkCamera.html#afa796c8d6a66e0c26515e30f47c8897d) ?

Hope it helps

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [January 16, 2023, 2:24pm UTC](https://discourse.vtk.org/t/vr-scenes-are-rotated/10451/3 "2023-01-16T14:24:06Z")

</div>

In VTK the default camera looks down the negative Z axis and the X axis points to the right. Y is up. So this looks like I would expect.

---

<div class="post-metadata">

### Author: ![Tiffany\_Chhim](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tiffany_chhim/32/6419_2.png) [@Tiffany\_Chhim](https://discourse.vtk.org/u/Tiffany_Chhim)
#### Post date: [January 16, 2023, 2:58pm UTC](https://discourse.vtk.org/t/vr-scenes-are-rotated/10451/4 "2023-01-16T14:58:45Z")

</div>

Hi Bane,

The default is indeed the Y axis pointing up.  
You can add the following line to your script to have the Z axis pointing up instead:

```auto
renderWindow.SetPhysicalViewUp([0.0, 0.0, 1.0])

```

---

<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 16, 2023, 9:03pm UTC](https://discourse.vtk.org/t/vr-scenes-are-rotated/10451/5 "2023-01-16T21:03:21Z")

</div>

Thank you @Tiffany_Chhim! I needed `SetPhysicalViewUp` and `SetPhysicalViewDirection` to get this working

```python
renderWindow.SetPhysicalViewUp(0.0, 0.0, 1.0)
renderWindow.SetPhysicalViewDirection(0.0, -1.0, 0.0)

```
