Bad quality after scale

Anything libgdx related goes here!

Bad quality after scale

Postby xpdt » Tue Dec 31, 2019 11:53 pm

I have a big image in my game. When I scale it down to 0.25 ، Quality gets bad.
In the picture below you can see the top hat was resized in libgdx and the bottom hat in Photoshop.

https://imgur.com/hmFGzM0

Tested with Linear and Nearest
Last edited by xpdt on Wed Jan 01, 2020 12:01 am, edited 1 time in total.
xpdt
 
Posts: 88
Joined: Mon Jul 04, 2016 2:29 am

Re: Bad quality after scale

Postby shatterblast » Wed Jan 01, 2020 5:19 am

You can usually scale about 50% without much of an issue. Past that, math gets funky for about any platform or device. Even advanced video cards struggle with this, unless it's specifically designed for graphics production.

You might consider using two different Texture objects with one as half the size of the other. Krita can accurately scale down such an image for you if you save it as a PNG file to begin with. Just replace one with the other when you reach the exact 50% mark in the same cycle of the render() method.

Stuff, like Linear and Nearest, are meant for quick math. Sometimes, blur or bloom effects hide the graininess of those zoom problems with little slow down on performance. Still, they are meant to make things prettier with little cost, not fix everything.

You might find the below code helpful in addition to whatever else you do.
1) https://github.com/manuelbua/libgdx-con ... processing
shatterblast
 
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm

Re: Bad quality after scale

Postby Magnesus » Wed Jan 01, 2020 9:22 am

xpdt wrote:I have a big image in my game. When I scale it down to 0.25 ، Quality gets bad.
In the picture below you can see the top hat was resized in libgdx and the bottom hat in Photoshop.

https://imgur.com/hmFGzM0

Tested with Linear and Nearest


I doesn't look that bad, especially on different background the jagged edges will most likely disappear. Linear is not state of the art scaling (Photoshop is most likely using something much better), so don't expect miracles. You can try downscaling your source image a bit to avoid that big of a jump in scale as shutterblast suggested.
Magnesus
 
Posts: 1709
Joined: Sun Sep 25, 2011 3:50 pm

Re: Bad quality after scale

Postby xpdt » Wed Jan 01, 2020 8:49 pm

shatterblast wrote:You can usually scale about 50% without much of an issue.

Thanks for explaining it perfectly. You right.
The problem was almost solved.
xpdt
 
Posts: 88
Joined: Mon Jul 04, 2016 2:29 am

Re: Bad quality after scale

Postby shatterblast » Thu Jan 09, 2020 2:37 pm

It's still going to be bad quality past 50%. You can experiment with Krita, GIMP, or Photoshop if you want proof.
shatterblast
 
Posts: 653
Joined: Sun Jul 06, 2014 1:14 pm


Return to Libgdx

Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest