Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: rize on November 27, 2013, 08:43:14 AM

Title: Unwanted font transparency
Post by: rize on November 27, 2013, 08:43:14 AM
Hi, I'm struggling with this problem for too much time, please help.

I have three cameras in the scene with different dephts, the first one contains only UItexture on which WebCamTexture is shown (UIRoot1>firstCam>anchor etc). The second one is non-ngui camera with 3d object and the last one with biggest depht contains main ngui elements (UIRoot2>lastCam>anchor etc). The idea is to show this 3d object between video background and GUI, and it works fine. The problem is with labels (Dynamic font) in the main ngui tree(under last camera), where text appears semi-transparent when testing on Android device (its ok in editor).

I've tried changing materials for these labels, shaders, and some approaches from this forum but nothing helped me, so my question is what's the correct way of making font fully opaque over such background? And beside that, is it correct to modify text colors via UILabel widget color?

using 3.0.6 f3
Title: Re: Unwanted font transparency
Post by: ArenMook on November 27, 2013, 10:09:28 AM
Can you post a pic? From your description what you're doing should be fine, but you should use a solid shader for your web cam texture such as Unlit/Texture.
Title: Re: Unwanted font transparency
Post by: rize on November 27, 2013, 11:18:56 AM
Funny thing is that screenshots differ from what can be seen on device screen. Here are two pieces of screenshots, first one with camera heading a wall and second with camera coverred with hand - there's no difference with text on them, however when looking on the screen during runtime it looks like camera view "shines through" font.
Title: Re: Unwanted font transparency
Post by: ArenMook on November 27, 2013, 11:27:13 AM
I've only seen this happen when rendering to texture. Are you?
Title: Re: Unwanted font transparency
Post by: rize on November 28, 2013, 05:05:11 AM
Well it's not UICamera being rendered to a texture, it's a simple script in UITexture gameobject:

  1.         video = new WebCamTexture();
  2.         video.Play();
  3.         gameObject.GetComponent<UITexture>().mainTexture = video;

If that's what you mean, is there more appropriate way to display video?

Title: Re: Unwanted font transparency
Post by: ArenMook on November 28, 2013, 03:05:04 PM
Interesting... I haven't looked at WebCamTexture. I'll check it out in a bit.

Is the web cam texture you're drawing in front or behind the label? Which shader is used by the label?
Title: Re: Unwanted font transparency
Post by: rize on November 28, 2013, 06:31:54 PM
it's behind the label which uses Unlit/Dynamic Font shader.
Title: Re: Unwanted font transparency
Post by: ArenMook on November 28, 2013, 06:44:21 PM
Learning something new here. Here's a quick test. Made a Texture, made a label on top of it. Attached the following script to the texture:
  1. using UnityEngine;
  2.  
  3. public class Test : MonoBehaviour
  4. {
  5.         WebCamTexture tex;
  6.  
  7.         void Start ()
  8.         {
  9.                 WebCamDevice[] devices = WebCamTexture.devices;
  10.                 tex = new WebCamTexture(devices[0].name, 512, 512);
  11.                 tex.Play();
  12.                 GetComponent<UITexture>().mainTexture = tex;
  13.         }
  14.  
  15.         void OnDestroy ()
  16.         {
  17.                 Destroy(tex);
  18.         }
  19. }

Result:
Title: Re: Unwanted font transparency
Post by: rize on November 29, 2013, 06:11:48 AM
Your test, displaying result on Xperia Mini Pro (SK17i) with Android 2.3.3 (nGUI 3.0.6 f3):
Title: Re: Unwanted font transparency
Post by: rize on November 29, 2013, 06:36:34 AM
another few samples with buttons behind, this time nGUI 3.0.6 f6:
Title: Re: Unwanted font transparency
Post by: ArenMook on November 29, 2013, 08:56:36 AM
So does this only happen on your Xperia device?
Title: Re: Unwanted font transparency
Post by: rize on November 29, 2013, 09:46:39 AM
I think it was happening on other devices too, but propably after those nGUI fixes it occurs only on this Xperia. Maybe I will try to update it to Android 4 later and look again, but I wonder what's the problem now - incompatible shaders?
Title: Re: Unwanted font transparency
Post by: ArenMook on November 29, 2013, 09:49:56 AM
Just a thought but did you make sure that your main camera's clear color's alpha is full 255? Unity starts it at 5 / 255 by default, which causes a problem with some mobile devices.
Title: Re: Unwanted font transparency
Post by: rize on December 02, 2013, 09:51:39 AM
I use Depth Only option, but full alpha background doesnt help either.
Title: Re: Unwanted font transparency
Post by: rize on December 04, 2013, 11:54:31 AM
So it looks that in case of this device I have to make a workaround adjusting Camera's FOV  :-\
Title: Re: Unwanted font transparency
Post by: rize on December 05, 2013, 10:41:21 AM
Great, I can't get rid of that - even with video UIRoot ( and also it's panel, texture with anchor disabled) placed not under UILabels I still get this effect...  :-\ I will appreciate any tips.
Title: Re: Unwanted font transparency
Post by: ArenMook on December 05, 2013, 03:22:46 PM
I'm not sure what it is as I'm not seeing the same effect, so it's either device specific, or Unity specific.
Title: Re: Unwanted font transparency
Post by: rize on December 06, 2013, 05:58:10 AM
Indeed it might be SoC specific problem and maybe it could be reproduced on MSM8255 devices, but currently I have none of these to test it
Quote
    Acer Iconia Smart, Acer Allegro, Fujitsu F-12C, HTC Desire HD, HTC Desire S, HTC Incredible S, HTC Inspire 4G, HTC One V, HTC Radar, Huawei U9000 Ideos X6, Huawei Ideos X5 (U8800 pro), Huawei Vision, LG Eclypse,[19] LG Optimus Sol E730, Motorola Pro+, Samsung Exhibit II 4G, Sharp Galapagos 003SH/005SH, Sharp Aquos Phone f (SH-13C), Sharp Aquos Phone the Hybrid (007SH/007SH J), Sharp Aquos Phone the Premium (009SH), Sony Ericsson Live with Walkman, Sony Ericsson Xperia Active, Sony Ericsson Xperia Arc, Sony Ericsson Xperia Acro (SO-02C), Sony Ericsson Xperia Neo, Sony Ericsson Xperia Neo V, Sony Ericsson Xperia Play (GSM), Sony Ericsson Xperia Pro, Sony Ericsson Xperia Mini, Sony Ericsson Xperia Mini Pro, Sony Ericsson Xperia ray, Sony Xperia Neo L,[20] T-Mobile myTouch 4G, ZTE Tania, ZTE 008Z, Pantech Vega X

Title: Re: Unwanted font transparency
Post by: rize on December 23, 2013, 12:32:26 PM
Problem reproduced on Xperia Play and HTC Desire S...  It's also a matter of sprites edges looking semi-transparent,  will send you repro project via PM.