OpenGL Pixel perfect scaling... isn't?

Ask for help with ScummVM problems

Moderator: ScummVM Team

tomexplodes
Posts: 19
Joined: Mon Mar 14, 2016 4:48 am

OpenGL Pixel perfect scaling... isn't?

Post by tomexplodes »

Comparing, as an example, Gold Rush! in both Dosbox ECE with openglpp scaling and ScummVM with the same, there's this:
DOSBOX
[img]https://i.imgur.com/xnLnI9q.png[/img]
ScummVM
[img]https://i.imgur.com/Wh9yL5L.png[/img]
yes, it's subtle, but my eyes can't un-see it. The text is just slightly off in places in the bottom, ScummVM picture. It's like the pixels aren't exactly square.

I have it set to OpenGL, Pixel-perfect scaling, fullscreen, with aspect ratio correction turned on.

Can I do something to fix this? Or should this be a bug report?

edit: apparently I can't post images, so I guess you'll have to click on them, sorry about that.
User avatar
Raziel
ScummVM Porter
Posts: 1513
Joined: Tue Oct 25, 2005 8:27 am
Location: a dying planet

Re: OpenGL Pixel perfect scaling... isn't?

Post by Raziel »

Just do [ img=http://address ][ /img ] (without the spaces)

Image

Image
User avatar
criezy
ScummVM Developer
Posts: 947
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: OpenGL Pixel perfect scaling... isn't?

Post by criezy »

One thing to keep in mind is that the aspect ratio correction stretches the image vertically to go from an original resolution of 320x200 pixels to a multiple of 320x240. If your window size is 320x240 for example, 1 pixel every 5 pixels is repeated, and if your window size is 640x480, 2 pixels every 5 pixels are repeated. To get perfectly homogeneous pixels (where all the pixels from the original image are duplicated the same amount of times) you would need to select a window size to get a scaling of 5 horizontally and 6 vertically, so a resolution of 1600x1200 (or if you have a huge screen you could double that to 3200x2400).
tomexplodes
Posts: 19
Joined: Mon Mar 14, 2016 4:48 am

Re: OpenGL Pixel perfect scaling... isn't?

Post by tomexplodes »

I'm trying to play in fullscreen, though, and I don't know how to set a custom resolution. Also, like I say, for whatever reason the DOSBox ECE scaler can do it no problem. My resolution is 1920x1080. If that matters/helps. Like I say, if there's a way to set a custom resolution in fullscreen, that would help! I've also tried the normal 4x scaler but the results are similar if not exactly the same. I'm not trying to be Mr. Complainer here, I'm just a stickler for perfectly square, sharp pixels in my old games haha. Also, I know I can just play these games in DOSBox but I like ScummVM! There're no cycles to mess about with etc. I have a windows 98 machine and a DOS machine that I built and a 15 inch CRT, but I like playing on my modern laptop because it's a laptop and I don't have to go sit at a desk.

EDIT: Also it does the same thing if I turn off fullscreen and let it play in a window.
and if I fit to screen instead of pixel perfect.

okay one more edit

The issue is not with the scaler, the issue (as I think you said) is definitely with aspect ratio correction. If I run it centered, so it's tiny, I can still see garbled fonts if I lean in close. Again, if that helps figure out how to solve this. I'd prefer not to play without aspect ratio correction, because then it looks squashed
User avatar
MusicallyInspired
Posts: 1136
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

Re: OpenGL Pixel perfect scaling... isn't?

Post by MusicallyInspired »

The DOSBox one is slightly off as well, but not as noticeably as ScummVM's. Both are attempting to compensate by blurring the lines a little, DOSBox's method seems more convincing but both are flawed. You're just not going to get pixel-perfect scaling unless you have a resolution of 1600x1200 (on the monitor itself, not just the game). Anything less is going to have fractional resolution values which need to be rounded to integers (whole numbers). 1600x1200 is the minimum resolution on a non-CRT monitor that can display tall pixels accurately and correctly. Anything lower will implement pixel doubling or anti-aliasing effects.
tomexplodes
Posts: 19
Joined: Mon Mar 14, 2016 4:48 am

Re: OpenGL Pixel perfect scaling... isn't?

Post by tomexplodes »

[quote=MusicallyInspired post_id=95479 time=1622575676 user_id=5846]
The DOSBox one is slightly off as well, but not as noticeably as ScummVM's. Both are attempting to compensate by blurring the lines a little, DOSBox's method seems more convincing but both are flawed. You're just not going to get pixel-perfect scaling unless you have a resolution of 1600x1200 (on the monitor itself, not just the game). Anything less is going to have fractional resolution values which need to be rounded to integers (whole numbers). 1600x1200 is the minimum resolution on a non-CRT monitor that can display tall pixels accurately and correctly. Anything lower will implement pixel doubling or anti-aliasing effects.
[/quote]

That may be, but neither one looks blurred in actual play. Also, all the As are the same size and shape with the same number of pixels in the DOSBox method, all the Ss etc, and this isn't the case in ScummVM. The holes in some of the As are different sizes, the tops or bottoms of some letters are off by half in some places, and again there's nothing like that in the DOSBox scaler.

Also, HI MI ! nice to see you again, haven't seen you since the AGDI forums.

EDIT: And yeah, I plugged into my 4k TV and set the res to 3200x1800 and now things look square. So thank you!

though incidentally, since that's a multiple of 800x600 I have no idea why it works
User avatar
KainXVIII
Posts: 79
Joined: Mon Feb 11, 2008 10:00 pm
Location: Russia

Re: OpenGL Pixel perfect scaling... isn't?

Post by KainXVIII »

Thing is - that Dosbox has true perfect integer scaling (not in ECE build anymore), yes, it will have black bars, but with homogenous pixels. Unlike ScummVM where you get black bars AND uneven pixels even with so-called pixel-perfect scaling.
Also with Dosbox you can use pixel shaders to get full-screen image without black bars (but with slight blur) and homogenous pixels (https://github.com/tyrells/dosbox-svn-shaders)
User avatar
criezy
ScummVM Developer
Posts: 947
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: OpenGL Pixel perfect scaling... isn't?

Post by criezy »

I looked at the two image, and apparently Dosbox stretches a bit the image vertically to get even pixels. Instead of giving a 320x240 ratio (or 4:3 ratio), which is what ScummVM aspect ratio correction provides, Dosbox seems to allow some leeway on the aspect ratio, and in this case the image has a 320x250 ratio (and thus is not exactly 4:3). This way it can repeat all the pixels 5 times vertically instead of having 4/5th of the pixels repeated 5 times and the remaining 1/5th repeated 4 times. This seems like an interesting compromise that could be also implemented in ScummVM.
tomexplodes
Posts: 19
Joined: Mon Mar 14, 2016 4:48 am

Re: OpenGL Pixel perfect scaling... isn't?

Post by tomexplodes »

[quote=criezy post_id=95483 time=1622589243 user_id=3546]
I looked at the two image, and apparently Dosbox stretches a bit the image vertically to get even pixels. Instead of giving a 320x240 ratio (or 4:3 ratio), which is what ScummVM aspect ratio correction provides, Dosbox seems to allow some leeway on the aspect ratio, and in this case the image has a 320x250 ratio (and thus is not exactly 4:3). This way it can repeat all the pixels 5 times vertically instead of having 4/5th of the pixels repeated 5 times and the remaining 1/5th repeated 4 times. This seems like an interesting compromise that could be also implemented in ScummVM.
[/quote]

That would be amazing! I hope it's not too hard to implement!

EDIT: And just for fun, I also set my resolution to 1600x900, which DOESN'T give square pixels, though 3200x1800 for some unknown reason DOES. I'm just thinking out loud now, it's just weird.
User avatar
MusicallyInspired
Posts: 1136
Joined: Fri Mar 02, 2007 8:03 am
Location: Manitoba, Canada
Contact:

Re: OpenGL Pixel perfect scaling... isn't?

Post by MusicallyInspired »

Good to see you!.....I'm sorry I don't remember you though lol. Did you go by a different handle? It has been so long.
Kirtai
Posts: 13
Joined: Sat Apr 10, 2021 10:00 pm

Re: OpenGL Pixel perfect scaling... isn't?

Post by Kirtai »

DOSBox Staging has pixel perfect scaling so it may be a better thing to look at for inspiration.
User avatar
KainXVIII
Posts: 79
Joined: Mon Feb 11, 2008 10:00 pm
Location: Russia

Re: OpenGL Pixel perfect scaling... isn't?

Post by KainXVIII »

Yeah, it will be ideal, because right now pixel-perfect scaling in ScummVM will give this results - https://abload.de/img/conquestsofcamelot_kic6kh1.png (every fifth (?) row of pixels is narrower, which is very noticeable in games with heavy dithering :| )
For comparison Dosbox Staging with pixel-perfect render - https://abload.de/img/sciv-3000cycles_ms-dowskq3.png
Maybe useful info from console

Code: Select all

MAIN: Draw resolution: 320x200, double-width, double-height, pixel aspect ratio: 1.20
MAIN: Pixel-perfect scaling (4x5): 320x200 (PAR 1.20) -> 1280x1000 (PAR 1.25)
And Dosbox with "pixellate shader" - https://abload.de/img/dosboxecer4452cpuspeedojb2.png
tomexplodes
Posts: 19
Joined: Mon Mar 14, 2016 4:48 am

Re: OpenGL Pixel perfect scaling... isn't?

Post by tomexplodes »

Yeah I use a very specific older build of Dosbox ECE that allows surfacepp and openglpp scaling, which is where my first screenshot is from. I can't remember the version number anymore, I have a folder saved on my computer. It's not hard to find if you go looking for it, I don't think.
User avatar
criezy
ScummVM Developer
Posts: 947
Joined: Sat Sep 23, 2006 10:41 am
Location: West Sussex, UK

Re: OpenGL Pixel perfect scaling... isn't?

Post by criezy »

I have some code that works: https://github.com/scummvm/scummvm/pull/3040
But it has not landed yet in the official ScummVM. As noted in the pull request linked above, I am not sure if the new pixel perfect scaling should replace the old one or if we want both (I think we might want both as some players may prefer to have the exact expected aspect ratio). And I am struggling to find descriptive names for both. So if you have suggestions don't hesitate to tell us.
tomexplodes
Posts: 19
Joined: Mon Mar 14, 2016 4:48 am

Re: OpenGL Pixel perfect scaling... isn't?

Post by tomexplodes »

[quote=criezy post_id=95495 time=1622669474 user_id=3546]
I have some code that works: https://github.com/scummvm/scummvm/pull/3040
But it has not landed yet in the official ScummVM. As noted in the pull request linked above, I am not sure if the new pixel perfect scaling should replace the old one or if we want both (I think we might want both as some players may prefer to have the exact expected aspect ratio). And I am struggling to find descriptive names for both. So if you have suggestions don't hesitate to tell us.
[/quote]

I looked at the pull request, there're some new suggestions in messages there that sound like good ideas to me. I have no suggestions myself, but I'm looking forward to seeing it implemented! You've made me very happy, thank you for taking such an interest in my anal-retentive need for square pixels!
Post Reply