I am using Unity 2019.3 and I have a custom shader A which contains the code

     Ref 5
     Comp Equal
     Pass Keep

And the other custom shader B contains the code

     Ref 5
     Comp Always
     Pass Replace

The stencil test can do the right thing only if I add Fallback "Diffuse" in B, otherwise, it's never working. And A has no code related to Fallback.

Since shader A is using for post processing and I did something like


The material uses shader A.

Does this cause the issue because before today, I never use the Fallback during stencil test.

PS. You can use this and scene named SSS as example. In that scene the shader named Unlit/PBR has this issue. If you delete Fallback "Diffuse in that shader, the post processing effect never works.

  • 1
    \$\begingroup\$ I don't think we have enough information about what these shaders are doing or how you're using them to reproduce the issue. Can you ensure your question contains a Minimal Complete Verifiable Example? \$\endgroup\$
    – DMGregory
    Dec 17, 2019 at 12:30
  • \$\begingroup\$ Please post the MCVE in your question itself, not as an external link. \$\endgroup\$
    – DMGregory
    Dec 18, 2019 at 3:54
  • \$\begingroup\$ I've edited the question, now you'll have a more clear view of this issue \$\endgroup\$ Dec 18, 2019 at 4:05


You must log in to answer this question.

Browse other questions tagged .