Google cardboard for unity disables AA on android device - android

I'm developing simple VR app for android using google cardboard SDK for unity. I'm using unity 5(free), and latest version cardboard package for unity(0.4.9), i am testing on sony xperia z3 compact(lolipop) and on samsung galaxy note 3(kitkat)
The issue i'm having is, that i can't turn on anti-aliasing, or rather google sdk package, seems to disable it. I dont mind a little jagged corners, but the thing is that those corners are flickering when they are far away enough. I tried moving textures apart(since the flickering could be result of overlapping), but issue still persists.
It can't be the issue with the unity exporting for android, since if i build same project(test example provided inside google cardboard unity package) using stock camera provided by unity, insted of Cardboard main gameobject), AA is working. It cant get simpler than that, once cube and one camera... I have tried turning on and off the 32-bit display buffer option in player settings, tried forcing open GL ES 2.0 and various other tick/untick checkbox inside unity tips found across web, with no success.
So my question is, is anyone else having this same issue. And how to fix it?
I hope my question and description of the problem are detailed enough.
Cheers

The Cardboard.cs class holds a RenderTexture which is what the cameras render to, and then it is rerendered to the phone screen with distortion correction for the lenses. This bypasses Unity's normal rendering to the screen, so the AA settings for the project won't have any effect.
To see what effect AA settings in Unity will have, you can do a couple of different things:
Turn off Cardboard.SDK.nativeDistortionCorrection, so that Unity is drawing directly to the screen, or
Edit Cardboard.CreateStereoScreen() and change the settings on the RenderTexture that is allocated there.
However, the native code rerender for distortion does not use anti-aliasing in the framebuffer, so I'm not sure how much effect you'll see in #2. And there will certainly be a performance penalty either way.

Turning off distortion correction fixed this issue. Then you can set the Unity project anti alias settings up to 4x or 8x. Looks great now - no more jaggies while viewing on an iPhone 6+.
Unity 5 running Google Cardboard SDK v0.5 --
To turn off Distortion Correction:
Go to Hierarchy | CardboardMain | in Inspector uncheck Distortion Correction
To enable 4x or 8x Anti Aliasing in Unity:
Go to Edit | Project Settings | Quality | in Inspector set Anti Aliasing to 4x or 8x Multi Sampling.

If you don't want to turn off distortion correction you need to change the depth of the texture from 16 to 32 bits and the format of the texture to ARGB32. To do that go to file BaseVRDevice.cs, then find CreateStereoScreen function and change it to
public virtual RenderTexture CreateStereoScreen() {
Debug.Log("Creating new default cardboard screen texture.");
return new RenderTexture(Screen.width, Screen.height,32, RenderTextureFormat.ARGB32);
}

I followed serg hov's suggestion, however AA is not working with distortion on even after applying that fix.
It doesn't make sense to turn off distortion, so I am wondering what would be the solution to have both distortion and AA working. It works for Gear VR, so there gotta be a way to get it working for Cardboard VR.

Related

Unity Google Cardboard reverts any camera changes made when built on Android

I am working with Google Cardboard through Unity on a virtual reality project in which the view slowly changes from stereoscopic VR (a slightly different image in each eye) to monoscopic VR (the same image in each eye).
I can edit the cameras in the Unity Editor, and the changes work as intended in the Game window within the Editor, but when I build the project onto an Android phone, all the user can see is the scene through the default Google Cardboard camera setup.
This seems to happen as long as "Virtual Reality Supported" checkbox in the Player Settings menu is flagged. Does anyone know why this happens and if it can be overcome?
This happens because user's well being is our most precious resource in VR, so the devs of the SDK (GVR and OVR alike) have made some decisions to make messing with the camera intentionally convoluted - to avoid people sayich that the tech is at fault when all their audience feels sick because they changed the FOV or something.
I believe you can still do what you want to do by scaling the camera parent

How to stop objects being pixelated in Gear VR app?

I imported the Vuforia sample for gear vr in unity and replaced the objects with blender objects. Now when in my scene I put the object very close to the camera it works alright. But when I am in the Ar mode or I look form a distance at the object the edges of the objects seem very pixelatex. And move a little bit.(Blink). I have the anti aliassing on the hightes it can be but that didn´t change a thing. The blinking would indicate to me that the depth buffer is confused but since i am new to unity I have no idea what to do about that. I also read about mipmapping, that the resulution of the textures might be false. But I use materials which are colored so I can´t imagine which settings to change. Please help! Any suggestion would be very welcome!
You should set your rendering from the default 50% to 100%. Do you have any screen shots it will help.
How to do it
If you are using Oculus SDK 1.6+, you might want to check the OVRManager and make sure that "Use Recommanded MSAA" is turned off. You can also try adjust the "Min & Max Render Scale".
https://i.stack.imgur.com/yrya1.png

Unity android weird build behaviour

I am currently working on an android game in Unity. In the editor everything looks great, actor moves smoothly, generated dungeon looks nice. After building the game and start it on my smartphone the whole dungeon looks different and when moving my actor I can notice strange vibration that has never appeared before. While vibration my be caused by "wrong" implementation(I am working on very powerful Desktop so the code may be not optimal), the strange arrangement of dungeon is not about implementation at all. I tried building same version on web player and it looks jut as in editor. Look at the differences between Android-Standalone builds.
Android: http://imageshack.com/a/img901/5057/7REtUn.png
Standalone: http://imageshack.com/a/img661/2618/2Em05d.png
As you can see standalone build is just as expected, nice corridors and chambers, while on android... chaos?
EDIT: While using Unity Remote everything looks fine. Well movement isn't okay but as I said am sure now it is caused by implementation. But generated dungeon keeps unsolved.
Have you tried adjusting your targeted frame rate? Maybe your targeted frame rate is set improperly for your specific device. You may also want to try lowering the native resolution . If your resolution is really high it will cause choppiness and lag. Another item I also had to tweak to get my game to run well is the Lighting Options. From forward lighting you can change to vertex lit and it substantially speeds things up.
You may also want to mess with your shaders a bit, and see what mobile options you can go for. Various shaders have different outcomes, also rendering paths effect how things look. Are you using OpenGLS 2.0, 3.0, specifically look the settings from standalone to mobile in Player Settings.
Also make sure you're using the new Unity Remote as opposed to the old version. The old version works through wifi which is slow, the new one uses tethered USB and is relatively well.
To adjust the screen resolution as I mentioned above I had to:
75% resolution (landscape):
Screen.SetResolution (Screen.width * 0.75f, Screen.height * 0.75f, true);
To adjust target framerate as mentioned above:
Application.targetFrameRate = 60; //sets framerate to 60.

Using Google Cardboard SDK Unity, display turns black when an object that's potentially being instantiate every frame is in view

Problem
Display turns black when an object that's potentially being instantiate every frame is in view
How to reproduce
Import Cardboard SDK on the Project
Assign a script to any appropriate object with the following code.
public GameObject prefab;
void GenerateObject(){
Instantiate(prefab);
}
void Update(){
if ( once ){
GenerateObject();
}
}
Attach any appropriate prefab to the prefab above on Unity inspector.
Launch the app on android device with "Build and Run".
Display turns black when an object that's potentially being instantiate every frame is in view. Settings button will also disappear. When the instantiate object is out of sight, the view turns normal. Settings button will appear.
Environment
Unity Version:5.0.0.1f
Cardboard SDK Version:v0.4.9
Device:Nexus5, nVidia SHIELD Tablet 2
There is a known bug between Unity and CardboardSDK. Try setting the build to development in Build Settings in Unity. If this fixes it, you've got your culprit.
With this error, when I wanted a build that could be uploaded to the Play Store, disabling most of the lighting in the scene sometimes helped.
We are all patiently waiting for a fix. Google and Unity are working on it together, but it is said to be a tricky one to catch.
Check out the known issues in SDK release notes.
Known Issues
Unity 5 rendering issues: As of Unity build 5.0.0f4, the following steps should be taken to fix or ameliorate any rendering issues, such
as an all-black screen, flashing textures, or non-stereo views:
Enable the Development Build option in the Build dialog. This seems to fix various rendering glitches, like flashing textures.
The root cause of the rendering glitches is under analysis, with assistance from Unity.
Note: If you are using any Image Effects, make sure that StereoController's Direct Render property is set to false. Check if
that fixes the issue first.
I had a black screen glitch and it turned out it was because I had set Stereo Screen Scale to 2 on the Cardboard script. I set it to 1 and the screen came back.

Unity3D rendering issue on android devices

As shown in above screen shots. on some android devices textures are rendering as black. But when I try to capture screen from the device it saved it perfectly alright.
Can anyone please suggest me whats wrong ?
App URL https://play.google.com/store/apps/d...gerz.laststand
Working right on Unity Player, iOS, and some android devices
image
h**p://forum.unity3d.com/attachment.php?attachmentid=54374&d=1369302221
some android devices not rendering right
h**p://forum.unity3d.com/attachment.php?attachmentid=54373&d=1369302217
findings so far:
Terrain and skybox are rendering without texture (black) rest of the objects are fine properly on Nexus 4 and S3 minis
Fixed!!
Unity update 4.1.3
Fixes
*Android: Fixed rendering issues on Nexus4 + Android os 4.2.2 when "Use 32bits Display Buffer" is checked, due to Compositor using Default FBO alpha.
Disable the 32 bit buffer in edit/project settings/player build and check if the problem still exists
Disable the 24 bit buffer in edit/project settings/player build and check if the problem still exists
If you use directional light, go to the direction light inspector and select shadow type no shadow
I had this issue and it was happening because of sprite that i used from an atlas with the max size set to 4096, i reduced it to 2048 and now every thing works fine, i think its failure in GPU of some weak devices to handling that size.

Categories

Resources