Has anyone else tried to render fonts when linear color space is enabled? I noticed that rendering is totally wrong. White text on black background looks like it is bold, and black text on white background is barely visible. I was using dynamic font, tried different sizes etc, and just can’t get the same look as in Gamma color space. Does anyone have any idea what to do?
After days of debugging, I still haven’t found a fix for the issue :S
Maybe posting comparison pictures might help to get someone to post a guess on the problem.
Ok, so here is the comparison, made in fresh unity 5 project. Left side is rendered with Linear and right with Gamma pipeline. You can clearly notice that Linear color space is not working properly. On black background font is too thick and on white it’s too thin, so black actually becomes gray.
I’m also having this issue. It’s a very subtle difference, and so might be easily overlooked by someone not doing a direct comparison.
The text looks less crisp in linear space and makes the shadows on the text in my UI less pronounced as well. I assume it has something to do with the anti aliasing.
EDIT:
Searching google, all I can find are your posts on the subject with no responses. No one else seems to notice or care about this issue. I think we’re screwed, buddy.
Well I hope someone will see this issue sooner or later.
I also created an Issue: Unity Issue Tracker - [PlayerSettings] [ColorSpace] Linear color space changes the text and it is not shown properly
But it seems that almost no one cares / notices this issue. I saw it the very moment when I enabled linear color space and It’s really bothering me. Black text on bright background is barely visible and the hue is not correct. I’ve been trying to fix it with the shader, but I just couldn’t make it work for all colors.
I can confirm that the problem is due to the alpha blending of the font’s anti-aliasing. I don’t think Unity considers the change in how blending works to be a bug.
I’ve managed to settle for good enough with changing the fragment shader, but this seems like a silly hack to revert the UI back to gamma space. It would be nice if they would enable an option to pick the color space per camera/canvas.
I’ve been using the below in the UI-DefaultFont shader, and for other blended UI elements.
col.a = pow(col.a + 0.055, 2.2) / 1.13711896582;
I already tried something similar, and also tried your solution but this doesn’t fix the whole problem. This only fixes the case when you are drawing bright font on a dark background. If you try your solution with rendering black font on a white background it gets even worse. So this is definitely not a solution.
I’m not sure there is a fix for this. The issue is that alpha blending intentionally behaves differently in linear color space.
My ideal solution is for Unity to introduce some flexibilty with their color space. For example, force the UI to render in gamma color space. The immediate mode GUI always renders in gamma color space, so surely it must be possible?
I really need someone from Unity to comment on this. I’m stuck in a position where I really want to switch to linear color space for my game, but my UI uses a lot of alpha blending and I don’t know how to get it looking the way I want.
If you find the solution, please let me know.
Actually, the linear space font rendering is correct and the gamma space rendering is wrong (the font’s alpha texture has gamma correction applied to it so the antialiasing suffers). This of course is a matter of taste on which one you prefer.
Hi I just responded to this bug, this is what I said:
Hi,
Thank you for replying to this thread. I have some follow up questions:
-
Despite the complexity involved, are there any future plans to add support for switching color spaces at runtime? Specifically will it ever be likely that there will be a feature implemented lets us render the just the UI in gamma when using linear.
-
Given that fonts look different and there are no options to tweak or control them to account for linear, can you suggest any other viable solutions aside from tweaking the font shader?
Thanks!
I am also curious about RV1’s questions.
I’m well aware that blending is different in linear space. However, fonts are handled by Unity. The font’s antialiasing is of worse quality in Linear. It seems like Unity should have “Gamma” and “Linear” font import settings. Perhaps autodetected.
In any case, Unity’s built-in font system should look better when using Unity’s “advanced” features, not worse.
At the very least, it should not degrade in quality.
So, this issue still persist and it is year 2018. @Tim-C has there been any progress on this issue? From the way I see it all we would need is to render UI in gamma space or at least option to do that. It seems really strange there is actually still no solution to this problem in Unity.
2019 and we still can’t properly render fonts when using linear color space, is really no one from unity interested in fixing this?
Just letting everyone know that I am reading these posts and aware of this behavior. I will take a look at this once the next release of TMP is available.
Thanks for finally looking at this, also know that this isn’t just a TMP issue but also with Unity UI. If I can help you with anything, please let me know
Here is also the comparison, when I tried to solve the issue with shaders and nothing worked.
@Stephan_B anything new regarding this issue?