Search Unity

Stencils not working on Metal

Discussion in 'iOS and tvOS' started by Thomas-Mountainborn, Nov 29, 2018.

  1. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    501
    On an iPad, using Metal, the stencil buffer is not being used. The shader that draws to the stencil buffer is unlit and using ColorMask 0 so it's not visible, but on the device it's just rendered as a regular unlit shader, so it's both not doing any stenciling and ignoring the color mask. I'm on Unity 2018.1.

    The stencil buffer is not disabled in the player settings, and I can't find any other settings relating to it. I tried including the offending shader in the always included shaders list, to no avail. Any ideas as to why this is happening?
     
  2. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    I'm having no problems with stencil shaders on iOS (neither iPhone SE nor iPad Pro 10,5'').
    I'm on Unity 5.6, could be the version. Otherwise, make sure that the shader is not the problem. You can find a simple shader to support stencil and color mask rendering over here: https://github.com/supyrb/ConfigurableShaders

    Did you try it on an iPhone or other platforms?