ImGui.NET icon indicating copy to clipboard operation
ImGui.NET copied to clipboard

My font quality is very low

Open GoncaloRod opened this issue 5 years ago • 11 comments

I'm trying to use ImGui.NET with MonoGame but in my project the font quality is very low as you can see on the picture. image My ImGuiRenderer class is the exact same class as the one on the sample project. I also ran the sample project separately and everything is fine there.

GoncaloRod avatar Apr 03 '20 11:04 GoncaloRod

That happened to me once, long time ago, basically Nvidia wasn’t Rendering the application intel built-in was. Can you go to Nvidia preference and force this application to use Nvidia dedicated graphic card rather than built-in intel graphic.

zaafar avatar Apr 03 '20 19:04 zaafar

It would be a strong possibility but I'm using a desktop with Nvidia only graphics so that's not my issue. Thank you anyways!

GoncaloRod avatar Apr 03 '20 19:04 GoncaloRod

Just to clarify: the (XNA) example project in here works fine for you? If that's the case, then perhaps your project is setting some global graphics state that is affecting how ImGui is rendered? It might be a good idea to take other components out of your project and see if that has any effect, and then try adding things back one-by-one.

mellinoe avatar Apr 04 '20 01:04 mellinoe

That didn't work. I also tried to create a band new project and it didn't work too.

GoncaloRod avatar Apr 04 '20 09:04 GoncaloRod

I'm sure it's not a bug of Imgui.net, and more somewhere else, but I have the exact same issue in my Monogame app:

Image

This happens on my desktop with a GTX 1080, and on my laptop it only happens when I use my RTX 2060 in it. If it uses the Intel IGPU rendering works fine. So it seems like something I'm doing and the original poster is doing is messing up with the rendering (or the font aliasing?).

KallDrexx avatar Jun 06 '20 19:06 KallDrexx

If anyone is curious I have mostly tracked this down (though it's not perfect).

This seems to occur for me when on Nvidia GPUs (maybe AMD? I don't have one to test) when the GPU's samplerStates[0] is using point filtering, which the engine I'm using is using. In order to fix it my ImGui's render method now looks like:

            var oldSamplerState = _game.GraphicsDevice.SamplerStates[0];
            _game.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp;

            var gameTime = TimeManager.CurrentTime;
            _renderer.BeforeLayout(gameTime);
            // Iterate through imgui controls/windows and render them
            _renderer.AfterLayout();

            _game.GraphicsDevice.SamplerStates[0] = oldSamplerState;

The text is a bit fuzzy (especially compared to the imgui.net monogame demo) but it's getting closer at least.

KallDrexx avatar Jun 07 '20 01:06 KallDrexx

Using the same trick, but using PointClamp instead. The result is only good with some fonts at some size, but at least it's descent now

monsieurmax avatar Jun 07 '20 20:06 monsieurmax

I finally figured out the true cause of this, and then realized this was already figured out in another issue.

See #97, Essentially make your MonoGame ImGui renderer have an offset of 0 instead of 0.5 (though MG 3.8 might be required for this to be universally fixed). This makes all text crystal clear for me.

KallDrexx avatar Nov 28 '20 17:11 KallDrexx

It's not just the font that's a problem, I always knew ImGui as a pixel perfect UI but something is wrong now ShareX_XAbpXWvoqo Some characters are just wrong too, look at the "m" in sampler or frame, some other characters seem off as well.

None of these problems are in the Sample Project, only external projects. *In my situation It's Terraria which uses the normal XNA libraries, not MonoGame.

Man, how did you integrated ImGUI into Terraria? I've tried but have been problems with .NET Framework 4.5 (for Terraria) and the fact that ImGUI is using .NET Standart 2.0

DiaDeTedio avatar Sep 27 '21 22:09 DiaDeTedio

Man, how did you integrated ImGUI into Terraria? I've tried but have been problems with .NET Framework 4.5 (for Terraria) and the fact that ImGUI is using .NET Standart 2.0

Not the place to ask, dm me on Discord Kyle#0420

Hi-ImKyle avatar Sep 27 '21 23:09 Hi-ImKyle