Hi there.
I am using a mask shader to hide certain objects in Unity.
It works fine on all platforms apart from Android.
What I see normally…
Notice the well in the center of the room is not shown at the bottom of the screen… this is because it is covered by masking object using my mask shader.
What I see on Android…
The masking object is rendered black. The choppy artifacts appear in OpenGL… but not in Vulkan.
Now… I am guessing that this is happening due to the Skybox getting rendered AFTER the mask.
So I set my mask render queue to a crazy high 2610… still no joy.
Here is my mask shader code…
Shader "Thunderbox/Mask" {
SubShader {
// Render the mask after regular geometry, but before masked geometry and
// transparent things.
Tags {"Queue" = "Geometry+10" }
// Don't draw in the RGBA channels; just the depth buffer
ColorMask 0
ZWrite On
// Do nothing specific in the pass:
Pass {}
}
}
Any ideas what I’m doing wrong?
(Hmmm… looking at that shader code again, could it be a depth buffer setting?)
Cheers,
Dan
Try rewriting this, (just look for example code) in HLSL CG shader code. Sometimes Surface shader just fails for android cause a new update to android does not yet have a fix to a new break
Thanks, @unityuserunity85496 - could you give a little more info? I am not a shader expert. What is HLSL?
Ah! I Googled “HLSL CG mask shader unity” and this post was the third hit!
I will try using the masking shader from the AR Kit plug-in and see how that works on Android.

HLSL is the updated version of CG shaders there’s some nuance but its all the same still mostly
Cg Programming/Unity - Wikibooks, open books for an open world
Make a new UNlit shader in unity and plug in parts of stuff from there
Tried this shader from the Unity AR Kit plug-in… still the same issue…
Shader "Thunderbox/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
}
}
}
A quick searching around shows that Android mobile is not too cool with Ztest at times. You’ll have to control the rendering order maybe
Custom Render Pipeline (catlikecoding.com)
Custom Pipeline (catlikecoding.com)
never expect old example files to work. THEY ALWAYS BREAK and nobody keeps them up to date really
Drat. Changing the entire render pipeline for my project isn’t really an option as we are almost about to ship! Maybe I could do something with the Stencil Buffer instead? 
Yeah, there will ALWAYS be show stopper issues. You learn to test on the device from the start at some point. Stencil buffer is a hard cut. You could also change the camera to perspective and drag the objects above each other a tiny bit and test for zfighting