Transparent shader

I’m working with this shader:
Shader “Hologram” {

    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _RimColor ("Rim Color", Color) = (1, 1, 1, 1)
        _MainTex ("Base (RGB)", 2D) = "white" {}
		//_Color ("Base (RGB) Transparency (A)", 2D) = "" {}
    }

    SubShader {	

		Pass {            

			CGPROGRAM

                #pragma vertex vert
                #pragma fragment frag
                #include "UnityCG.cginc"
                struct appdata { 
                    float4 vertex : POSITION; 
                    float3 normal : NORMAL; 
                    float2 texcoord : TEXCOORD0; 
                };

                struct v2f { 
                    float4 pos : SV_POSITION;
                    float2 uv : TEXCOORD0;
                    float3 color : COLOR;
                };             

                uniform float4 _MainTex_ST;
                uniform float4 _RimColor;            

                v2f vert (appdata_base v) {

                    v2f o;
                    o.pos = mul (UNITY_MATRIX_MVP, v.vertex);

                    float3 viewDir = normalize(ObjSpaceViewDir(v.vertex));
                    float dotProduct = 1 - dot(v.normal, viewDir);
                    float rimWidth = 0.7;
                    o.color = smoothstep(1 - rimWidth, 1.0, dotProduct);

                    o.color *= _RimColor;

                    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);

                    return o;
                }

                uniform sampler2D _MainTex;
                uniform float4 _Color;

                float4 frag(v2f i) : COLOR {
                    float4 texcol = tex2D(_MainTex, i.uv);
                    texcol *= _Color;
                    texcol.rgb += i.color;
                    return texcol;
                }
			ENDCG
        }
    }
}

What I whant is the blue part to be transparent and be able to customize it using it’s alpha channel…

Hi Magarcan

I surprised you are need transparent shader but you are not using Alpha Blending for it, you need to calculate alpha of texcol in fragment program (as how much you need holographic effect for your model) and need to add few lines in a your subshader area before createing pass and the lines are

Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha OneMinusSrcAlpha

this two will gives you transparancy effect as you given / calucalte alpha in your fragment function calculated alpha will assign like this

texcol.a = <<your calculated value/variable>>;

I have pleasure if I help you more, but to do it I need your model FBX and basic blue texture with alpha which you used in the snaps

Best of Luck for your new experiment… :slight_smile: