Search code examples
androidunity-game-enginegear-vr

How to use Unity + Oculus SDK + Gear VR to show a different picture for each eye


I have set up a small demo project in Unity using the Oculus SDK, Gear VR and Android to show a cube with the Gear VR and a Samsung S6.

I can look around and everything works fine.

BUT

I have no control over the right/left eye camera. I am using the OVRCameraRig which has a LeftEyeAnchor and a RightEyeAnchor but i do not understand how to use them correctly.

What i want to achieve:

I want a camera inside a sphere and the sphere should display a 360° stereoscopic panorama picture. This works, but only with the left/right eye picture for both eyes: I set the (left/right eye) picture as texture on the inside of the sphere and i am able to look around with the Gear VR. However what i really want is two different pictures for each eye.

My idea was to create two different spheres, one with the left eye pic and the other one with the right eye pic. Each of these spheres should only be visible to the corresponding eye.
How do i do that?


Solution

  • This is pretty simple, you need 2 cameras (one for each eye).

    Put your 2 cameras into a gameobjet (set the position of each at 0,0,0), and put your gameobject in the center of the spheres.

    Add 2 layers : leftEye, rightEye.

    Setup the first camera culling mask to watch the lefEye. Setup the second camera culling mask to watch the rightEye.

    Enable the Virtual Reality in the player settings (Virtual Reality Support).

    On the first camera, choose the Target Eye : Left. On the second camera, choose the Target Eye : Right.

    Then setup your spheres to be on the left or right layer mask.

    (maybe I interchanged left/right)

    I can send you screenshots if some one need it (or a sample under Unity 5.2.3).