Advertisement
Bunny83

ZTest Silhouette2.shader

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