Gvr-unity-sdk: Wrong stereo rendering in Unity 5.6 game viewer

Created on 1 Feb 2017  Â·  16Comments  Â·  Source: googlevr/gvr-unity-sdk

After importing package I tried to open a demo and stereo preview in Unity 5.6.0b5 viewer looks wrong.

screen shot 2017-01-31 at 8 18 36 pm

Console sometimes gives me this error: Rendering camera 'Main Camera Right', but calling code does not set it up as current camera (current camera: 'PreRender')

Phone build looks normal. I don't have these issues in Unity 5.4.

Most helpful comment

This looks to be an issue introduced in 5.6. I'm not sure if this was an intended change in Unity or a regression. Until we have a resolution the following changes will correct this for users of the SDK.


diff --git a/GoogleVR/Legacy/Scripts/Internal/GvrEye.cs b/GoogleVR/Legacy/Scripts/Internal/GvrEye.cs
index 06e3692..8ce0021 100644
--- a/GoogleVR/Legacy/Scripts/Internal/GvrEye.cs
+++ b/GoogleVR/Legacy/Scripts/Internal/GvrEye.cs
@@ -210,6 +210,7 @@ public class GvrEye : MonoBehaviour {
       stereoEffect = GetComponent<StereoRenderEffect>();
       if (stereoEffect == null) {
         stereoEffect = gameObject.AddComponent<StereoRenderEffect>();
+        stereoEffect.eye = eye;
       }
       stereoEffect.enabled = true;
     } else if (stereoEffect != null) {
diff --git a/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs b/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs
index d7020b1..cb18c00 100644
--- a/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs
+++ b/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs
@@ -26,7 +26,9 @@ public class StereoRenderEffect : MonoBehaviour {

   private Camera cam;

-  private static readonly Rect fullRect = new Rect(0, 0, 1, 1);
+  private Rect fullRect;
+
+  public GvrViewer.Eye eye;

   void Awake() {
     cam = GetComponent<Camera>();
@@ -34,6 +36,7 @@ public class StereoRenderEffect : MonoBehaviour {

   void Start() {
     material = new Material(Shader.Find("GoogleVR/UnlitTexture"));
+    fullRect = (eye == GvrViewer.Eye.Left ? new Rect (0, 0, 0.5f, 1) : new Rect (0.5f, 0, 0.5f, 1));
   }

   void OnRenderImage(RenderTexture source, RenderTexture dest) {

All 16 comments

Thanks @GordeyChernyy, Unity is looking into a fix.

This looks to be an issue introduced in 5.6. I'm not sure if this was an intended change in Unity or a regression. Until we have a resolution the following changes will correct this for users of the SDK.


diff --git a/GoogleVR/Legacy/Scripts/Internal/GvrEye.cs b/GoogleVR/Legacy/Scripts/Internal/GvrEye.cs
index 06e3692..8ce0021 100644
--- a/GoogleVR/Legacy/Scripts/Internal/GvrEye.cs
+++ b/GoogleVR/Legacy/Scripts/Internal/GvrEye.cs
@@ -210,6 +210,7 @@ public class GvrEye : MonoBehaviour {
       stereoEffect = GetComponent<StereoRenderEffect>();
       if (stereoEffect == null) {
         stereoEffect = gameObject.AddComponent<StereoRenderEffect>();
+        stereoEffect.eye = eye;
       }
       stereoEffect.enabled = true;
     } else if (stereoEffect != null) {
diff --git a/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs b/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs
index d7020b1..cb18c00 100644
--- a/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs
+++ b/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs
@@ -26,7 +26,9 @@ public class StereoRenderEffect : MonoBehaviour {

   private Camera cam;

-  private static readonly Rect fullRect = new Rect(0, 0, 1, 1);
+  private Rect fullRect;
+
+  public GvrViewer.Eye eye;

   void Awake() {
     cam = GetComponent<Camera>();
@@ -34,6 +36,7 @@ public class StereoRenderEffect : MonoBehaviour {

   void Start() {
     material = new Material(Shader.Find("GoogleVR/UnlitTexture"));
+    fullRect = (eye == GvrViewer.Eye.Left ? new Rect (0, 0, 0.5f, 1) : new Rect (0.5f, 0, 0.5f, 1));
   }

   void OnRenderImage(RenderTexture source, RenderTexture dest) {

I tested the changes @joejo-unity posted, and it works. There's no more visual glitch! Thanks!

Tested on Unity 5.6.0b6 64-bit
GoogleVR SDK v1.20
Linux Mint 18.1 64-bit (Ubuntu 16.04 base), Cinnamon 3.2.7 desktop environment, Nvidia GTX 980Ti & Nvidia 367.57 proprietary graphics drivers.

beginner question: How can I apply those changes in my version control?
I'm using a GIT repository with Sourcetree. thanks

Thanks this fixed the Rendering camera 'Main Camera Right' . I have another strange issus and it is very hard to debug, My Main Camera Right is darker and recive no light
image

skaale: I have very similar issues after applying the fix: on the left eye everything looks good, but on the right, many things don't appear as they should or don't appear at all. (this only happens in the editor's play mode, not on the phone)
Strange thing is this is also not happening when not applying the fix (but the picture is in pieces then), and also not happening on some scenes like the default google vr sample scenes.

HI thanks.. yes properly do to beta reverse to 5.5,1 with older version of
GoogleVR .. thanks for replie:-)

On Fri, Feb 24, 2017 at 11:53 AM, scorpeeon notifications@github.com
wrote:

skaale: I have very similar issues after applying the fix: on the left eye
everything looks good, but on the right, many things don't appear as they
should or don't appear at all. (this only happens in the editor's play
mode, not on the phone)
Strange thing is this is also not happening when not applying the fix (but
the picture is in pieces then), and also not happening on some scenes like
the default google vr sample scenes.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/googlevr/gvr-unity-sdk/issues/451#issuecomment-282263395,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAWk6MBe_XBg4h4XT6cifkPDN0LSE4oXks5rfrbDgaJpZM4LzZlf
.

--

Venlig Hilsen / Best Regards

Daniel Skaale

CEO Scribbler

*Læs mere her om Scribbler : *

http:// http://scribbler.dkscribbler.dk

CVR*: *36620749

Mobil: +45 27 165253

Mail: sim simulacrumdk@gmail.comulacrum
simulacrumdk@gmail.com
[email protected]
simulacrumdk@gmail.com

Which build of Unity are you using?

Joseph Jones
Senior Software Engineer
Unity3D

On Fri, Feb 24, 2017 at 2:53 AM, scorpeeon notifications@github.com wrote:

skaale: I have very similar issues after applying the fix: on the left eye
everything looks good, but on the right, many things don't appear as they
should or don't appear at all. (this only happens in the editor's play
mode, not on the phone)
Strange thing is this is also not happening when not applying the fix (but
the picture is in pieces then), and also not happening on some scenes like
the default google vr sample scenes.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/googlevr/gvr-unity-sdk/issues/451#issuecomment-282263395,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AWCPO6ypL3O2Wf8eon8cqxTdl7zY1Cqgks5rfrbEgaJpZM4LzZlf
.

I'm using latest beta (5.6.0b9) - it was like this in the few previous betas too I was using.
The issue seems like on the right eye, the lights of the scene have no effect or are ignored.

The solution from @joejo-unity works for me.

Unity 5.6.0b9
GoogleVR SDK v1.20

Great so you have same light output for both eyes

Sendt fra min iPhone

Den 26. feb. 2017 kl. 03.40 skrev ZoiX notifications@github.com:

The solution from @joejo-unity works for me.

Unity 5.6.0b9
GoogleVR SDK v1.20

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@joejo-unity thanks forever.

@Frolicks the script @joejo-unity has attached is meant to be applied in the terminal with the patch command. A newbie myself, I have no clue how you do that. I just opened the scripts it involves in Unity (GvrEye and StereoRenderEffect) and removed/ added the lines as described. Good luck!

e.g. look at the script below: 210,6 is the line numbers in the script, from 210 to 216, and what comes after "+" is what you need to add there (just the stereoEffect.eye = eye; in this case).
"-" means that you erase a line. Read the script letter by letter, it's not such a tricky task after all and you'll feel like a superhero after.

@@ -210,6 +210,7 @@ public class GvrEye : MonoBehaviour {
stereoEffect = GetComponent();
if (stereoEffect == null) {
stereoEffect = gameObject.AddComponent();
++ stereoEffect.eye = eye;
}
stereoEffect.enabled = true;
} else if (stereoEffect != null) {
diff --git a/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs b/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs
index d7020b1..cb18c00 100644
--- a/GoogleVR/Legacy/Scripts/Internal/StereoRenderEffect.cs

Just tested GoogleVR SDK 1.30 with Unity 5.6.0xb10 on Ubuntu 16.10, and it works great! There's no distortion in the stereo viewer at all. Thanks to the team for fixing this bug! See their release announcements, too - https://developers.google.com/vr/unity/release-notes.

Tested with Unity 5.6.0f3, the issue is gone. Thanks!

Using Unity 5.6.1f1. Issue resolved! Thanks :)

Follow this tutorial. You can get google VR SDK package in the link of video. Just import it and run on your android . Hope it will help

Was this page helpful?
0 / 5 - 0 ratings