Advertisement
Guest User

Hole.shader

a guest
Aug 22nd, 2023
989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Unlit/Hole"
  2. {
  3.     Properties
  4.     {
  5.    [HDR]_Color("Color",Color) = (1,1,1,0.5)    
  6.         _MainTex ("Texture", 2D) = "white" {}
  7.     }
  8.     SubShader
  9.     {
  10.       Tags { "RenderType" = "Opaque" "Queue" = "Geometry+2"}
  11.         ColorMask RGB
  12.        
  13.               ZTest off
  14.             ZWrite On
  15.             Cull Front
  16.             Lighting Off
  17.          
  18.            
  19.             Stencil
  20.             {
  21.                 Ref 1
  22.                 Comp equal
  23.                 Pass zero
  24.                 fail zero
  25.                 zfail zero
  26.             }
  27.  
  28.         Pass
  29.         {
  30.             CGPROGRAM
  31.             #pragma vertex vert
  32.             #pragma fragment frag
  33.             // make fog work
  34.             #pragma multi_compile_fog
  35.  
  36.             #include "UnityCG.cginc"
  37.  
  38.             struct appdata
  39.             {
  40.                 float4 vertex : POSITION;
  41.                 float2 uv : TEXCOORD0;
  42.             };
  43.  
  44.             struct v2f
  45.             {
  46.                 float2 uv : TEXCOORD0;
  47.                 UNITY_FOG_COORDS(1)
  48.                 float4 vertex : SV_POSITION;
  49.             };
  50.  
  51.             sampler2D _MainTex;
  52.             float4 _MainTex_ST;
  53.             float4 _Color;
  54.  
  55.             v2f vert (appdata v)
  56.             {
  57.                 v2f o;
  58.                 o.vertex = UnityObjectToClipPos(v.vertex);
  59.                 o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  60.                 UNITY_TRANSFER_FOG(o,o.vertex);
  61.                 return o;
  62.             }
  63.  
  64.             fixed4 frag (v2f i) : SV_Target
  65.             {
  66.                 // sample the texture
  67.                 fixed4 col = tex2D(_MainTex, i.uv);
  68.                 // apply fog
  69.                 UNITY_APPLY_FOG(i.fogCoord, col);
  70.                 return col * _Color;
  71.             }
  72.             ENDCG
  73.         }
  74.     }
  75. }
  76.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement