cancel
Showing results for 
Search instead for 
Did you mean: 

Unity integration : Screen Fade Broken?

scottr
Honored Guest
We are trying to fade the screen in and out for transitions.

The OVRMainMenu code uses an OnGUI call and draws a full screen texture with alpha. This code works fine on the DK1's and in editor for the moonlight build. However on device, the fade does not appear to be rendering.

Is this a known issue? Or something that we need to setup differently for device?

Much thanks!

Scott
10 REPLIES 10

cybereality
Grand Champion
Hmm.. Sounds like it could be a bug. Let me see if anyone here knows more.
AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV

IronMan
Honored Guest
I doubt OnGUI calls work with the distortion mesh rendering. I wouldn't really recommend using any OnGUI calls anyway. They cause GC allocations every frame

Just create a quad right in front of the camera's near clip plane and fade it in and out using one of the transparent shaders (Transparent/Diffuse and setting renderer.sharedMaterial.color.a on it. Disable it when it's completely faded out so you don't pay for a full screen alpha overlay even when alpha = 0

scottr
Honored Guest
On previous projects, we switched to NGUI and moved off of using OnGUI calls completely, they are silly expensive. We are looking forward to trying out the new GUI within Unity 4.6.

Are there any plans to support the OVRGUI and OVRMainManu elements on the moonlight device?

IronMan
Honored Guest
"scottr" wrote:
On previous projects, we switched to NGUI and moved off of using OnGUI calls completely, they are silly expensive. We are looking forward to trying out the new GUI within Unity 4.6.


Good call.. however, there's currently a bug in Unity 4.5+ in which dynamic surfaces like the surfaces that NGUI creates are garbage with multithreaded rendering enabled (which needs to be enabled!). The bug has been reported to Unity.

I too am looking forward to exploring uGUI in Unity 4.6 although I'm sure it will have it's own set of issues to figure out.

We'll look into updating those OVR components if people are going to keep using them. They at least need to work properly for test projects.

Regards,
Andrew

scottr
Honored Guest
Interesting bug..How do the dynamic mesh garbages manifest as errors?

We are seeing low amounts, but consistent, slivers of garbage and black boxes, but never on the screen for more than a frame. I was beginning to investigate further. We do have a range of scene effects running. We do have our frame rate under control with the occasional dip below 60 as the GC runs or some objects get instantiated.

And yeah, new tech always has it's nuances to learn through breaking it.. part of the fun.. 🙂

We also have our own UI system in place, but have been looking through the SDK code for any special bits we may need to know about.

Thanks again

Scott

IronMan
Honored Guest
In my case the NGUI or TextMeshPro surfaces just disappear after a second or two. What you're mentioning sounds familiar.

I tested a new project with just an OVRCameraController added, a blue background color, the OVRMainMenu fade enabled, and the screen does indeed fade in from black to blue in the editor. It does not however work on device as you mentioned. So it's still on our list to fix 🙂

-Andrew

Edited: updated with on-device testing results

EMcNeill
Honored Guest
"IronMan" wrote:
In my case the NGUI or TextMeshPro surfaces just disappear after a second or two. What you're mentioning sounds familiar.


I've just started to integrate some NGUI elements into my own project, and I'm running into the same issues. How did you handle it? I'd hate to have to rebuild everything from scratch.

rosebud_the_sle
Expert Protege
Yep, we have similar issues in our project. My approach so far has been to take our NGUI camera, point it at a render texture, then put that output on a plane floating in front of the OVR cameras. This looks fine in the editor but produces no output, flickery output, or a crash on device. The crash itself looks like a VBO realloc bug in the S5 GLES driver that we've seen before, described here:

http://www.tasharen.com/forum/index.php?topic=8415

(although the "fix" discussed in that thread doesn't change behavior on the Moonlight kit).

I've been banging my head against this one for a few days. Multithreaded rendering is indeed the most likely source of conflict, but turning it off doesn't actually resolve the behavior. Crashes do not occur if camera is turned off (but other code allowed to run) or if the target isn't a render texture.

Yesterday I ripped NGUI out and replaced it with a simple text plugin from the asset store (DynamicText), and so far the result is the same (no visible output, though no crash). If I put some static mesh in front of my GUI camera and render that to the texture instead, it works fine. It seems like dynamic mesh generation + render texture drawing is the common issue here.

Then again, the render texture may be a red herring. I just tried dumping my dynamic text mesh right into the scene and removed the entire render texture path and the output is still zero (and a hang, though I don't see anything particularly damning in logcat).

EMcNeill
Honored Guest
If I turn off multithreaded rendering, the problem appears to go away. Andrew (IronMan) mentioned that it needed to be enabled; is that because it's used for TimeWarp or something like that?

Also, is there any word from Unity about when or whether this might be fixed? I'd hate to throw away so much work if that can be avoided.