Stencil buffer doesn't work on WebGL2

,Hello there,

Im currently trying to cut shapes in objects using stencil buffer. Everything works in editor and PCBuild, but unforunately it doesn’t work on WebGL build.

I’ve tried many options like enabling stencil buffer in WebGLRenderingContext from index.html, I was trying to add shaders that to preloaded shaders, and many variants of settings in build settings but still doesn’t work.

If question is not precised - feel free to ask and i will try to explain it.

Problem solved.

If you want to use stencil buffer in WebGL use it via render feature and specify masks and events. To BeforeRenderingTransparent. In Unity there is no difference, but WebGL somehow don’t render it properly when using AfterRenderingTransparent.

Also do not use default Stencil Override, because it interacts with masks.