1 Shader "RimAlpha" { 2 Properties { 3 _MainTex ("Texture", 2D) = "white" {} 4 _BumpMap ("Bumpmap", 2D) = "bump" {} 5 _RimColor ("Rim Color", Color) = (0.231,0.933,0.890,0.5) 6 _RimPower ("Rim Power", Range(0.5,8.0)) = 1.0 7 _Color ("Main Color", Color) = (1,1,1,1) 8 9 } 10 SubShader { 11 Tags { 12 "Queue"="Transparent" 13 "IgnoreProjector"="True" 14 "RenderType"="Transparent" 15 } 16 17 ZWrite Off 18 Blend SrcAlpha One 19 AlphaTest Greater .01 20 21 CGPROGRAM 22 #pragma surface surf BlinnPhong alphatest:_Cutoff 23 24 struct Input { 25 float2 uv_MainTex; 26 float2 uv_BumpMap; 27 float3 viewDir; 28 }; 29 sampler2D _MainTex; 30 sampler2D _BumpMap; 31 float4 _RimColor; 32 float _RimPower; 33 void surf (Input IN, inout SurfaceOutput o) { 34 o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb; 35 o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap)); 36 half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal)); 37 o.Alpha = pow (rim, _RimPower); 38 o.Emission = _RimColor.rgb * pow (rim, _RimPower) * 1; 39 } 40 ENDCG 41 } 42 Fallback "Diffuse" 43 }