Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add true 1:1 pixel scaling option for optimal external upscaler compatibility #1718

Open
beike623 opened this issue Dec 12, 2024 · 8 comments

Comments

@beike623
Copy link

Is your feature request related to a problem? Please describe.

Yes - the current scaling options in Ares don't provide true 1:1 pixel mapping. The "1x" setting actually displays each original pixel as 2x2 pixels, "2x" displays as 4x4, and so on. This prevents effective use of external upscaling solutions like Magpie with ONNX filters, which work best when processing the original unscaled pixels.

Describe the solution you'd like
Add a new "Native" or "True 1x" scaling option where one pixel from the emulated system corresponds exactly to one pixel on the display in windowed mode. This would mean updating the current scaling system so that "1x" actually means 1:1 pixel mapping, with other scale factors adjusted accordingly.

Describe alternatives you've considered
Using a different external upscaler that can handle pre-scaled content, but this would likely result in lower quality output and increased procesing compared to processing the native resolution.

Manually editing window size, but this isn't practical as a long-term solution and wouldn't maintain perfect pixel mapping and often leads to downscaling artifacts due to pixel misalignment during the downscale.

Changing to 100% scale in windows display settings doesn't appear to fix the issue either.

Additional context
This feature would be particularly valuable for users who want to use external upscaling solutions like Magpie to apply high-quality scaling filters. The current scaling behavior makes it impossible to achieve optimal results since the image is already scaled before it reaches the external upscaler. True 1:1 pixel mapping would allow for the best possible image quality when using external upscaling solutions.

@Screwtapello
Copy link
Contributor

Screwtapello commented Dec 13, 2024

Here's a Game Boy game running in ares at 1x:

image

Here's a Mega Drive game running in ares at 1x:

image

Here's a WonderSwan game running in ares at 1x:

image

What emulated system are you trying to use?

@RinMaru
Copy link

RinMaru commented Dec 13, 2024

Is your feature request related to a problem? Please describe.

Yes - the current scaling options in Ares don't provide true 1:1 pixel mapping. The "1x" setting actually displays each original pixel as 2x2 pixels, "2x" displays as 4x4, and so on.

What your asking for is called Integer scaling and its already in ares.

@beike623
Copy link
Author

beike623 commented Dec 13, 2024

You're right. Those systems seem to do prop 1:1 scaling. The megadrive system, famicom and super famicom systems all do proper integer 1x scaling for me. Looking at it, I am encountering this problem with the N64 and Playstation cores specifically. I am not sure if there are other systems effected too. I am running the latest version of windows 11. Display scaling in windows is set to 100%. Graphics card is an Nvidia 4090 with the latest drivers. I have size set to 1x with integer scaling as output.

@RinMaru
Copy link

RinMaru commented Dec 13, 2024

You're right. Those systems seem to do prop 1:1 scaling. The megadrive system, famicom and super famicom systems all do proper integer 1x scaling for me. Looking at it, I am encountering this problem with the N64 and Playstation cores specifically. I am not sure if there are other systems effected too. I am running the latest version of windows 11. Display scaling in windows is set to 100%. Graphics card is an Nvidia 4090 with the latest drivers. I have size set to 1x with integer scaling as output.

Does setting size to x1 and using stretch work? Its what I use. Haven't really use shaders on other things so i dont have a good way to tell if it looks right.

@beike623
Copy link
Author

Stretch has the same behavior as integer in this case. I notice that when i open ARES and then start an N64 game. It will render at a small window size (around 220 pixels in the vertical dimension), that isn't 1:1 scaling, and resolution is clipped with what looks like nearest neighbor downscaling.
twine open
At this point scaling is set to 1x.

Then after I change the size setting to 2x and then back to 1x, i get what looks like a 2x nearest neighbor scaling of the image.
twine 1x scale

I am measuring the resolutions by basically taking a screenshot and then measuring the pixel dimensions with an image editor.

I do know that N64 has various rendering resolutions.

Low-res modes:

320x200
320x240 (most common)
320x400
320x480

High-res modes:

640x200
640x240
640x400
640x480

Could it be that parallel is internally upscaling all content to 480p prior to the ARES size scaling is processed?

@remutro
Copy link
Contributor

remutro commented Dec 13, 2024

And just to be sure, this is visible after making sure Settings > Output > Scale (Integer) is selected?
image

Or perhaps the "Pixel Perfect" option?

You may be correct that these systems due in fact function differently as they can output in different resolutions. And as some games can change resolutions, I believe ares always allocates a frame buffer for the max resolution that may be outputted even a particular game doesn't make use of it.

@beike623
Copy link
Author

Yes, I have integer selected and have also tried pixel perfect, fixed scale, best fit, and stretch. I also tried all the variations of aspect correction, adaptive sizing, and auto centering toggled on and off. I also tried switching between OGL3.2 and directx9 renderers. they all have the same behavior. It sounds like this may be more than just a simple problem of being scaled by 2x prior in error. If framebuffer allocation is fixed and not adaptive to the real N64 output per game, then adding that adaptability may take more work that I thought. It sounds like high quality downscaling with external software prior to upscaling might be the solution for now.

@FitzRoyX
Copy link
Contributor

The n64 video chip has a forced internal 2x scaler. This means that its base pixel size is double the equivalent scale of other systems. I made a PR that negated the internal scaling at odd intervals (1x, 3x, etc) and moved the hw intervals to 2x, 4x, etc. This would've done what you're expecting but it was not accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants