-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 alpha blending in WebGL backends #650
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This reverts commit 91bdf9b
emilk
requested changes
Aug 25, 2021
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.
This is wonderful work; thank you so much!
As I noted in my review I think the WebGL1 pipeline should remain as it was, but the improvements to the WebGL2 renderer is massive, and works great! ❤️
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Thank you again! |
mankinskin
pushed a commit
to mankinskin/egui
that referenced
this pull request
Sep 29, 2021
Add a render-to-texture step with an sRGBA8 texture
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes alpha blending in the WebGL backends by first blending everything in a linear framebuffer, before converting the result to sRGB in a second shader.
The results of the color test are now identical to the egui_glium backend when using the WebGL2 backend.
The WebGL1 backend suffers from reduced precision in dark colors without the
SRGB8_ALPHA8
format and still doesn't have correct texture interpolation.Color test with the change (I have since removed the warning):
![WebGL2](https://user-images.githubusercontent.com/26281282/130811655-1f91258f-6e93-4652-8617-388cfb208475.png)
![WebGL1](https://user-images.githubusercontent.com/26281282/130811661-406d05e1-e874-4e61-a6b3-76bfb511eca8.png)
WebGL2
WebGL1
(Sorry for not following the contributing guidelines exactly ("First file an issue" and all that). This was a spontaneous test as I didn't know whether it was even possible and I didn't wan't to file an issue the same minute as closing it (Should I?).)