hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
10.8k stars 2.12k forks source link

sharp linear screen scaling #19307

Open SpelzR2 opened 1 week ago

SpelzR2 commented 1 week ago

What should happen

Is there a chance to provide an 'sharp linear' screen scaling option in addition to the existing scaling methods (nearest & linear) in the standalone PPSSPP emulator? With nearest there is always the chance for uneven pixels without integer scaling, which in return can make the picture to small on specific devices and screens. With sharp linear the picture isn't as blurry as with linear scaling and the chance for uneven pixels is reduced. There is a shader available (Video Smoothing AA) which could help with nearest scaling, but it isn't suitable for low-end devices and ends with worse performance. I've uploaded some examples with native resolution using the RetroArch core.

linear scaling: linear

nearest scaling: nearest

sharp linear scaling (using the "sharp-bilinear" shader in RetroArch): sharp bilinear

Who would this benefit

Platform (if relevant)

None

Games this would be useful in

any game

Other emulators or software with a similar feature

Duckstation or PCSX2 offer sharp bilinear scaling in addition to the other methods. Using PPSSPP in RetroArch also gives an option to use sharp linear scaling as a shader.

Checklist

LunaMoo commented 1 week ago

So you'd basically want https://github.com/rsn8887/Sharp-Bilinear-Shaders/blob/master/Copy_To_RetroPie/shaders/sharp-bilinear-simple.glsl through probably simpler to just redo from 0 as it would probably have to work differently. Heck if I understand what it does, it would be enough to just make a simple nearest integer scaling shader and then leave it like that with auto or linear filtering.

Pretty much the same result can be done by just using higher rendering res + any blurry filtering, however there's a reason to have nearest scaling filter separately from render res due to bugs in many 2D games when increasing render res.

anr2me commented 6 days ago

using higher rendering res + any blurry filtering

This is not suitable for low-end devices isn't?

SpelzR2 commented 6 days ago

So you'd basically want https://github.com/rsn8887/Sharp-Bilinear-Shaders/blob/master/Copy_To_RetroPie/shaders/sharp-bilinear-simple.glsl through probably simpler to just redo from 0 as it would probably have to work differently. Heck if I understand what it does, it would be enough to just make a simple nearest integer scaling shader and then leave it like that with auto or linear filtering.

I don't know whether a shader like this suits for a better for performance or whatever kind of processing the scaling methods of PCSX2 or Duckstation are doing. You are right, the sharp-linear scaling is basically an Integer Scaler which ups the resolution to it's highest possible value (depending on the devices' screen) and then scales the "rest" up with linear scaling. For an 800p device it would double the psp resolution 480x272 to 960x544 with nearest scaling and then do linear scaling from 960x544 to 1280x800. This way the picture isn't as sharp as nearest scaling from 480x272 to 1280x800 but avoids uneven pixels.

Pretty much the same result can be done by just using higher rendering res + any blurry filtering, ...

Increasing the resolution decreases performance. Scaling the picture up while staying on it's native resolution shouldn't decrease performance that much (in theory).