-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Window alpha blend issue when using GLFW_TRANSPARENT_FRAMEBUFFER (OpenGl3) #2764
Comments
On further messing around, I think it would make more sense to change the blend function instead of equation, so:
and keep This appears to have the same effect, and should have minimal impact on the appearance of UI's. On another note, it looks like there is some more internal work to do to support transparent framebuffers. I may try my hand at a PR later, once I have some of the current issues resolved (biggest one is creating transparent windows and clearing properly for multiple viewports). |
Sorry @ShawnM427 for the late answer. Went through a bunch of backends and examples yesterday. We will still need to work on better Backends and Multi-viewports support, so will keep #2766 open as current change don't fulfill all the ideas suggested by #2766. Will add more details there. |
Version: 1.73 (cb538fa)
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw3.cpp
Compiler: Visual Studio 2019 (MSVC)
Operating System: Windows 10 Pro (1809)
My Issue/Question:
When transparent framebuffers are enabled in GLFW (via GLFW_TRANSPARENT_FRAMEBUFFER window hint), imgui backgrounds do not properly alpha blend, and the underlying windows will bleed through the imgui windows, even when the backbuffer transparency is 1.
Expected result:
Actual result:
Suggested Resolution:
Change line 186 of imgui_impl_opengl3.cpp from:
to
This fixes the issue, but I have not tested the potential side effects of this. In theory additive blending of alpha should work, there is probably something that I'm missing. Looking at the docs, the only way to go from 255 alpha to something lower is if As or sA is < 0). When doing a pixel debug in nsight, things start to make even less sense.
If you look at event 50, the alpha actually drops from 255 down to 241
Compare that to what the docs say, we should be getting:
I have the feeling that this is less of an ImGui issue and more of an issue with how GLFW or OpenGL handle transparent framebuffers (there's also an issue where a=0 does not blend properly with the underlying screen if any of the other channels are non-zero), but I need to do more digging.
As for the visual difference between additive and max, it looks OK to me, but then again I don't have any content underneath it yet:
I feel like I may be missing something else here, any suggestions?
Standalone, minimal, complete and verifiable example:
The text was updated successfully, but these errors were encountered: