I’m not having any luck getting some shaders using the stencil buffer (for stencil masking) to work on Android. I’ve tried a couple different devices (HTC 626 and Samsung S7) and the geometry with said shader simply doesn’t render. I’ve checked and made sure “Disable Depth and Stencil” isn’t on. It works fine on PC/iOS.
Hey, i’m also trying to make stencil shader work in android but for some reason it doesn’t. I’m writing a standard surface shader with stencil, how do i fix the z-depth in that one?
Sorry, I don’t know enough about shaders to help very much. I can say that I had 2 shaders, the stencilMask and the stencilGeometry shader. The stencilGeometry shader would probably be your standard surface shader. But it was in the stencilMask shader that I added the above code, in the vert function. Here’s mine:
v2f vert(appdata v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
//clear the depth buffer by setting Z to the far plane
#if defined(UNITY_REVERSED_Z)
o.pos.z = 0;
#else
o.pos.z = o.pos.w;
#endif
return o;
}