# Perspective() in VR mode

**URL:** <https://discourse.processing.org/t/perspective-in-vr-mode/519>\
**Category:** Processing for Android\
**Created:** [May 30, 2018, 2:31am UTC](https://discourse.processing.org/t/perspective-in-vr-mode/519 "2018-05-30T02:31:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nasif](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/nasif/32/20570_2.png) [@Nasif](https://discourse.processing.org/u/Nasif)\
**Post date:** [May 30, 2018, 2:31am UTC](https://discourse.processing.org/t/perspective-in-vr-mode/519/1 "2018-05-30T02:31:46Z")

</div>

Hello everyone!

I’m currently working on a VR project in which I am trying to simulate a camera. One of the things I want to simulate is zooming in and out. I first thought simply changing the fov in perspective() was the way to go, but I got greeted with the message:

> Perspective cannot be modified in VR mode

I have also tried just making the scene come closer to the viewer, but it just does not look like zooming in. Does anyone have any idea how I can affect fov in VR?

Thanks!!

---

<div class="post-metadata">

**Author:** ![Andres](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/andres/32/18007_2.png) [@Andres](https://discourse.processing.org/u/Andres)\
**Post date:** [June 26, 2018, 2:07pm UTC](https://discourse.processing.org/t/perspective-in-vr-mode/519/2 "2018-06-26T14:07:15Z")

</div>

Hi, just saw your post. The camera parameters cannot be modified in VR since they are set so they follow the headset movement and simulate stereoscopic vision. In order to make the scene closer to the viewer, you could simply apply translations to the objects.

---

<div class="post-metadata">

**Author:** ![Nasif](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/nasif/32/20570_2.png) [@Nasif](https://discourse.processing.org/u/Nasif)\
**Post date:** [June 26, 2018, 2:26pm UTC](https://discourse.processing.org/t/perspective-in-vr-mode/519/3 "2018-06-26T14:26:07Z")

</div>

Thanks for you answer Andres!

> [@Andres](#):
>
> you could simply apply translations to the objects.

This is indeed what I’ve been doing in the meantime, while I was trying to find some way to change the fov since it seems like a much more realistic “camera zoom effect” than just moving the objects. However, I understand that it can’t be done in order to maintain the VR.

Would there be any way to modify the clipping planes or are they set as well? I’ve been running into problems when translating objects for this effect since they pass the far clipping planes every once in a while.

Thank you very much for your help!

---

<div class="post-metadata">

**Author:** ![Andres](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/andres/32/18007_2.png) [@Andres](https://discourse.processing.org/u/Andres)\
**Post date:** [June 27, 2018, 1:56pm UTC](https://discourse.processing.org/t/perspective-in-vr-mode/519/4 "2018-06-27T13:56:43Z")

</div>

You are right, changing the clipping planes should be a possibility… and yes, revising the renderer’s code I see that the camera’s near and far values can be changed in VR too. There should be a better API, but right now you should be able to simply set the desired values into the defCameraFar and defCameraFar variables:

```java
void setup() {
  fullScreen(STEREO);
  ((PGraphicsVR)g).defCameraNear = 1;
  ((PGraphicsVR)g).defCameraFar = 1000;
}

```

---

<div class="post-metadata">

**Author:** ![Nasif](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/nasif/32/20570_2.png) [@Nasif](https://discourse.processing.org/u/Nasif)\
**Post date:** [June 27, 2018, 2:45pm UTC](https://discourse.processing.org/t/perspective-in-vr-mode/519/5 "2018-06-27T14:45:08Z")

</div>

Great! Thanks a lot for your help!
