Skip to content
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

Question - Trilinear image scaling (ImGui)... how? #511

Open
mherbold opened this issue May 23, 2023 · 3 comments
Open

Question - Trilinear image scaling (ImGui)... how? #511

mherbold opened this issue May 23, 2023 · 3 comments

Comments

@mherbold
Copy link

Background - I am using C# with ImGui.NET latest version 1.89.5 with Veldrid.ImGui latest version 4.9.0. Veldrid is configured to use DX11 only.

Everything I am doing is working beautifully (I am making an app called iRacing-TV). My only issue is the quality of images when I draw them scaled down, it looks like it's using point sampling and looks pretty terrible.

Basically what I am doing is -

ImGui.SetCursorPos( imagePosition );
ImGui.Image( textureId, imageSize, Vector2.Zero, Vector2.One, Vector4.One );

It works but if I scale imageSize down so it's smaller than the original image size, it looks like it is using point sampling (jagged edges, etc.). As far as I can tell the image texture has been generated with mipmaps, and I want it to be using trilinear filtering to scale images. How do I do this? What am I missing? What should I be checking? What information do you need from me to help me out?

@mherbold
Copy link
Author

Seems like the root issue is this -

https://github.com/veldrid/veldrid/blob/master/src/Veldrid.ImGui/ImGuiRenderer.cs#L156

It is specifying point sampling. The folks over at ImGui says this should really be set up for trilinear filtering. Is there something I am missing? Some call I should be making to make this use trilinear filtering?

@zaafar
Copy link
Contributor

zaafar commented May 24, 2023

last time i talked to owner, it was due to this: ImGuiNET/ImGui.NET#261

@mherbold
Copy link
Author

Right - what I just did was I clone this Veldrid project, and modified ImGuiRenderer.cs to use gd.LinearSampler on line 158 instead of point sampling, and poof all my problems went away, and everything is beautiful now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants