-
Notifications
You must be signed in to change notification settings - Fork 184
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
Random pixelated fonts #738
Comments
Define 'some resolutions'. I don't seem to be able to reproduce this. |
First two are default 800x600 windowed screen mode. The third screenshot is also default 800x600, but I maximized the window while I was in main menu before I started any level. |
I tried the exact same resolutions and couldn't reproduce this. Maybe show your graphics settings? |
Well, I tested with some graphic settings - it doesn't really depends on texture filtering, MSAA, etc. Experimenting with window size helps to fix readable of some words, but starting with default settings there's still some places that text is messed up. |
It also have nothing to do with the game's UI language. I changed the language, restarted the game and still the "Missions" button is messed up in 800x600 window from very beginning. I guess it's something wrong with refreshing text resolution in few places, because most of the text is looking good in any resolution. |
@RaptorParkowsky: can you check if this issue occurred before my commit 8baccb0? It's possible that I broke something when optimizing texture generation in text rendering. |
@piotrdz: He already said that this occurs since text rendering changes |
@piotrdz Yeah, I can confirm that occured after your fixes. I also remember that "Missions" button in main menu even long before that commit was a little strange, but possibly this is more related to UI though. This is how it was looking before on standard 800x600 window: |
@RaptorParkowsky: Just like @krzys-h , I can't reproduce it on my machine. I'll look over my code later and see what could be causing this. |
Explicitly set byte alignment in pixel transfer operations
Please check if my last commit fixes this problem.If it still occurs, then it may be a problem with using |
I managed to reproduce it again by randomly switching resolutions. @piotrdz, could you see if you can reproduce it like that? |
I've managed to "fix" my issue, but it's not the cleanest fix ever... - Math::Point texCoord1(static_cast<float>(tex.charPos.x) / FONT_TEXTURE_SIZE.x,
- static_cast<float>(tex.charPos.y) / FONT_TEXTURE_SIZE.y);
- Math::Point texCoord2(static_cast<float>(tex.charPos.x + tex.tileSize.x) / FONT_TEXTURE_SIZE.x,
- static_cast<float>(tex.charPos.y + tex.tileSize.y) / FONT_TEXTURE_SIZE.y);
+ float dx = 0.5f/FONT_TEXTURE_SIZE.x;
+ float dy = 0.5f/FONT_TEXTURE_SIZE.y;
+ Math::Point texCoord1(static_cast<float>(tex.charPos.x) / FONT_TEXTURE_SIZE.x + dx,
+ static_cast<float>(tex.charPos.y) / FONT_TEXTURE_SIZE.y + dy);
+ Math::Point texCoord2(static_cast<float>(tex.charPos.x + tex.tileSize.x) / FONT_TEXTURE_SIZE.x - dx,
+ static_cast<float>(tex.charPos.y + tex.tileSize.y) / FONT_TEXTURE_SIZE.y - dy); |
Align text rendering to character, not tile size
@krzys-h: well, with your fix I get pixelated text everywhere. |
My fix didn't even get applied in the repo (and it does not cause pixelated text for me). @piotrdz's fix made no noticeable difference at all for me |
@Davivad: which OS do you have? |
Windows 7 Home Premium x64 |
I've finally reproduced this issue by using software renderer. It should be fixed by 72f966b. |
I can't reproduce this issue anymore, although in my case there was never any text deforming, only characters from neighboring tiles being visible. |
As I suspected, the root cause of the remaining rendering artifacts is floating-point rounding. I have a very ugly fix for this which I will commit once I clean it up a little bit. |
Text rendering is now done in window coordinates corresponding to window pixels to avoid floating-point rounding errors that show up as rendering artifacts
After 71a77c7, the text looks a lot different than it used to. Additionally, underlines on links in SatCom are invisible. |
@krzys-h: I've fixed the display of highlights. It's not surprising that the text looks different because now it is actually aligned to pixel boundaries, as it should be. Previously, it was almost always rendered at some uneven pixel position and blended onto the surrounding pixels which made it look a bit thicker than it would normally be. |
This issue no longer occurs for me. |
Yup, everything seems to be fine now. |
After few changes in font rendering engine, some text looks worse than before in some resolutions.
Few examples:
The text was updated successfully, but these errors were encountered: