Created
October 16, 2018 21:13
-
-
Save thelucre/dc4d2a084cb83df27e2e625e867ed10c to your computer and use it in GitHub Desktop.
This file contains 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
// Virtual occlusion, hide objects behind, without being visible to the user | |
// Useful with AR Utils: https://github.com/jonas-johansson/ARCoreUtils | |
// Shader src: https://forum.unity.com/threads/clipping-objects-behind-a-higher-plane.492147/#post-3205094 | |
Shader "Custom/ARStencilOcclusion" { | |
SubShader { | |
Tags { "Queue" = "Background-1" } | |
Pass { | |
ColorMask 0 | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#include "UnityCG.cginc" | |
struct appdata | |
{ | |
float4 vertex : POSITION; | |
}; | |
struct v2f | |
{ | |
float4 vertex : SV_POSITION; | |
float size : PSIZE; | |
}; | |
v2f vert (appdata v) | |
{ | |
v2f o; | |
o.vertex = UnityObjectToClipPos(v.vertex); | |
o.size = 30; | |
return o; | |
} | |
fixed4 frag (v2f i) : SV_Target | |
{ | |
return fixed4(1, 1, 1, 1); | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment