SFE_TransparentAntiRim.shader 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. Shader "SciFiEffects/Antirim" {
  2. Properties {
  3. _Color("Main Color", Color)= (1,1,1)
  4. _MainTex ("Diffuse Color", 2D) = "white" {}
  5. _RimPower ("Alpha Amount", Range(0.0,1)) = 0.4
  6. _AlphaMultiplier( "Alpha Multiplier" , Range( 0,8 )) = 2.0
  7. }
  8. SubShader {
  9. Tags { "Queue"="Transparent" "RenderType"="Opaque" }
  10. CGPROGRAM
  11. #pragma surface surf Lambert alpha
  12. struct Input {
  13. float2 uv_MainTex;
  14. float3 viewDir;
  15. };
  16. float4 _Color;
  17. sampler2D _MainTex;
  18. float _RimPower;
  19. float _AlphaMultiplier;
  20. void surf (Input IN, inout SurfaceOutput o) {
  21. fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
  22. o.Albedo = c.rgb;
  23. half VN = saturate(dot (normalize(IN.viewDir), o.Normal));
  24. half rim = pow (1.0f - VN, (_RimPower*8));
  25. o.Alpha = c.a - (rim * _AlphaMultiplier);
  26. }
  27. ENDCG
  28. }
  29. FallBack "Transparent/VertexLit"
  30. }