Advertisement
Bunny83

FullScreenStencil

Mar 13th, 2018
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1. Shader "Unlit/FullScreenStencil"
  2. {
  3.     Properties {
  4.         _Color ("Color", Color) = (0.5,0.5,0.5,0.2)
  5.     }
  6.     SubShader
  7.     {
  8.         Tags { "Queue"="Transparent" "RenderType"="Transparent" }
  9.         LOD 100
  10.  
  11.  
  12.         Pass
  13.         {
  14.             Blend SrcAlpha OneMinusSrcAlpha
  15.             Cull off
  16.             ZTest off
  17.             ZWrite off
  18.             Stencil {
  19.                 Ref 1
  20.                 Comp equal
  21.             }
  22.  
  23.             CGPROGRAM
  24.             #pragma vertex vert
  25.             #pragma fragment frag alpha:blend
  26.            
  27.             #include "UnityCG.cginc"
  28.  
  29.             fixed4 _Color;
  30.             struct appdata
  31.             {
  32.                 float4 vertex : POSITION;
  33.             };
  34.  
  35.             struct v2f
  36.             {
  37.                 float4 vertex : SV_POSITION;
  38.             };
  39.  
  40.             v2f vert (appdata v)
  41.             {
  42.                 v2f o;
  43.                 o.vertex = UnityObjectToClipPos(v.vertex);
  44.                 return o;
  45.             }
  46.            
  47.             fixed4 frag (v2f i) : SV_Target
  48.             {
  49.                 return _Color;
  50.             }
  51.             ENDCG
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement