cancel
Showing results for 
Search instead for 
Did you mean: 

Not valid anymore

Jepplen
Explorer
Not valid anymore
9 REPLIES 9

julienkay
Adventurer
The Camera component in Unity has a property
called 'Target Eye'. You can set that to make the camera render to both
eyes, or to left/right eye specifically.

A simple way to do this without coding is to have a two camera setup and two dedicated layers for left and right eye. Your object for the left eye needs to be on the left eye layer. Same thing for the other object. Then just make sure your left eye camera doesn't render the right eye layer and vice versa.

Jepplen
Explorer
Not valid anymore

julienkay
Adventurer
Did you create two cameras as well?
The RightCamera needs to have its Culling Mask property set to not include the 'leftEyeLayer'. The target eye for that camera needs to be set to 'Right Eye'.
The LeftCamera needs to have its Culling Mask property set to not include the 'rightEyeLayer'. Then set its target eye to 'LeftEye'.



Jepplen
Explorer
Not valid anymore

julienkay
Adventurer
Excluding left and right layers from the main camera makes sense. Also, if that camera already renders all layers except for left and right, you probably do want to exlude Default and all other layers from the left and right cameras.

I forgot to mention the clear flags settings. You want to set the clear flags of the left & right camera to 'Don't Clear', so they don't draw over what another camera already rendered. Additionally I would set the 'depth' property of the left & right camera to '1'. With the depth property you can manually specify which camera renders first (Cameras with higher values will render lates).

Jepplen
Explorer

Not valid anymore

julienkay
Adventurer
It does seem like with the default prefab there's the OVRCameraRig.cs script, that is controlling which cameras are enabled and prevented your setup form working before. If you don't want to do a custom camera setup and keep using the OVRCameraRig, it seems the preferred way would be to check "Use Per Eye Cameras" on that script. Then, only left and right cameras will render. The center eye will not render. This means your culling masks of left/right camera should include every layer except for that of the opposite camera.

Jepplen
Explorer
Not valid anymore

julienkay
Adventurer
No problem, glad you got it working!