Question ImGui unclean outline

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

C5iV363KQZRj

Trump Tier Donator
Sep 11, 2020
15
343
1
Game Name
GTA5
Anticheat
R*
How long you been coding/hacking?
5Y | 1Y
Coding Language
C# | C++
Hey guys,

I have been trying to fix my ESP font for the past few days and I still haven't found a fix for it. I'm using FreeType already, but that didn't really change much?

The outline looks very unclean and I have no idea why:





Code (ImGui sadly still doesn't have a built-in Textoutline function so yea... I'm pretty sure that you could do it with 2 black text draws(top left, bottom right), but that looks even worse:

InitializeFonts():
C++:
auto& io = ImGui::GetIO();

menu_font = io.Fonts->AddFontFromMemoryTTF((void*)Arimo_Regular_ttf, sizeof Arimo_Regular_ttf, 18.0f, nullptr, io.Fonts->GetGlyphRangesCyrillic());
small_render_font = io.Fonts->AddFontFromMemoryTTF((void*)Arimo_Regular_ttf, sizeof Arimo_Regular_ttf, 12.0f, nullptr, io.Fonts->GetGlyphRangesCyrillic());
middle_render_font = io.Fonts->AddFontFromMemoryTTF((void*)Arimo_Regular_ttf, sizeof Arimo_Regular_ttf, 14.0f, nullptr, io.Fonts->GetGlyphRangesCyrillic());
big_render_font = io.Fonts->AddFontFromMemoryTTF((void*)Arimo_Regular_ttf, sizeof Arimo_Regular_ttf, 16.0f, nullptr, io.Fonts->GetGlyphRangesCyrillic());

io.Fonts->TexGlyphPadding = 1;
for (auto n = 0; n < io.Fonts->ConfigData.Size; n++)
{
    auto* const font_config = static_cast<ImFontConfig*>(&io.Fonts->ConfigData[n]);
    font_config->RasterizerMultiply = 1.5f;
    font_config->RasterizerFlags = 0;
}

ImGuiFreeType::BuildFontAtlas(io.Fonts, 0);
AddText():
C++:
window->DrawList->PushTextureID(pFont->ContainerAtlas->TexID);

window->DrawList->AddText(pFont, pFont->FontSize, ImVec2(pos.x + 1, pos.y + 1), IM_COL32_BLACK, text.c_str());
window->DrawList->AddText(pFont, pFont->FontSize, ImVec2(pos.x - 1, pos.y - 1), IM_COL32_BLACK, text.c_str());
window->DrawList->AddText(pFont, pFont->FontSize, ImVec2(pos.x + 1, pos.y - 1), IM_COL32_BLACK, text.c_str());
window->DrawList->AddText(pFont, pFont->FontSize, ImVec2(pos.x - 1, pos.y + 1), IM_COL32_BLACK, text.c_str());

window->DrawList->AddText(pFont, pFont->FontSize, ImVec2(pos.x, pos.y), col_text, text.c_str());

window->DrawList->PopTextureID();
Any idea what I could be doing wrong?
 

Kleon742

Feature Enthusiast
Dank Tier VIP
Dank Tier Donator
Sep 2, 2018
357
16,058
42
That's anti-aliasing. IMGUI uses some sort of default AA, and you can't really turn it off easily.
You could fuck around with it but I guess documentation reading isn't worth your time for this small issue.
Imgui uses stb_truetype.h to rasterize fonts that uses AA.
This technique and implementation are not ideal for fonts rendered at small sizes, which may appear a little blurry. There is an implementation of the ImFontAtlas builder using FreeType that you can use:
ocornut/imgui_club
That's all I can tell to you for now. I hope it helps.
 
  • Like
Reactions: omegaweapontmod

omegaweapontmod

I Know Nothing
Trump Tier Donator
Dank Tier Donator
Nobleman
Aug 21, 2020
86
1,323
2
That's anti-aliasing. IMGUI uses some sort of default AA, and you can't really turn it off easily.
You could fuck around with it but I guess documentation reading isn't worth your time for this small issue.
Imgui uses stb_truetype.h to rasterize fonts that uses AA.

That's all I can tell to you for now. I hope it helps.
I second this. Disabling AA fixed this issue for me as well.
 

C5iV363KQZRj

Trump Tier Donator
Sep 11, 2020
15
343
1
That's anti-aliasing. IMGUI uses some sort of default AA, and you can't really turn it off easily.
You could fuck around with it but I guess documentation reading isn't worth your time for this small issue.
Imgui uses stb_truetype.h to rasterize fonts that uses AA.

That's all I can tell to you for now. I hope it helps.
I second this. Disabling AA fixed this issue for me as well.
Well the thing is I'm already using freetype like I stated above, I will try to mess a bit with the font flags, there are probably some default font flags that are set wrong.
 

C5iV363KQZRj

Trump Tier Donator
Sep 11, 2020
15
343
1
Haven't found a good solution for this, the issue is that there are not enough pixels to create a outline with just 4 calls in all diagonal directions. A fix would be to add the other 4 directions, but that would be 8 text calls for the outline and 1 for the actual text so 9 in total. I tested it a bit and the outline was as expected, the performance wasn't affected that much, but I have a pretty decent computer and it just sounds wrong.

I will probably just switch it to dropshadow, can't really think of any other solution besides rending the font bigger or switching the font.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods