Search code examples
libgdxviewportscalingstage

Libgdx very bad quality of scaled down stage


I am doing my very first libgdx game, and I have a problem with the scaling quality. I created a new class that implements the Screen interface.

I programmed everything on that screen as if it was always to run on a 1080x1920 resolution, and then I used the FitViewport which I added to the Stage.

It works, but the scaling quality is very bad. I understand that it may happen if a graphic is being scaled up to a larger resolution, but the quality is also horrible on lower resolutions.

E.g. here is my ImageButton drawn by a Stage on a 1080x1920 device:

https://i.sstatic.net/2STXy.png

And here is how it looks on about 800x480:

https://i.sstatic.net/058qo.png

As you can see, the quality is just bad. Since it's scaled down, I would expect it to be much smoother.

I googled a bit and found this post: LibGDX - How to smooth out actor drawable when scaling a Scene2d stage?.

It is recommending to use setFilter(TextureFilter.Linear, TextureFilter.Linear); method on a Texture I want to smooth out, but the problem is that I don't have any textures. I only have a FitViewport, Stage, Skin (loading atlas file), and ImageButton actors.

How can I make the scaling quality better?


Solution

  • The filter type is saved in the .atlas file. You can open the file and change the line "filter: Nearest,Nearest" to "filter: Linear,Linear".