0
votes

Essentially I am trying to render stereoscopic content using the Google Daydream and the toggle culling masks enums on the GVR eye classes. In the editor everything works well. I set content for the right and left eyes respectively and the right and left cameras only show the content placed on their respective layers.

However for some reason when I build to devices the cameras are either replaced or the toggle culling mask values are lost. I'm not completely sure which. Has anyone else attempted something similar or run into a similar issue?

Here are my settings for my GVR set up

My Main Camera:

My Left Eye (my right eye is the same but with the toggle culling mask and eye property reversed):

Am I just screwing up the settings somehow?

1

1 Answers

0
votes

You should first update to the latest GVR SDK.
The left / right eye were for editor display only.

On device, you should query unity_StereoEyeIndex in a shader, since under the hood, in the native Unity integration, the main camera is now rendering directly to the GVR buffers - this improves performance, but also makes what you are trying to do a bit more tricky.

The most performant way would be to offset UV coordinates in the vertex shader based on unity_StereoEyeIndex.

For instance, if you create a new unlit shader in Unity, you could modify the vertex shader to look like this, in order to do left/right stereo.

v2f vert (appdata v){
  v2f o;
  o.vertex = UnityObjectToClipPos(v.vertex);
  o.uv = v.uv;
  o.uv.x = 0.5*(o.uv.x + unity_StereoEyeIndex);
  return o;
}