-
-
Notifications
You must be signed in to change notification settings - Fork 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
SRGB correct linear gamma blending rewrite #5969
Conversation
Looking at the differences between Windows Terminal text-rendering and Kitty on Linux we can clearly see that Windows renders text a bit differently (compare to the graphs for MacOS Terminal vs Kitty on Mac here #5423 (comment)): The approxmiation is still decent with the following values:
|
I have now done some crude performance-measurements. I first attempted to use the CPU-profiler to time the invocation of the shader-program, but it seems like the sample-frequency is too low for that to be anywhere close to accurate since the duration of
The difference could be explained by the low sample-size, or the fact that some shader-parameters are unused by the old fragment shader. Or the very slight refactoring I made to it improved performance somehow despite then adding more operations to it? At least for my machine there does not seem to be any reduction in performance with the changes to the shader. Details:
|
Cool I will review it when I have a moment. |
Been using this updated PR for a few days now, and I think it looks lovely. I'm looking forward to it landing in mainline. |
LGTM. I have merged, changing it to use only a single option to control it and also to default to values that look close to native. (i.e. 1.7 and 30 on macOS and 1.0 and 0 on Linux). If these values need adjustment do let me know. My eyes arent really good enough to tell anymore. |
Incredible work everyone. Very excited for this! |
…" rendering. Also use only a single option to control it.
@m4rw3r as suggested by Kovid in 4dfd4d4#commitcomment-100176618 , I'm reporting here that Said differently, although the behavior seems to be acknowledged by documentation saying ...
... a user switching between light & dark themes will have to adjust Here's kitty with exaggerated-for-demo extremely light Whereas if going to crazy-thick settings To come back to my use case: I wasn't trying to go to extreme scenarios like the ones I'm presenting for demos. I had tweaked thickness for my fav light theme, and when the night came and I switched to my fav dark theme, I was like "wait, why is this so different?". I fiddled, and almost thought the setting was broken for dark themes, given how little effect it has compared to with light themes. → Do you agree the inconsistency feels like something that's undesirable to people switching between dark & light themes? Am I missing something? |
The contrast function is supposed to make it easier to achieve the same perceived thickness between dark-on-light and light-on-dark text. The main issue is that darker foregrounds gets affected more negatively in terms of thickness with respect to gamma, which is why the adjustment has to be different for the two cases (and we cannot skip gamma since that will make text appear unevenly thick even at the same thickness and color). If it was possible to use the exact same adjustment, without having to account for luminance of background/foreground, then that would be preferable but from all my experiments the contrast or stem-darkening algorithms always increase the thickness of dark-on-light a lot more than light-on-dark (some even leave the light-on-dark completely untouched). The contrast adjustment currently works like this:
In one extreme both user-configurable parameters result in visible change, but with a light-on-dark theme we only get the linear contrast. Ie. the first configuration value matters for dark-on-light and gradually is applied less and does almost nothing for light on dark. So in your case I think I would go about it like this: first set the values to I did not want to add too many parameters to this feature initially, since it is very easy to get text to look bad, but there might be additional values which need to be exposed in the configuration. Or maybe I need to work on documenting the values and how they behave. |
Is |
I did not use I also found this added in the changelog: "The obsolete |
Thanks for the explanations!
Fantastic, that's exactly what I was looking for: a quick "HOWTO" guide/workflow to configure these values 🙂. To my taste and with my font of choice ( Suggestion: integrate to the official documentation this little guide you wrote above!
I understand the desire to not add even more parameters, as it's already tricky to configure! But yes I do think (see my "Suggestion" comment above) that it'd be valuable to have a bit more "dumbed down" documentation added to the docs. Even though the docs already reasonably describe the feature now, just reading it let me entirely unable to derive the "HOWTO"-style guide you provided me above. Maybe it's something that's intuitive to you (who worked on it) or to someone familiar with that kind of computation, but it's not at all for a newbie like me. So yup, the HOWTO would be an excellent addition to the docs I think. Lame metaphor: a great car engine manual doesn't just show you a raw diagram of the pistons & cylinders. It also teaches you that to tune it, you should A. adjust knob X at 1000RPM then B. push/pull on knob Y+Z at 3000RPM. |
I tested the display of complex CJK font glyphs at Low and Hi-DPI. However, the slash "/" appears to have some jaggedness, compared to the macOS rendering, which looks like it lacks some anti-aliasing. Some users may want to fine-tune the default values.
It sounds like one that can be automatically adjusted and configured, just like a digital camera auto focusing. |
A PR updating the docs to make this option easier to use is most |
Does this solve the "subpixel AA" concerns? How do we use it? |
Glyph dilation on macOS may still be relevant even with gamma correct antialiasing. See this tweet from Patrick Walton: |
On Sun, Feb 26, 2023 at 09:06:02PM +0000, Carlos Vigil wrote:
Does this solve the "subpixel AA" concerns? How do we use it?
This has nothing to do with subpixel AA. And it is used automatically.
|
This is a rewrite of #5423, which in turn is building on #3308.
Features:
Additional features/improvements compared to #5423:
cell_fragment.glsl
shader.text_old_gamma yes
.To get very close to MacOS rendering of fonts, use the following values:
TODO:
set_cell_uniforms
).