Distored graphics on arcade cores?

gregmaletic
Posts: 2
Joined: Wed Sep 15, 2021 11:21 pm
Has thanked: 4 times

Distored graphics on arcade cores?

Unread post by gregmaletic »

After running the Update All MiSTer script (https://github.com/theypsilon/Update_All_MiSTer), I launched the Pac-Man and Space Invaders cores. In both cases, I noticed distortion on the graphics: specifically, on my TV set (HDTV 1920x1080) the pixels have inconsistent width. You can see it in the attached image: the top of the "3" is thicker than its bottom; the right side of the "0" is thicker than its left side.

Is there a setting that will give me more accurate pixel rendering?

Thank you.
Attachments
Screen Shot 2021-09-15 at 4.25.34 PM.png
Screen Shot 2021-09-15 at 4.25.34 PM.png (267.66 KiB) Viewed 1811 times
User avatar
pgimeno
Top Contributor
Posts: 669
Joined: Thu Jun 11, 2020 9:44 am
Has thanked: 246 times
Been thanked: 208 times

Re: Distored graphics on arcade cores?

Unread post by pgimeno »

Try setting this in your MiSTer.ini: vscale_mode = 1
FoxbatStargazer
Top Contributor
Posts: 994
Joined: Thu Dec 10, 2020 5:44 pm
Has thanked: 309 times
Been thanked: 228 times

Re: Distored graphics on arcade cores?

Unread post by FoxbatStargazer »

I'm getting this too, I think it has to do with rotation, which may have been changed yet again. As if it scales the horizontal output to your resolution first, then rotates, and scales again to vertical. Ideally it should just take the direct horizontal output and rotate that first before scaling. Normally sharp interpolation should sufficient clean up vscale_mode=0 but this might be why that isn't happening in that case.
Yim
Posts: 125
Joined: Mon Jan 18, 2021 11:51 pm
Has thanked: 3 times
Been thanked: 87 times

Re: Distored graphics on arcade cores?

Unread post by Yim »

By default the MiSTer prioritises aspect ratio over even horizontal scaling. Some of the cores have options in the OSD menu for integer scaling, but if they don’t you can get it in using custom aspect ratio settings in the mister.ini file. Using vscale_mode=1 will get you integer vertical scaling, and from there the simplest way to get integer horizontal scaling is to set an aspect ratio of the core’s internal resolution, in space invaders’ case 224:256, for Pac-Man 224:288. This will make all the pixels square. Depending on the core, this might result in an aspect ratio that is way off what it should be. It’s also possible to make all of the pixels rectangular and consistently sized, which may get a closer aspect ratio, but it takes a bit more calculation.

For Space Invaders on a 1080p screen with vscale_mode=1, assuming the original aspect ratio was 3:4, the 256 pixel tall image will be scaled up 4x to 1024. The target horizontal resolution is 3/4 of this, 768. 224 goes into 768 a bit less than three and a half times, so you either want to scale up 3x and have a picture that’s too narrow, or 4x and have one that’s too wide. For a 3x horizontal scale, the final resolution will be 672x1024, which simplifies to 21:32. For a 4x hori scale, the resolution is 896x1024, which simplifies to 7:8.

A similar calculation can be done for Pac-Man. It’s got a higher vertical resolution so it’ll only fit 3x in 1080p, but its native resolution of 224x288 is pretty close to 3:4 so square pixels should look pretty reasonable.

I haven’t actually fired these games up and tried these out, not sure if there’s something in the rotation as foxbat suggests that would stop this from working.

Alternatively there are interpolation filters which smooth the irregularities when you’re not using integer scaling.
Yim
Posts: 125
Joined: Mon Jan 18, 2021 11:51 pm
Has thanked: 3 times
Been thanked: 87 times

Re: Distored graphics on arcade cores?

Unread post by Yim »

I tried the aspect ratios I gave for Space Invaders in my last post and they don’t work - inconsistent pixel sizes. I guess it’s something to do with the screen rotation. Or I stuffed up the calculations. I’ve been able to get square pixels by setting the custom aspect ratio to 256:224 and the orientation to horizontal, but setting 224:256 with vertical orientation, which I thought should be the same thing just turned 90 degrees, gives inconsistent size both vertically and horizontally. Dunno what’s going on, sorry.
Yim
Posts: 125
Joined: Mon Jan 18, 2021 11:51 pm
Has thanked: 3 times
Been thanked: 87 times

Re: Distored graphics on arcade cores?

Unread post by Yim »

I played around some more, try adding this to your mister.ini:

[invaders]
vscale_mode=0
vscale_border=28
custom_aspect_ratio_1=7:8
custom_aspect_ratio_2=21:32

This is working for me, giving consistent 4x4 pixels with the first aspect ratio and 3x4 pixels with the second. Rather than using vscale_mode=1 to get integer scaling, which doesn’t seem to play well with screen rotation, it uses a border of 28 pixels above and below to limit the available pixels for display to an integer multiple of the core’s resolution (28 above + 1024 of game + 28 below = 1080), then uses the custom aspect ratio to get integer scaling horizontally.
Post Reply