Search Unity

Transparent and Self Illuminated Shader

Discussion in 'Shaders' started by Koudelka, Feb 28, 2011.

  1. Koudelka

    Koudelka

    Joined:
    Feb 28, 2011
    Posts:
    1
    Hi everyone ! :)

    I don't know if this question was already written. I'm really sorry if the thread already exists...

    Anyway!
    I'm currently working on a student project with 3d interfaces (like Dead Space) and I'm looking for a shader with a self illumination (to read clearly the PNG pictures, without any other lights) and with a very good transparence aspect (to see through 3d screens).
    I was working with this shader until now :

    Code (csharp):
    1. Shader "AlphaSelfIllum" {
    2.     Properties {
    3.         _Color ("Color Tint", Color) = (1,1,1,1)
    4.         _MainTex ("SelfIllum Color (RGB) Alpha (A)", 2D) = "white"
    5.     }
    6.     Category {
    7.        Lighting On
    8.        ZWrite Off
    9.        Cull Back
    10.        Blend SrcAlpha OneMinusSrcAlpha
    11.        Tags {Queue=Transparent}
    12.        SubShader {
    13.             Material {
    14.                Emission [_Color]
    15.             }
    16.             Pass {
    17.                SetTexture [_MainTex] {
    18.                       Combine Texture * Primary, Texture * Primary
    19.                 }
    20.             }
    21.         }
    22.     }
    23. }
    The self illumination is good enough I think, but the transprent is awful. This shader considers that the whole picture is a little bit transparent, so all the colors of my PNG picture become dull and slightly transparent.

    What can I do to improve this shader?

    Thank you for your help :D

    (Ps: Sorry for my english, I'm french :( )
     
  2. jedy

    jedy

    Joined:
    Aug 1, 2010
    Posts:
    579
    Thanks alot! I needed this :D
     
  3. pieje

    pieje

    Joined:
    Feb 28, 2013
    Posts:
    3
    Bump, I have the same problem with a shader. Everything is always partly transparent.