Advertisement
Guest User

Untitled

a guest
Jan 14th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/AlphaShader" {
  2.     Properties {
  3.         _Color ("Color", Color) = (1,1,1,1)
  4.         _MainTex ("Albedo (RGB)", 2D) = "white" {}
  5.          _Alpha ("Alpha (A)", 2D) = "white" {}
  6.         _Glossiness ("Smoothness", Range(0,1)) = 0.5
  7.         _Metallic ("Metallic", Range(0,1)) = 0.0
  8.     }
  9.     SubShader {
  10.         Tags { "Type" = "TransparentCutout" "Queue" = "AlphaTest" }
  11.         LOD 200
  12.  
  13.         Cull Off
  14.  
  15.         CGPROGRAM
  16.         // Physically based Standard lighting model, and enable shadows on all light types
  17.         #pragma surface surf Standard fullforwardshadows Alpha
  18.  
  19.         // Use shader model 3.0 target, to get nicer looking lighting
  20.         #pragma target 3.0
  21.  
  22.         sampler2D _MainTex;    
  23.         sampler2D _Alpha;
  24.  
  25.         struct Input {
  26.             float2 uv_MainTex;
  27.         };
  28.  
  29.         half _Glossiness;
  30.         half _Metallic;
  31.         fixed4 _Color;
  32.  
  33.         // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  34.         // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  35.         // #pragma instancing_options assumeuniformscaling
  36.         UNITY_INSTANCING_BUFFER_START(Props)
  37.             // put more per-instance properties here
  38.         UNITY_INSTANCING_BUFFER_END(Props)
  39.  
  40.         void surf (Input IN, inout SurfaceOutputStandard o) {
  41.             // Albedo comes from a texture tinted by color
  42.             fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  43.             o.Albedo = c.rgb;
  44.             // Metallic and smoothness come from slider variables
  45.             o.Metallic = _Metallic;
  46.             o.Smoothness = _Glossiness;
  47.             o.Alpha = tex2D (_Alpha, IN.uv_MainTex).a;
  48.         }
  49.         ENDCG
  50.     }
  51.     FallBack "Diffuse"
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement