daily pastebin goal
28%
SHARE
TWEET

ZTest Silhouette.shader

Bunny83 Mar 12th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/ZTest Silhouette" {
  2.     Properties {
  3.         _Color ("Color", Color) = (1,1,1,1)
  4.         _Silhouette ("Silhouette", Color) = (0.5,0.5,0.5,0.2)
  5.         _MainTex ("Albedo (RGB)", 2D) = "white" {}
  6.         _Glossiness ("Smoothness", Range(0,1)) = 0.5
  7.         _Metallic ("Metallic", Range(0,1)) = 0.0
  8.     }
  9.     SubShader {
  10.         Tags { "Queue"="Transparent" "RenderType"="Transparent" }
  11.         LOD 200
  12.         CGPROGRAM
  13.         // Physically based Standard lighting model, and enable shadows on all light types
  14.         #pragma surface surf Standard fullforwardshadows
  15.  
  16.         // Use shader model 3.0 target, to get nicer looking lighting
  17.         #pragma target 3.0
  18.  
  19.         sampler2D _MainTex;
  20.  
  21.         struct Input {
  22.             float2 uv_MainTex;
  23.         };
  24.  
  25.         half _Glossiness;
  26.         half _Metallic;
  27.         fixed4 _Color;
  28.  
  29.         // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  30.         // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  31.         // #pragma instancing_options assumeuniformscaling
  32.         UNITY_INSTANCING_CBUFFER_START(Props)
  33.             // put more per-instance properties here
  34.         UNITY_INSTANCING_CBUFFER_END
  35.  
  36.         void surf (Input IN, inout SurfaceOutputStandard o) {
  37.             // Albedo comes from a texture tinted by color
  38.             fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
  39.             o.Albedo = c.rgb;
  40.             // Metallic and smoothness come from slider variables
  41.             o.Metallic = _Metallic;
  42.             o.Smoothness = _Glossiness;
  43.             o.Alpha = c.a;
  44.         }
  45.         ENDCG
  46.  
  47.         ZTest Greater
  48.         Blend SrcAlpha OneMinusSrcAlpha
  49.         ZWrite Off
  50.         CGPROGRAM
  51.         // Physically based Standard lighting model, and enable shadows on all light types
  52.         #pragma surface surf Standard alpha:blend
  53.  
  54.         // Use shader model 3.0 target, to get nicer looking lighting
  55.         #pragma target 3.0
  56.  
  57.         struct Input {
  58.             float2 uv_MainTex;
  59.         };
  60.  
  61.         fixed4 _Silhouette;
  62.  
  63.         // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  64.         // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  65.         // #pragma instancing_options assumeuniformscaling
  66.         UNITY_INSTANCING_CBUFFER_START(Props)
  67.             // put more per-instance properties here
  68.         UNITY_INSTANCING_CBUFFER_END
  69.  
  70.         void surf (Input IN, inout SurfaceOutputStandard o) {
  71.             o.Albedo = _Silhouette.rgb;
  72.             o.Alpha = _Silhouette.a;
  73.         }
  74.         ENDCG
  75.     }
  76.     FallBack "Diffuse"
  77. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top