Skip to content

Instantly share code, notes, and snippets.

@PowZone
Forked from DanMillerDev/MobileOcclusion.shader
Last active July 4, 2026 08:31
Show Gist options
  • Select an option

  • Save PowZone/e18d12a570837555205f400ed04df41b to your computer and use it in GitHub Desktop.

Select an option

Save PowZone/e18d12a570837555205f400ed04df41b to your computer and use it in GitHub Desktop.
Occlusion shader for Unity. Can be used for mobile AR Occlusion
Shader "Custom/MobileOcclusion"
{
SubShader {
Tags { "Queue"="Geometry-1" "RenderType"="Opaque" }
Pass {
ZWrite On
ZTest LEqual
ColorMask 0
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
float4 position : SV_POSITION;
};
v2f vert (appdata input)
{
v2f output;
output.position = UnityObjectToClipPos(input.vertex);
return output;
}
fixed4 frag (v2f input) : SV_Target
{
return fixed4(0.5, 0.3, 0.0, 1.0);
}
ENDCG
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment