Created
September 21, 2018 06:12
-
-
Save 3dln/53cf4cec621bcf757b6ac09f62306811 to your computer and use it in GitHub Desktop.
Depth mask is a shader for concealing objects in AR used for AR window effects and hiding underground models
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
Shader "DepthMask" { | |
SubShader { | |
// Render the mask after regular geometry, but before masked geometry and | |
// transparent things. | |
Tags {"Queue" = "Geometry-10" } | |
// Turn off lighting, because it's expensive and the thing is supposed to be | |
// invisible anyway. | |
Lighting Off | |
// Draw into the depth buffer in the usual way. This is probably the default, | |
// but it doesn't hurt to be explicit. | |
ZTest Always | |
ZWrite On | |
// Don't draw anything into the RGBA channels. This is an undocumented | |
// argument to ColorMask which lets us avoid writing to anything except | |
// the depth buffer. | |
ColorMask 0 | |
// Do nothing specific in the pass: | |
Pass {} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment