Advertisement
stefanplc

ZTest Shaders/Cube

Jul 30th, 2019
1,405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "ZTest Shaders/Cube"
  2. {
  3.     Properties
  4.     {
  5.         ObjectColor("Object Color", Color) = (1, 1, 1, 1)
  6.     }
  7.     SubShader
  8.     {
  9.         Tags {
  10.             "Queue" = "Transparent+10"
  11.         }
  12.  
  13.         Pass
  14.         {
  15.        
  16.             ZWrite On
  17.             ZTest Greater
  18.  
  19.             CGPROGRAM
  20.             #pragma vertex vert
  21.             #pragma fragment frag
  22.            
  23.             #include "UnityCG.cginc"
  24.  
  25.             struct appdata
  26.             {
  27.                 float4 vertex : POSITION;
  28.             };
  29.  
  30.             struct v2f
  31.             {
  32.                 fixed4 color : COLOR;
  33.                 float4 vertex : SV_POSITION;
  34.             };
  35.            
  36.             uniform fixed4 ObjectColor;
  37.  
  38.             v2f vert (appdata v)
  39.             {
  40.                 v2f o;
  41.                 o.vertex = UnityObjectToClipPos(v.vertex);
  42.                 o.color = ObjectColor;
  43.                 return o;
  44.             }
  45.            
  46.             fixed4 frag (v2f i) : SV_Target
  47.             {
  48.                 return i.color;
  49.             }
  50.             ENDCG
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement