SourMesen / Mesen-S

Mesen-S is a cross-platform (Windows & Linux) SNES emulator built in C++ and C#
GNU General Public License v3.0
414 stars 102 forks source link

Bilinear Interpolation issue #24

Open victordg-github opened 5 years ago

victordg-github commented 5 years ago

Hi SourMesen,

Thanks again for this great piece of software, it's becoming my first choice for SNES emulation.

I found something strange when using Bilinear Interpolation and certain games that use Hi-Res. Most noticeable on Seiken Densetsu 3 / Trials of Mana. The filter is much better (clearer) when there is a dialog displaying on screen, however when there is no text, the image turns noticeably blurrier. It is a bit annoying during dialog scenes, you can notice the change in between characters speaking. I suppose this kind of issues might pass unnoticed to some people, but if you try full screen I think it's easier to see.

I'm using Linux x64, and it's happening in both the Libretro core and the UI builds, compiled from source.

victordg-github commented 5 years ago

Just a side note, I've tested the same with other emulators, in case it helps: snes9x 1.60 - Same behavior as Mesen-S bsnes 108.5 - Not happening, bilinear filter applied but does not get blurrier after dialogs.

Both emulators compiled from the latest available source today

SourMesen commented 5 years ago

This is essentially normal - Seiken Densetsu 3 turns on high resolution display for a few lines in the middle of the screen when text is shown, and then turns it off. This causes the emulator to switch from 256x224 output to 512x448 instead (by scaling using nearest neighbor), then the bilinear filter is applied (by the graphic card) on the 512x448 picture, which makes it look less blurry than when it's applied to the 256x224 picture.

It's not ideal, but hard to avoid - bsnes always outputs at 512x448, I think, which is why the bilinear filter is consistent, but doing this has a negative impact on video filters (e.g what is described in #5)

victordg-github commented 5 years ago

Thanks for the explanation, I thought it might be due to that. It's a pity for Seiken Densetsu 3, I'm not sure if many other games do the same resolution switch. Perhaps some idea, what if output resolution can be adjusted based on game, or configured manually?

In any case, thanks so much for your time to answer

Awakened0 commented 5 years ago

You can see with a CRT shader that the scanlines get squished and end up a little uneven in Mesen-S libretro's hires mode compared to snes9x libretro: http://www.framecompare.com/image-compare/screenshotcomparison/DLY6WNNX

Makes me wonder if snes9x isn't outputting a higher vertical res; just the horizontal. So, like 512x224? It doesn't seem to be losing any high res detail if it is.

SourMesen commented 5 years ago

Super late, but re: snes9x, that's very likely. The windows version outputs 224px at all times unless you turn on a separate option to "extend" the viewport (essentially identical to the overscan settings in mesen-s). The CRT shader might produce a different output in mesen-s too if you change the overscan setting?

Awakened0 commented 5 years ago

Changing vertical or horizontal overscan in Mesen-S doesn't seem to affect the size of the scanlines or mask. Trials of Mana's "New Game" screen has scanlines that are half as thick as they are in snes9x or bsnes (the new upstreamed core). You said Mesen-S outputs high res mode at 512x448, so that would make sense. But after doing some Googling, it sounds like games like Trials of Mana and Kirby's Dreamland 3 should be using the SNES' 512x224 mode like they do in the other emulators.

SourMesen commented 5 years ago

Ah, that makes a lot of sense. Had a similar issue in Mesen in the past where the NTSC filter was doubling the horizontal & vertical resolutions whereas it only doubled the horizontal resolution in the nestopia core, which caused some discrepancies.

The core/emulator currently either outputs in 256x239 or 512x478, I'll have to see how easily I can make it output in 512x239 when interlace mode isn't turned on/etc.

Awakened0 commented 4 years ago

This issue should be renamed to something like "Support 512x239 Pseudo-High Res Mode Output".