# Adding Unlit\\Texture functionality to Unlit\\Transparent

**URL:** https://discussions.unity.com/t/adding-unlit-texture-functionality-to-unlit-transparent/200214
**Category:** Questions & Answers
**Created:** [December 15, 2017, 3:20pm UTC](https://discussions.unity.com/t/adding-unlit-texture-functionality-to-unlit-transparent/200214 "2017-12-15T15:20:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![anarhist1994](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@anarhist1994](https://discussions.unity.com/u/anarhist1994)
#### Post date: [December 15, 2017, 3:20pm UTC](https://discussions.unity.com/t/adding-unlit-texture-functionality-to-unlit-transparent/200214/1 "2017-12-15T15:20:33Z")

</div>

Hey guys, when I’m using the Unlit/Texture which is using a fixed pipeline, I can see my models clearly.  
When I’m using the Unlit Transparent, the model doesn’t look good, You can see the differences in the photos below. I also tried the Somanian Unlit Transparent and the results are sometimes a bit btter, but still are not good enough.

What I want to accomplish is the Fade effect, would love your help.

Transparent Shader that doesn’t work:

```
Shader "Somian/Unlit/Transparent" {
 
Properties {
    _Color ("Main Color (A=Opacity)", Color) = (1,1,1,1)
    _MainTex ("Base (A=Opacity)", 2D) = ""
}
 
Category {
    Tags {"Queue"="Transparent" "IgnoreProjector"="True"}
    ZWrite Off
    Blend SrcAlpha OneMinusSrcAlpha
 
    SubShader {Pass {
        GLSLPROGRAM
        varying mediump vec2 uv;
       
        #ifdef VERTEX
        uniform mediump vec4 _MainTex_ST;
        void main() {
            gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
            uv = gl_MultiTexCoord0.xy * _MainTex_ST.xy + _MainTex_ST.zw;
        }
        #endif
       
        #ifdef FRAGMENT
        uniform lowp sampler2D _MainTex;
        uniform lowp vec4 _Color;
        void main() {
            gl_FragColor = texture2D(_MainTex, uv) * _Color;
        }
        #endif     
        ENDGLSL
    }}
   
    SubShader {Pass {
        SetTexture[_MainTex] {Combine texture * constant ConstantColor[_Color]}
    }}
}
 
}

```

![107418-image.png](https://europe1.discourse-cdn.com/unity/original/3X/8/c/8cf15b8b334f6add178fd80ee0772c56e56c5659.png)

![107421-image-1.png](https://europe1.discourse-cdn.com/unity/original/3X/7/3/739a47d7a9dae53e819f7c5a35df0ec820d31063.png)

---

<div class="post-metadata">

### Author: ![anarhist1994](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@anarhist1994](https://discussions.unity.com/u/anarhist1994)
#### Post date: [December 16, 2017, 1:23pm UTC](https://discussions.unity.com/t/adding-unlit-texture-functionality-to-unlit-transparent/200214/2 "2017-12-16T13:23:08Z")

</div>

Solution:

```
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)

// Unlit shader. Simplest possible textured shader.
// - no lighting
// - no lightmap support
// - no per-material color

Shader "Unlit/TransparentTexture" {
Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _Color ("Base Color", Color) = (1,1,1,1)
}

SubShader {
    Tags { "RenderType"="Opaque" "Queue"="Transparent" }
    LOD 100

    Blend SrcAlpha OneMinusSrcAlpha

    Pass {
        CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #pragma target 2.0

            #include "UnityCG.cginc"

            struct appdata_t {
                float4 vertex : POSITION;
                float2 texcoord : TEXCOORD0;
                UNITY_VERTEX_INPUT_INSTANCE_ID
            };

            struct v2f {
                float4 vertex : SV_POSITION;
                float2 texcoord : TEXCOORD0;
                UNITY_VERTEX_OUTPUT_STEREO
            };

            sampler2D _MainTex;
            float4 _MainTex_ST;

            float4 _Color;

            v2f vert (appdata_t v)
            {
                v2f o;
                UNITY_SETUP_INSTANCE_ID(v);
                UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
                UNITY_TRANSFER_FOG(o,o.vertex);
                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 col = tex2D(_MainTex, i.texcoord);
                col *= _Color;
                UNITY_APPLY_FOG(i.fogCoord, col);
                // UNITY_OPAQUE_ALPHA(col.a);
                return col;
            }
        ENDCG
    }
}

}

```
