Advertisement
tonynogo

Demo 09 - Stencil Invisible Crate

Jul 6th, 2017
11,115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/StencilEffect" {
  2.     Properties {
  3.         _MainTex ("Base (RGB)", 2D) = "white" {}
  4.     }
  5.     SubShader {
  6.         Tags { "RenderType"="Opaque"}
  7.  
  8.         Stencil {
  9.             Ref 1
  10.             Comp equal
  11.             Pass Keep
  12.         }
  13.  
  14.         CGPROGRAM
  15.         #pragma surface surf Lambert
  16.  
  17.         sampler2D _MainTex;
  18.  
  19.         struct Input {
  20.             float2 uv_MainTex;
  21.         };
  22.  
  23.         void surf (Input IN, inout SurfaceOutput o) {
  24.             half4 c = tex2D (_MainTex, IN.uv_MainTex);
  25.             o.Albedo = c.rgb;
  26.             o.Alpha = c.a;
  27.         }
  28.         ENDCG
  29.     }
  30.     FallBack "Diffuse"
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement