Search code examples
unity-game-enginegear-vr

How to display stereo photosphere in Gear VR


I am following this tutorial to view Stereo image in Unity3D. Unfortunately it only covers Oculus Rift and Google Cardboard. Both of there SDKs have two separate cameras for left eye and right eye. Here is a summary of how to do it:

  1. Create 2 spheres for both eyes and place them at origin.
  2. Put them in different layers (left and right).
  3. Set culling mask of each camera (left eye and right eye) to left layer and right layer respectively.

PROBLEM:

In Gear VR camera setup, Oculus SDK is using only one camera component which is on CenterEyeAnchor child of OVRCameraRig:

I don't know how to apply the above procedure in this case. I know there are 2 transforms LelftEyeAnchor and RightEyeAnchor which are used for stereo view but I don't if camera component is attached to them at runtime in Android build. Is there a way to achieve stereo rendering for this setup?

Thanks in advance.


Solution

  • This is what I have:

    Unity Hierarchy

    With LeftEyeAnchor and RightEyeAnchor being on their layers (Left, Right). Then I have an empty Gameobject: Stero, containing 2 cameras.

    This is the set up for the Left

    enter image description here

    I have multiple layers on the culling mask because im displaying some stuff on each eye but you need to set there the layers being seen by the camera.

    Its the same for the other camera changing every Left for Right

    And at the end, currently disable because i enable both via script, the 2 spheres, one in one layer and the other in the other layer.

    The CenterEyeAnchor have Both eyes as a target, and left and right layers are in the culling mask too

    Hope it helps!