Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zilongshanren/f9b653152717ddaeb6e75b504eccb75f to your computer and use it in GitHub Desktop.
Save zilongshanren/f9b653152717ddaeb6e75b504eccb75f to your computer and use it in GitHub Desktop.
Depth only pass
Pass
{
Name "Depth"
Tags { "LightMode" = "ShadowCaster" }
ZWrite On
ColorMask 0
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc"
struct v2f {
float4 vertex : POSITION;
float Depth: TEXCOORD0;
};
v2f vert( appdata_base v )
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}
float4 frag( v2f i ) : SV_Target
{
return i.Depth;
}
ENDCG
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment