Search Unity

Transparent text not working

Discussion in 'Shaders' started by quangthang791, Aug 17, 2014.

  1. quangthang791

    quangthang791

    Joined:
    May 26, 2014
    Posts:
    6
    i using this shader for my text in unity
    Code (CSharp):
    1. Shader "SysFont/Unlit Transparent"
    2. {
    3.   Properties
    4.   {
    5.     _Color ("Text Color", Color) = (1,1,1,1)  
    6.     _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {}
    7.   }
    8.  
    9.   SubShader
    10.   {
    11.  
    12. Tags
    13.     {
    14.       "Queue" = "Transparent"
    15.       "IgnoreProjector" = "True"
    16.       "RenderType" = "Transparent"
    17.    
    18.     }
    19.     Pass
    20.     {
    21.    
    22.       Cull Off
    23.       Lighting Off
    24.       ZWrite Off
    25.       Fog { Mode Off }
    26.       AlphaTest Off
    27.       Blend SrcAlpha OneMinusSrcAlpha
    28.  
    29.       SetTexture [_MainTex]
    30.       {
    31.         ConstantColor [_Color]
    32.         Combine constant, texture * constant
    33.       }
    34.     }
    35.  
    36.  
    37.  
    My text color is white and it's work well in wp8,w8 64bit, android, ... but except windows app store (windows 8 32 bit) it not transparent .This is image for problem

    http://i1287.photobucket.com/albums.../WP_20130306_001_zps3fff1400.jpg?t=1408250136

    Please help me, thanks.
     
  2. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    I don't think there's anything wrong with the shader, specially because it shows white in your picture and not magenta like it should when it breaks

    since both your color and your texture default to white i gotta believe there's something wrong with the texture, maybe it isn't getting compiled and packaged, but it could be many other things that are stopping the texture since this only happens in one specific platform

    you could try putting it in your resources folder (since everything in that folder will be in the final build regardless of having references or not), but thats about it that i can think of, just make sure the texture is there somehow and report back with more details
     
    Last edited: Aug 18, 2014
  3. quangthang791

    quangthang791

    Joined:
    May 26, 2014
    Posts:
    6
    Thanks for your answer, but when i try another shader my texture show is fine (but behind texture still have problem) :)

    I find more info in log file

    WARNING: Shader
    Unsupported: 'Diffuse' - Pass 'SHADOWCOLLECTOR' shader state not supported

    WARNING: Shader
    Unsupported: 'VertexLit' - Pass 'SHADOWCOLLECTOR' shader state not supported
     
    Last edited: Aug 18, 2014
  4. kebrus

    kebrus

    Joined:
    Oct 10, 2011
    Posts:
    415
    The fixed function pipeline actually generates glsl/cgprogram functions, the shadowcollector is one of the things it generates, it's used to being able to receive shadows from other objects, so i'm gonna guess the somewhere along that code generation you are getting something that breaks on that platform, you should probable try a simpler cg shader that only does what you want, tell me, you only need a shader that renders the texture multiplied by a tint color? no shadows or lights? i could probably cook up something pretty quick for you to try
     
  5. quangthang791

    quangthang791

    Joined:
    May 26, 2014
    Posts:
    6
    hi, i using VertexLit for my the trees and Diffuse for some object( i dont remember) and the text font using shader i posted in my question, i will try change verterlit and diffuse to another and check again, i will let you know , thanks :)