Stencil Buffer breaks down rendering on mobile platforms

Hi everyone,

I made a simple custom shader which outputs custom values to the stencil buffer and another image effect shader which filters the display buffer based on the stencil values. Everything works perfectly well on the PC (camera follows an animated path and filters successfully stencil-marked parts), but the rendering breaks down on both Android and IOS platforms (camera doesn’t move and focus on a random part of the scene while filtering is off).

Do you guys have any idea of what I’m doing wrong? Possibly, I forget to set something relative to mobile settings to enable the use of the stencil buffer…

Thank you in advance.

You might want to ask on the android & iOS platform subforums, but I’m pretty sure by default mobile uses a 16 bit depth buffer which doesn’t have stencil support. You have to enable 24 bit depth in the player settings, and even then I think some platforms still won’t have stencil support.

Thank you bgolus!
However, it looks like the 24-bit depth buffer settings have been removed from Unity 5.x (which is what I’m actually using).