PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.8k stars 1.63k forks source link

[Feature Request]: Aspect ratio heuristics #6442

Closed ichee closed 1 year ago

ichee commented 2 years ago

Description

Add heuristics for auto switching aspect ratios between 4:3/3:2 and 16:9 when ratio changes in-game.

5810 and #6440 may prep some of the groundwork needed for this request.

Reason

Improved user experience (and less tinkering with defaults).

Examples

Maybe something similar to the Dolphin emu implementation (possibly others I’m unaware of).

refractionpcsx2 commented 2 years ago

What heuristics could be use? the 16:9 is simply from the existence of a patch (ingame widescreen modes present themselves the same way as ~4:3 modes), the 3:2 option is because 480p mode is wider so the assumption is made that 3:2 is better, but surely it can vary per game? while the only resolution that is output for standard games is 640x480(or 448 NTSC), we have nothing else to go on.

While it would be nice to get the aspect ratios correct, I'm just not sure how we'd even achieve it... And I can put money on the fact, if we get it right, somebody will complain it's wrong.

ichee commented 2 years ago

This is more for when setting the aspect ratio in supported games to 16:9 or 4:3 via in-game options, or when enabling progressive scan via holding triangle and x during startup and selecting which progressive aspect there, not so much for the so called ‘pixel perfect’ aspect, though it could benefit.

Dolphin has similar heuristics for the same purpose, though I don’t know if the output resolution of supported games changes when either are set.

And with regard to those who would complain it’s wrong, I say ignore them as best you can, since that will likely never stop. No reason for unnecessary perfectionism to hinder progress.

refractionpcsx2 commented 2 years ago

well selecting 16:9 ingame is never happening, sorry. The detection will have to change for every game and that's not something I want to maintain (the game still outputs in 640x480 if it's widescreen or not). and right now it auto switches 4:3 and 3:2 when going progressive, since that is a separate mode.

The only time I could make widescreen work is for games like GT4 where they use 1080i mode and that CAN be detected. But then again it would be GT4 and like, 1 other game.. lol

ichee commented 2 years ago

How about when the progressive flag is set?

I don’t think there are too many games that support progressive scan but not 16:9, though that would still leave out the games that support 16:9 but not progressive.

Just something to consider at some point if an easier way can make this work out.

I can already set per-game overrides in QT for games that are 16:9. Just would nice if that were not necessary.

No worries if this isn’t easily doable for the foreseeable future.

And, try not to stress too much over users complaining 😀, I’m guessing #6417 is the most recent incident.

Also, please continue the great work you and all the other devs are doing.

Thanks.

refractionpcsx2 commented 2 years ago

As I said, 16:9 is not happening for most games (only GT4 and like 1 other), there is no heuristic that I know of. Progressive scan already switches if you have it set to "Auto 4:3/3:2" globally

ichee commented 2 years ago

I think maybe there is a misunderstanding.

I was referring to the current Auto aspect setting changing to 16:9 when, or if, detected.

Basically, automatically stretching to 16:9, not directly altering the pixel aspect ratio.

The current Auto setting does not set 16:9 or stretching when widescreen is enabled in supported games or the progressive flag is set. That still requires manually changing aspect from ‘Auto Standard’ to ‘16:9’ or ‘Stretch to Window’.

Whether that can be ascertained by pixel width or detectable compression, since many games simply compress horizontally when set to 16:9, is more or less what I meant by ‘heuristics’.

I know ‘screen offsets’ can detect enough changes to allow for screen position adjustments in supported games, so I thought with that option in conjunction with pr6440 there may be enough to attempt to auto set 16:9.

refractionpcsx2 commented 2 years ago

I think there is a misunderstanding, you're not understanding what I'm saying :)

Widescreen switch:

  1. You put game in 16:9
  2. You want us to auto switch to 16:9

My Response: What I'm saying is we can't there is zero/none/absolutely nothing that we can detect for this. If the game is in widescreen or 4:3, the resolution it outputs is the same, there is no way to detect this. The only chance we have is if the game happens to draw in the widescreen resolution then squash it down, but idk if we can detect that or not, or if games even do that.

480p progressive switch:

  1. You put a game in progressive
  2. You want us to switch to 3:2

My Response: We already do.

ichee commented 2 years ago

Okay.

If a game is set to 16:9, without any changes to pcsx2’s default, then visually the image appears horizontally compressed, or vertically stretched.

If the output resolution is the same regardless, eg. 640x480 640x448 or whatever other combinations there may be, then what I’m saying is since the resolution can’t be used in this instance to determine an aspect change, then can the visibly altered pixel width be used to detect it?

With regard to the automatic 3:2 switch, if that is always the aspect of progressive output, then can it be used to set the assumed 16:9 aspect that is implied, barring any games that may set progressive but don’t support widescreen?

I know this may seem a bit heated, but I’m legitimately trying to get a handle on if this can be doable under any viable circumstances.

I’m not trying to be intentionally argumentative, just trying to understand.

refractionpcsx2 commented 2 years ago

The resolution isn't changing, there's no way to detect it's vertically stretched/horizontally compressed, the resolution is the same as if it wasn't set to widescreen in the game, nothing has changed, the emulator doesn't know how a game should look, it's not running the latest AI or anything,.. lol

ichee commented 2 years ago

Then if I may, how or what process is involved to allow for this detection in Dolphin?

I’d assume that since it’s from the same generation of consoles that the behavior there is largely the same as here.

If so, then what method is used there to allow for, at least mostly, proper detection of aspect changes?

Maybe @stenzek may know more, since they have experience with Dolphin devolpment.

refractionpcsx2 commented 2 years ago

maybe, but remember the gamecube is a different system, it could work completely differently.

The only chance I think we have is if it copied a wide texture (like a widescreen drawing) in to the squashed framebuffer, that's our only hope of detecting widescreen, I guess...

stenzek commented 2 years ago

General wide screen hack isn't possible in pcsx2 because there's no projection matrix to fudge, unlike GC.

As refraction said there's no way to detect when a game is rendering in widescreen other than what we already have, i.e. patch based detection.

ichee commented 2 years ago

Since there’s no way to do this currently, then should we close this, or just leave it open in case someone finds a way to make this work in the future?

refractionpcsx2 commented 2 years ago

it can still be applied to 1080i mode, so i guess we can relate it to that..

lightningterror commented 1 year ago

Closing as not planned.