-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix rendering issue with depth in WebXR #88787
Conversation
It sounds like the depth just wasn't being written as we suspected. But the fix seems odd to me. The result is that we will define a fragment out value even when rendering to depth which could have a negative performance impact on some devices. I'll take a deeper look on Monday and see how those defines are set |
I've been looking at this some more. It seems like the However, I wonder if there are some differences here between OpenGL and GLES? Is it possible that some GLES implementations require having a fragment color out if the framebuffer has a color attachment? Looking at the scene.glsl for GLES3 in Godot 3, it appears to always be declaring the fragment color out, even when |
I had the idea that maybe switching all the
Since I saw some WebGL code like Unfortunately, it didn't work. :-( @clayjohn Do you have any other ideas? So far this PR is the only thing that has worked for me to fix this issue. |
Looking more closely, I can see that the only different in behaviour is in the cases where The more I look into this, the more it doesn't make sense. Here is the WebGL 2.0 spec talking about the differences from GL ES 3.0:
The last comment is particularly interesting here. It implies that we can write only depth to a framebuffer with a bound color attachment , but we need to have a proper colorMask. In Godot we write godot/drivers/gles3/rasterizer_scene_gles3.cpp Line 2560 in 7d2ca2d
Ultimately, I can't see anything that would cause this issue. So let's go ahead with this PR. It reintroduces the state we were in prior to #87386 with respect to defining |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go ahead with this. We can remove the check for MODE_RENDER_DEPTH
since we don't actually care about it if we are always using some color output
6240f3a
to
e35ccf9
Compare
@clayjohn Thanks! I've made your suggested changes in my latest push :-) |
Thanks! |
Currently on
master
, in WebXR there is a rendering issue with depth where it draws some triangles in front, that really should be behind.Here's a screenshot showing the problem (most obvious on the fingers):
And here's a screenshot with this PR:
It looks like this issue was introduced in PR #87386