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
11.24k stars 2.17k forks source link

Combine bicubic upscale shaders #17294

Closed fp64 closed 1 year ago

fp64 commented 1 year ago

What should happen

Back when both shaders were introduced there was a comment:

In general having tons of effects providing similar results is just cluttering interface and makes user experience worse by adding choices which actually doesn't matter, which is why I never proposed my shader pack to be merged into PPSSPP, but also why my shader pack includes customizable options and tweaks within every shader instead of providing X versions of each similar algorithm.

This struck a note with me, because having two separate bicubic filters does feel awkward. And now that I think about it, I can just combine them into a single, configurable, shader.

Both "Bicubic (Catmull-Rom) Upscaler" and "Bicubic (Mitchell-Netravali) Upscaler" shaders are members of Mitchell-Netravali class of filters (paper), which are parametrized by a pair of coefficients B, C, so it fits fits nicely into PPSSPP's 4 shader parameters as float4 u_setting setup. Live preview (so to speak) feature of PPSSPP also should work nicely with this.

Now, this would probably be somewhat slower (disappointing, considering I introduced these as a lightweight replacement for Spline36) since you would need to calculate weight coefficients on the fly rather than hardcode them, but I expect it to be rather minor, since most of the time is probably spent on 16 texture lookups anyway.

I can do a PR (probably defaulting unified shader to Catmull-Rom), but here I'm just gathering opinions whether this is worthwhile to do at all. Do people even use these shaders (I tend to just use 1x internal + nearest filtering myself, for maximum blocky Authentic Experience™, even in 3D games)?

Who would this benefit

People who care about bicubic upscalers would be able to tune them just right, and people who don't would have one less "bicubic whatever" option cluttering the menu.

Platform (if relevant)

None

Games this would be useful in

-

Other emulators or software with a similar feature

No response

Checklist

iota97 commented 1 year ago

While I agree there a bit too many similar shader I think much depends on how much semantic meaning these coefficients have. Can you define a user friendly name for them?

In general parameters tuning is quite the opposite of UX.

fp64 commented 1 year ago

The official names for the coefficients are "B" and "C" respectively. The usual figure for visual quality is quality I think it is reasonable to vaguely call B something like "blurriness" (or similar, like "smoothness"), but it is harder to come up with a good name for C. If you follow the paper's suggestion and force B+2*C=1, then you need only one coefficient (and name for it).

In general parameters tuning is quite the opposite of UX.

I imagine only "advanced users" would be doing some tuning, and most would be ok with the default. E.g. I don't think I've seen a single case where Catmull-Rom didn't look straight-up better between the two current bicubic shaders on a PSP game (but, of course, "look better" is subjective, and I have only one data point that's not my own (that one is in texture upscaling topic, but the filters are the same)). It is sharper, and while it is supposed to have more ringing, it never seemed problematic. So having tunable coefficients would be more like a "bonus"/"escape hatch" for the default shader.

iota97 commented 1 year ago

I wouldn't mind a single parameter for 1-B called "sharpness". Blurriness make me feel like some user would just set it to 0 'cuz he don't want blurriness :)

Anyway I don't have a really strong opinion on this.

fp64 commented 1 year ago

Can be closed now.