-
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
Improve text rendering and do all color operation in gamma space #2071
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
Remove the entire PostProcess shenanigans
emilk
added a commit
to rerun-io/rerun
that referenced
this pull request
Sep 24, 2022
Includes recent improvements to text rendering: * emilk/egui#2071 * emilk/egui#2070 * emilk/egui#2069
emilk
added a commit
to rerun-io/rerun
that referenced
this pull request
Sep 24, 2022
Includes recent improvements to text rendering: * emilk/egui#2071 * emilk/egui#2070 * emilk/egui#2069
This was referenced Sep 25, 2022
Wumpf
changed the title
Improve text redering and do all color operation in gamma space
Improve text rendering and do all color operation in gamma space
Oct 23, 2024
This was referenced Dec 8, 2024
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.
Closes #1410
Closes #1455
Closes #1411
Summary
This PR removes the linear framebuffer blending, and the linear blending in the pixel shader. Basically all color operations are now done in gamma space on the GPU. Only the sRGB-aware texture sampling is kept (when available).
Background
An early design decision in egui was to do all color operations in linear space. This is what makes sense physically, and is the standard for e.g. PBR. Gamma space is based on human perception and is non-physical. However, it turned out that getting proper anti-aliasing of fonts was very difficult to accomplish in linear space. This is not so strange when you think about it: you want to anti-alias using a perceptually linear gradient, not a physically linear.
Consequences
Image
tinting will work differentlyFor integrations
Here is the vertex shader you need:
And here is the fragment shader:
SRGB_TEXTURES
indicates if you have an sRGB-aware texture sampler. It is recommended that you do.Before
Notice the ugly artifacts when painting white text on white background. Also notice how the black text on white background is not really black, but gray.
After
Notice how the dark text on white background is now much darker and legible.
You can also notice that the text and the lines now look to have the same weight black-on-white as when white-on-black.