Depth/Stencil buffer + 2D URP + WebGL broken

I just filed a bug about this, but wondering if others are experiencing the same issue.

I’m using URP 2D, and when I check “Use Depth/Stencil buffer” in my 2d config, the project builds but the player just shows a black screen and 100 of these in the console:

GL_INVALID_FRAMEBUFFER_OPERATION: Framebuffer is incomplete.

Just unchecking the option to use stencil buffer fixes the issue.

I’m using the latest stable build of Unity (2020.2.1f12).

Anyone else experiencing this issue? Interestingly, I’m not even using anything in the scene that should require stencil buffers (e.g. sprite masks)…

2 Likes

Same here on Unity 2019.4.14 with URP 7.5.1.

Currently implementing a feature that requires the stencil buffer to use UI masking, so I hope there’s a fix incoming. I’ll update you if I can find a way to get it working, but it seems like “Use Depth/Stencil buffer” leads to a 100% broken WebGL build.

I filed a bug report with Unity, and they told me the bug will is fixed in 2021.
However they noted that a workaround is simply to change the color space from gamma to linear. As I understand it, there shouldn’t be an appreciable performance hit, but it does mean dropping WebGL 1 support (and thus safari for now). That’s what I’ve done in my project.

1 Like

Good to know, that’ll do for now.

I thought Unity Issue Tracker - [WebGL] [URP] Scene is rendered black in WebGL build when Depth Texture is enabled might have been related, but upgrading URP to a version with this fix backported didn’t change anything FYI.

We are very much looking towards WebGL 2 today. It is unfortunate that Safari is outdated and does not offer WebGL 2 yet.

They do however have an experimental WebGL 2 support in Safari Tech Preview. One thing that would be amazing if you can try out, is whether your game works correctly if you download Safari Tech Preview, and in its experimental settings panel, enable WebGL 2. When doing the game build, mark its Graphics APIs to limit to only WebGL 2 so it won’t accidentally run against WebGL 1 on Safari.

Actually that is something that we could use a lot more eye pairs on. I posted a thread at Request for help: Does your WebGL 2 game render correctly in Safari Tech Preview? to collect more comments from developers about experiences.

1 Like

Thank you! We just finished a project and were frustrated the WebGL version wouldn’t render correctly. You saved us!