Log in or register to post comments

Vuforia 4.2 + Unity 5.0.1 UI issue

May 7, 2015 - 9:02am #1

Hello,
I have an issue regarding with the latest vuforia 4.2 and unity 5.0.1 UI. When the image target is tracked, the augmented game object appear, but the unity UI disappear. However, the functionality of the UI is still working as it is a transparent UI. Then, when the image target is not tracked, the UI appears back. Any idea?

Thank you.

Regards,
Azfar

Vuforia 4.2 + Unity 5.0.1 UI issue

May 18, 2016 - 1:02am #75

Hi all.

Same problem rendering ui elements and my solution based on Alessandro post.

 

Scenario:

Troubble: Not rendering some UI elements.

Destination Plattform: Android (Also didnt render in editor playmode)

Unity Version: 5.1.3f1

Vuforia Package version: vuforia-unity-5-5-9.unitypackage

Solution:

1) Modify Assets/vuforia/shaders/VideoBackgroud:

"queue"="geometry-11" to "queue"="Geometry"

2) Go to the background plane inside ARCamera -> Camera -> BackgroundPlane and modify the "Video Material" from Custom/VideoBackground to Custom/RenderVideoBackground.

 

Works fine built on Android.

Hope this help to save hours of work.

Vuforia 4.2 + Unity 5.0.1 UI issue

November 28, 2015 - 4:24am #74

Thanks a lot for the help!

 

We got our project working with the following settings:

Unity 5.2.3 with Vuforia 5.0.6

Changing the Background shader as described in this post.

With Unity 5.2.2 it didn't work.

Vuforia 4.2 + Unity 5.0.1 UI issue

November 25, 2015 - 12:05pm #73

If you have upgraded from Vuforia 4.2 to Vuforia 5.0, and you still see the UI rendering issue,  you may want to double-check that it's not just a migration issue;

https://developer.vuforia.com/library/articles/Solution/How-To-Migrate-Your-Existing-Apps

Additionally, make sure to clear any potentially cached binary by:

- closing your Unity project (by quitting Unity Editor)

- removing the /Library folder under your project folder

- reopening your Unity project

 

As far as we can tell, UI should render correctly with Vuforia 5.0.6 and Unity 5.x, as long as:

- for Unity 5.0: you use Unity 5.0.3 or 5.0.4 (avoiding 5.0.1 / 5.0.2)

- for Unity 5.1: you use Unity 5.1.1 or higher (recommended version => 5.1.4)

- for Unity 5.2.: you use 5.2.1 or newer (recommended version => 5.2.3)

 

See also:

https://developer.vuforia.com/forum/faq/unity-player-settings

 

Vuforia 4.2 + Unity 5.0.1 UI issue

November 24, 2015 - 11:42am #72

Did you manage to resolve the issue? I have the completely same problem with you Naktsvilks 

Vuforia 4.2 + Unity 5.0.1 UI issue

October 29, 2015 - 2:29pm #71

Thanks dude!!

Vuforia 4.2 + Unity 5.0.1 UI issue

October 27, 2015 - 3:26am #70

I've been running into this issue recently after upgrading Unity to 5.2.2. After the upgrade, the previous version started having this issue as well, as well as other 5.x versions that reported running properly. I've tried every single solution in this thread to no avail.

Vuforia 4.2 + Unity 5.0.1 UI issue

September 29, 2015 - 4:33am #69

Changing the Shader of the BackgroundPlane (under ARCamera) to Mobile/Diffuse did work fine after countless trials. 

For those who still use the GUI (Legacy) this solution works perfectly too.

Vuforia 4.2 + Unity 5.0.1 UI issue

August 28, 2015 - 2:17am #68

Thanks BZCDevelopment for sharing your solution.

 

Note: I have tried Vuforia 5.0.5 with Unity 5.1.3p1, with a UI Canvas with multiple buttons, and an Image target with a 3D object using the Standard Shader of Unity 5 (which happened to be problematic in early versions of Unity 5.0.x, as reported in this thread),

and the behaviour I got seems correct and consistent with previous Unity 5.1.1 and 5.1.2 versions, i.e. no issues were observed.

 

Vuforia 4.2 + Unity 5.0.1 UI issue

August 28, 2015 - 1:12am #67

I updated to the Latest Unity (5.1.3p1) to try and fix this issue. I know that the patch was 5.1.0p1, but I figured that if it had been fixed at 5.1.0, then it should still be fixed for 5.1.3, but I still get the same problem, even with 0 standard shaders or bump maps in my entire project... all using mobile/Diffuse... 

I have discovered a solution for those still having this problem (I've seen many solutions in this thread that have worked for others and not for me, so I hope this works for others! And unity version 5.1.0p1 may work, but for those who want to use 5.1.3 or whatever) it's a far from elagant solution, but I had a button that simply had some UI elements appear on screen, then when touching this button again, they dissapear. I noticed that whenever I clicked this button, for a moment when the new UI appeared, all UI went back to normal for a moment... so I made a script that simply made a UI element flash, in FixedUpdate (I have no physics in my app so I have set FixedUpdate much slower) I simply turn on, then off a UI Image (img.enabled = !img.enabled) This works and the UI looks, and works normally. I then hid this image behind existing UI (you could also try setting alpha to 0, not tested) and I have functioning UI.

Hope this can help others!

BZC

Vuforia 4.2 + Unity 5.0.1 UI issue

July 7, 2015 - 12:53am #66

**Found it**

I am using some of the sample code imported into my own project and in the class VideoPlaybackBehaviour there is this function:

function:  private void HandleStateChange(VideoPlayerHelper.MediaState newState)

And near the bottom of it is this code block:

 

if (newState == VideoPlayerHelper.MediaState.PLAYING_FULLSCREEN{

  // Switching to full screendisable QCARBehaviour (only applicable for iOS)
  QCARBehaviour qcarBehaviour = (QCARBehaviourFindObjectOfType(typeof(QCARBehaviour));
  qcarBehaviour.enabled = false;
}
else if (mCurrentState == VideoPlayerHelper.MediaState.PLAYING_FULLSCREEN{

  // Switching away from full screenenable QCARBehaviour (only applicable for iOS)
  QCARBehaviour qcarBehaviour = (QCARBehaviourFindObjectOfType(typeof(QCARBehaviour));
  qcarBehaviour.enabled = true;

  //StartCoroutine ( ResetToPortraitSmoothly() );
}

That contains the StartCoroutine which once I commented out....no more portrait ;-)

Vuforia 4.2 + Unity 5.0.1 UI issue

July 6, 2015 - 3:50am #65

I am using Vuforia 4.2.3 and Unity 5.1.1f1 and I still have the same issue I had as reported below in that prior to upgrading Unity my app which is not the sample supplied successfully allowed me to play video from an object and then go fullscreen and upon closing the fullscreen video the Unity GUI would remain in the devices current orientation.

Howver now when I return from fullscrene video where the device is still landscape the Unity GUI flips to portrait and remains there permanently not respondeing to any device orientation changes. 

Like I say this was not the case before I updated Unity 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 22, 2015 - 12:14am #64

Hi umresh,

the "crash on Mac" issue is discussed in other Forum threads, it's not specifically related to this thread.

The crash on Mac can occur when using an external USB webcam and Mac versions 10.9 (i.e. prior to 10.10); this is also mentioned in the release notes;

https://developer.vuforia.com/library/articles/Release_Notes/Vuforia-40-SDK-Release-Notes

Since this problem appears to be solved on Mac OS 10.10, the recommendation is to upgrade your Mac to the latest OS version.

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 22, 2015 - 12:12am #63

Is the console saying anything? You could also look at the log files to see what gets it to crash. 

Sometimes a restart of Unity after a new install fixes some crash. Or even a restart of the computer.

Vuforia 4.2 + Unity 5.0.1 UI issue

June 21, 2015 - 11:15pm #62

I'm using the unty 5.1.1f1 and vuforia 4.2.3 on mac but when i play in the editor unity crashes everytime.

Vuforia 4.2 + Unity 5.0.1 UI issue

June 18, 2015 - 8:53am #61

Yes, Unity 5.1.1f1 appears to be working correctly with Vuforia 4.2.3. 

 

 

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 18, 2015 - 6:59am #60

Has anyone tested today's 5.1.1?

Vuforia 4.2 + Unity 5.0.1 UI issue

June 17, 2015 - 7:19am #59

Indeed it works. I did read the previous reply and got confused with the p1 and f3 thinking 3 is actually more than 1 so f3....whatever.

So yes, it does work.

Thanks.

Vuforia 4.2 + Unity 5.0.1 UI issue

June 17, 2015 - 6:17am #58

@fafase,

you are using 5.1.0f3, but you need to use Unity 51.0 patch p1 (which has been released after 5.1.0f3, and contains the UI fix);

 

maybe you did not read my previous post, which I again copy paste here:

 

a new patch release "p1" of Unity 5.1 has been released today. 

This release includes the fix for previously reported UI issues in Unity 5.1.0 and Vuforia 4.2.3

You can download Unity 5.1.0 patch p1 from:

http://unity3d.com/unity/qa/patch-releases?version=5.1

 

Currently, if you are using Unity 5.x, the recommended versions to work with Vuforia are:

- for Unity 5.0: => Unity 5.0.3 or newer release

- for Unity 5.1: => Unity 5.1.0 patch p1 or newer release

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 17, 2015 - 5:28am #57

I am on Unity 5.1.0f3 and the UI is gone. 

Most replies from Vuforia just say to download the newest version which I think I have but no good.

I saw one known issue mentioning the use of non-legacy shader so I changed the Standard shader to some legacy one and no better.

 

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 16, 2015 - 3:21am #56

Hi,  I'm not using the sample, this is my own app that prior to 5.1.0p1 with 4.2.3 would go from fullscreen back to my AR view and my canvas etc would refelct the correct orientation.

 

So since I have upgraded Unity no when I return from fullscreen the canvas is locked to portrait

Vuforia 4.2 + Unity 5.0.1 UI issue

June 16, 2015 - 3:17am #55

@elpuerco63:

The Video Playback sample app is designed to work in Portrait mode when the AR view is shown (and similarly the UI is also shown in Portrait, consistently); the fullscreen movie player however can be oritented in Landscape. 

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 16, 2015 - 2:34am #54

Im using Vuforia 4.2.3 and Unity 5.1.0.p1 and now find that when I return from fullscreen video the device is locked to portrait?

Although the camera seems to be OK the UI buttons images etc are all locked to portrait?

Vuforia 4.2 + Unity 5.0.1 UI issue

June 15, 2015 - 7:02pm #53

Can confirm the Video Playback demo working with the 5.1.0p1 patch update. 

Auto rotation.  Double tap menu.  Video controls.  All working.

Focus is fast and precise. 

Hardware is Nexus 5, runing 5.1.1

 

 

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 12, 2015 - 12:50pm #52

Update on Unity 5.1:

a new patch release "p1" of Unity 5.1 has been released today. 

This release includes the fix for previously reported UI issues in Unity 5.1.0 and Vuforia 4.2.3

You can download Unity 5.1.0 patch p1 from:

http://unity3d.com/unity/qa/patch-releases?version=5.1

 

Currently, if you are using Unity 5.x, the recommended versions to work with Vuforia are:

- for Unity 5.0: => Unity 5.0.3 or newer release

- for Unity 5.1: => Unity 5.1.0 patch p1 or newer release

 

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 10, 2015 - 3:14am #51

Great! Thank you for the update! :-)

Vuforia 4.2 + Unity 5.0.1 UI issue

June 10, 2015 - 3:08am #50

UPDATE on Unity 5.0.x:

Unity 5.0.3 has been released and it includes the fix to the UI + rendering issue(s) with Vuforia 4.2.3, reported in this thread.

 

You can download Unity 5.0.3 from:

 https://unity3d.com/get-unity/download/archive

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 9, 2015 - 11:15am #49

NOTICE: Unity 5.1.0 and Vuforia 4.2.3

  • Unity 5.1.0 which was released today is not fully compatible with Vuforia 4.2.3
  • Legacy GUI and 4.6-based UI elements will fail to display in Unity 5.1.0 with Vuforia 4.2.3
  • We are expecting an update of 5.1.x that will resolve the issue and we will update this thread as soon as we have news.
  • If already using Unity 5, we recommend staying with 5.0.x at this time. Unity 4.6.x is also recommended.

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 9, 2015 - 5:01am #48

Hi there,

 

So this is just a matter of render order?

I need to use the DepthMask shader which is not working with the corrections below (BackgroundVideoUnity5.shader). I found a trick:

Set Tags {"Queue" = "Geometry+1" }  instead of  Tags {"Queue" = "Geometry-10" } in the DepthMask Shader.

Then I added a script to the objects I want to hide that changes their rendering order.

using UnityEngine;

using System.Collections;
 
public class GeometryRenderingOrder : MonoBehaviour {
 
// Use this for initialization
void Start () {
Material[] myMat = GetComponent<Renderer>().materials;
for (int i=0 ; i<myMat.Length ; i++)
myMat[i].renderQueue =  2005;  //Geometry = 2000
GetComponent<Renderer>().materials = myMat;
}
}
 
Is it a correct way to do this? (programming is not my speciality)

Vuforia 4.2 + Unity 5.0.1 UI issue

June 8, 2015 - 6:06am #47

I would keep an eye on the Unity website in the coming days, for a new 5.02 patch or a 5.0.3 release....

Vuforia 4.2 + Unity 5.0.1 UI issue

June 3, 2015 - 11:59am #46

I see that the issue has now been fixed but I'm not sure when we can get the new unity patch to try it out. They put out a patch on 6/3/15 but this issue isn't inclued in the patch notes. Looks like we'll have to wait for the next unity patch.

Vuforia 4.2 + Unity 5.0.1 UI issue

June 1, 2015 - 11:22pm #45

We are following up with Unity (as mentioned previously, we were able to reproduce the issue in Unity 5 even without Vuforia), however we have not received an ETA yet. We will update as soon as we have more information.

Unity has now set the issue 698797 visibility as public (please feel free to vote for it):

http://issuetracker.unity3d.com/issues/mobilerendering-ui-rendering-broken-when-certain-materials-and-a-plugin-event-in-onpostrender-are-used
 

 

Vuforia 4.2 + Unity 5.0.1 UI issue

June 1, 2015 - 3:59pm #44

I would love an ETA on a fix for this. I need to use normal maps in my app and this bug is making it tricky.

Vuforia 4.2 + Unity 5.0.1 UI issue

June 1, 2015 - 11:25am #43

Is this fix going to be integrated in a patch? Are there any more updates on this?

Vuforia 4.2 + Unity 5.0.1 UI issue

May 26, 2015 - 11:18am #42

It seems the Unity issue 698797 is not publicly visible in the public Issue Tracker.... we are checking this.

In the meantime,

for those in this thread for which the VideoBackground shader fix did not work, one thing to possibly check is whether the scene includes some Materials whose Shader uses either a "Geometry - X" (where X >= 1) render queue or a "Background" render queue; .... and if so, a quick test would be to remove those materials temporarily and see if the issue is still present.

 

 

Vuforia 4.2 + Unity 5.0.1 UI issue

May 26, 2015 - 4:47am #41

I just found out that it's not even possible to download SDK v4.0.105 anymore. No downgrade option!
So my options are down to praying for a fix?! Tough decision plus the issue number you posted is not valid (or not public).

P.S.: The "white out" issue you have been closing and linked as duplicate to this "issue", still occures even when the backgroundplane behaviour is completely deactivated.

Vuforia 4.2 + Unity 5.0.1 UI issue

May 26, 2015 - 1:38am #40

Hi Allesandro,

the modification of the shader does not solve the problem. The issue number you gave us seems not to be existing in the unity issue tracker.

This is a real problem because we can't get out our android version of the app (IOS is fine) to our customer...

ANY information about the root cause of the issue would be valueable, so we can at least try on our own to find a solution instead of brute force guesstimating what might be the problem and how to resolve it.

Thanks

Daniel

Vuforia 4.2 + Unity 5.0.1 UI issue

May 25, 2015 - 7:14am #39

Hi Alessadro,

 

Could you please provide a link to that bug so we can vote it up? I wasn't able to find an issue in Unity's issue tracker by searching for that issue number.

 

Thanks,

Patrick

Vuforia 4.2 + Unity 5.0.1 UI issue

May 24, 2015 - 11:50pm #38

The issue is triggered when issuing a rendering plugin event and certain materials are present in the scene in Unity 5.0.x;

the bug reference number for Unity is 698797 

Vuforia 4.2.3 uses (internally) valid code here, but such code results in a manifesting of the Unity 5 issue above.

Vuforia 4.2 + Unity 5.0.1 UI issue

May 24, 2015 - 4:09am #37

AlessandroB wrote:

the issue has also been reproduced without using the Vuforia SDK and has been reported to Unity accordingly. 

 

Hi AlessandroB,

So can you tell us what you found and what is causing the issue ? it might help people who still have the problem with the workaround changes.

Vuforia 4.2 + Unity 5.0.1 UI issue

May 24, 2015 - 2:48am #36

Hi,

the issue persists even after I modified the background shader. Any update on this?

Thanks

Maritn

Vuforia 4.2 + Unity 5.0.1 UI issue

May 23, 2015 - 4:14am #35

We have investigated this issue and we have now identified the root cause of the UI incorrect rendering in Unity 5.0; the issue has also been reproduced without using the Vuforia SDK and has been reported to Unity accordingly. 

We will provide updates on the status if this issue.

In the meantime, the recommended temporary workaround is to replace the VideoBackground shader of the VideoMaterial (which is appled to the Background Plane) with the shader here below:

Shader "Custom/VideoBackgroundUnity5" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    
    SubShader {
 
        Tags  { "Queue" = "Geometry" }
 
        Pass {
            ZWrite Off
            Cull Off
            Lighting Off
            
            CGPROGRAM
 
            #pragma vertex vert
            #pragma fragment frag
 
            #include "UnityCG.cginc"
 
            sampler2D _MainTex;
       
            struct v2f {
                float4  pos : SV_POSITION;
                float2  uv : TEXCOORD0;
            };
        
            float4 _MainTex_ST;
 
            v2f vert (appdata_base v) {
                v2f o;
                o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
                o.pos.z = o.pos.w;
                o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
                return o;
            }
 
            half4 frag(v2f i) : COLOR {
                half4 color = tex2D (_MainTex, i.uv);
                return color;
            }
 
            ENDCG
        }
    }
 
    FallBack "Diffuse"
}

 

Vuforia 4.2 + Unity 5.0.1 UI issue

May 22, 2015 - 2:42pm #34

Hi Alessandro - I tried changing the shader to the one you provided "Custom/VideoBackgroundUnity5", but it didn't fix the issue.

Thanks,
Patrick

Vuforia 4.2 + Unity 5.0.1 UI issue

May 22, 2015 - 3:10am #33

I am updating an old project for a client. That's why there is no time for changing all the GUI elements to Unity UI.

But I will consider working with Unity UI for future projects.

 

The weird thing is, that with Vuforia 4-234, one imageTargets works and the other one doesn't. Both are using Standard Shaders. 

So why is the GUI only invisible when tracking the second target.

I can't find any difference.

 

I guess for now, I will use Vuforia 4-105.

Vuforia 4.2 + Unity 5.0.1 UI issue

May 22, 2015 - 2:43am #32

Have you considered switching to the new Unity UI system (instead of the "NGUI" framework) that was introduced with Unity 4.6 and later versions ? Provided that you use the shader workarounds described in this thread, that should work.

 

Vuforia 4.2 + Unity 5.0.1 UI issue

May 22, 2015 - 1:30am #31

Thank you,

changing geometry didn't work. But changing the renderqueue did the trick!
But now, my NGUI is invisible again :D 

Vuforia 4.2 + Unity 5.0.1 UI issue

May 22, 2015 - 12:52am #30

@Ihno

You can try to change the Geometry queue of your shader. Set it to "Queue" = "geometry". if it's necessarry and you really need to change the rendering order, you can to use Material.renderQueue by adding a script that change it at runtime.

 

 

Vuforia 4.2 + Unity 5.0.1 UI issue

May 22, 2015 - 12:42am #29

Changing the VideoBackground shader worked for me. But now my transparent shadow cutout shader won't work anymore, it shows black.

I have a plane on the ground to show the shadows of my object. But that plane is now totally black.

This is my shader.

 

Shader "FX/Matte Shadow Mask" {

 Properties {
  _Color ("Main Color", Color) = (1,1,1,1)
  _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
  _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
 }

 SubShader {
  Tags {"Queue" = "Geometry-10" "IgnoreProjector"="false" "RenderType"="TransparentCutout"}
  LOD 200
  Blend Zero SrcColor
  Lighting Off
  ZTest LEqual
  ZWrite On
  ColorMask 0
  Pass {}

CGPROGRAM

#pragma surface surf ShadowOnly alphatest:_Cutoff

 fixed4 _Color;
 struct Input {
  float2 uv_MainTex;
 };

 inline fixed4 LightingShadowOnly (SurfaceOutput s, fixed3 lightDir, fixed atten)
 {
  fixed4 c;
  c.rgb = s.Albedo*atten;
  c.a = s.Alpha;
  return c;
}

 void surf (Input IN, inout SurfaceOutput o) {
  fixed4 c = _Color;
  o.Albedo = c.rgb;
  o.Alpha = 1;
}
ENDCG
}
Fallback "Transparent/Cutout/VertexLit"
}

 

Vuforia 4.2 + Unity 5.0.1 UI issue

May 22, 2015 - 12:03am #28

Hi,

could you try replacing the VideoBackground shader of the VideoMaterial (which is applied to the BackgroundPlane object under the Camera), with the following shader (you can name the shader "VideoBackgroundUnity5" for example):

Shader "Custom/VideoBackgroundUnity5" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    SubShader {
 
        Tags  { "Queue" = "Geometry" }
 
        Pass {
            ZWrite Off
            Cull Off
            Lighting Off
            
            CGPROGRAM
 
            #pragma vertex vert
            #pragma fragment frag
 
            #include "UnityCG.cginc"
 
            sampler2D _MainTex;
       
            struct v2f {
                float4  pos : SV_POSITION;
                float2  uv : TEXCOORD0;
            };
        
            float4 _MainTex_ST;
 
            v2f vert (appdata_base v)
            {
                v2f o;
                o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
                o.pos.z = o.pos.w;
                o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
                return o;
            }
 
            half4 frag(v2f i) : COLOR
            {
                half4 color = tex2D (_MainTex, i.uv);
                return color;
            }
 
            ENDCG
        }
    }
 
    FallBack "Diffuse"
}

 

We've tested this on a range of devices (iOS and Android) and this seems to resolve the UI texture issue, when using Standard shader as well as Legacy or Mobile shaders with normal / bump mapping and specular.

Please let us know....

 

Vuforia 4.2 + Unity 5.0.1 UI issue

May 21, 2015 - 1:35pm #27

Using the "Mobile/Diffuse" shader did correct the problem.

Using the new "Standard (specular setup)" shader caused all of the UI elements to be fully transparent.

We primarily were interested in seeing what benefit we would get from using the new physically based shaders offered in Unity 5, so it would be great if there were a fix to this issue soon that would allow us to use these shaders without corrupting the UI.

Thanks,

Patrick

Vuforia 4.2 + Unity 5.0.1 UI issue

May 21, 2015 - 12:52pm #26

Could you try replacing it with "Mobile/Diffuse" legacy shader ?

 

Log in or register to post comments