Advertisement
Guest User

AlphaFade.shader

a guest
Dec 23rd, 2021
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/AlphaFade" {
  2.     Properties {
  3.         _Color ("Main Color", Color) = (1,1,1,1)
  4.         _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
  5.         _Alpha ("Alpha",  Range(0,1)) = 1.0
  6.         _Glossiness ("Smoothness", Range(0,1)) = 0.5
  7.         _Metallic ("Metallic", Range(0,1)) = 0.0
  8.     }
  9.  
  10.     SubShader {
  11.         Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  12.         LOD 200
  13.         Blend SrcAlpha OneMinusSrcAlpha
  14.  
  15.         CGPROGRAM
  16.         #pragma surface surf Standard keepalpha
  17.  
  18.         sampler2D _MainTex;
  19.         fixed4 _Color;
  20.         float _Alpha;
  21.         float _Metallic, _Glossiness;
  22.  
  23.         struct Input {
  24.             float2 uv_MainTex;
  25.         };
  26.  
  27.         void surf (Input IN, inout SurfaceOutputStandard o) {
  28.             // Albedo comes from a texture tinted by color
  29.             fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
  30.             o.Albedo = c.rgb;
  31.             o.Alpha = _Alpha;
  32.             // Metallic and smoothness come from slider variables
  33.             o.Metallic = _Metallic;
  34.             o.Smoothness = _Glossiness;
  35.         }
  36.         ENDCG
  37.     }
  38.  
  39.     // enable shadow casting
  40.  
  41.     Fallback "Diffuse"
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement