Created
July 30, 2019 05:52
-
-
Save DanMillerDev/6cfa871b2fe1ddbbbe0cb3dea08f7504 to your computer and use it in GitHub Desktop.
Occlusion shader for Unity. Can be used for mobile AR Occlusion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/MobileOcclusion" | |
{ | |
SubShader { | |
Pass { | |
// Render the Occlusion shader before all | |
// opaque geometry to prime the depth buffer. | |
Tags { "Queue"="Geometry" } | |
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