MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Community created YouTube tutorials, interviews and helpful online information guides.
User avatar
meauxdal
Posts: 124
Joined: Mon Nov 23, 2020 3:28 am
Location: atlanta
Has thanked: 32 times
Been thanked: 75 times
Contact:

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by meauxdal »

Square pixels with R-Type on that core is 5:3 (already listed in the 5x .txt file). You need to uncomment the ratio and comment out another one, as you can only have 2 active per core.

Also, 3:2 isn't integer scaling for R-Type. That only works on games with the most common PCE resolution. With 1080p using vertical crop, 4:3 is horizontally integer scaled for R-Type with close to correct aspect, and 5:3 is square pixels.
User avatar
BlockABoots
Posts: 43
Joined: Wed May 27, 2020 8:21 pm
Has thanked: 7 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by BlockABoots »

atrac17 wrote: Mon Feb 22, 2021 9:09 pm
BlockABoots wrote: Mon Feb 22, 2021 7:26 pm Yeah im still unsure why 5x Mode gives me graphically glitches on the CPS1 games but the 5x Compatibility Mode does not
What .rbf date? You've screen capped and submitted to github? Or you can post it here and I'll take care of it.
It might be hard to to screen grab as the glitch only appears for a few frames, ill try and take a short video of it to capture the issue
User avatar
BlockABoots
Posts: 43
Joined: Wed May 27, 2020 8:21 pm
Has thanked: 7 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by BlockABoots »

atrac17 wrote: Mon Feb 22, 2021 9:09 pm
BlockABoots wrote: Mon Feb 22, 2021 7:26 pm Yeah im still unsure why 5x Mode gives me graphically glitches on the CPS1 games but the 5x Compatibility Mode does not
What .rbf date? You've screen capped and submitted to github? Or you can post it here and I'll take care of it.
Before taking the below video i use the Update_all script so i have the latest .rbf files for the CPS1 games.

I took 2 videos with my phone showing the odd graphically glitch when using CPS1_5x mode.

This is CPS1_5x mode......

https://youtu.be/WWIKDZMYIqY

and then CP1_5x_Compatability_Mode....

https://youtu.be/iEtlJi5QTU4

Also any idea why having the following set to anything other than default causes your modelines not to display correctly for CPS games (get borders top and bottom)....

; These parameters have the same format as video_mode.
; You need to supply both PAL and NTSC modes if you want vsync_adjust to switch between
; predefined modes as a base. This will reduce the range of pixel clock.
video_mode_ntsc=0
video_mode_pal=9
User avatar
BlockABoots
Posts: 43
Joined: Wed May 27, 2020 8:21 pm
Has thanked: 7 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by BlockABoots »

Any ideas why I get the above issues???
Yim
Posts: 125
Joined: Mon Jan 18, 2021 11:51 pm
Has thanked: 3 times
Been thanked: 87 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by Yim »

Are the glitches screen tearing from the display not synching properly to the signal? If so, then I’d guess compatibility mode is running at a pixel clock the display is compatible with and the other mode isn’t.

As for video_mode_ntsc and pal, I thought those settings would override the regular video_mode setting, meaning the custom video_mode setting isn’t applied if they’re set. When you say “anything other than default” is the default you’re referring to having them commented out? If so, then I think the reason you’re getting borders is that video_modes 0 and 9 are not integer multiples of the core resolution and you’ve got integer scaling turned on.

Could have this all wrong, though.
metalfacemark
Posts: 159
Joined: Mon Jan 04, 2021 12:04 pm
Has thanked: 14 times
Been thanked: 15 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by metalfacemark »

I wonder if someone could give some advise on Amiga resolutions - im using VGA to RGB Scart. If i leave things at default, NTSC cuts off the top of the screen and everything is sort of moved down so i cant see the bottom part of the screen. Pal looks better but it then has a squished image.

Any advice?
User avatar
limi
Top Contributor
Posts: 619
Joined: Sun May 24, 2020 6:53 pm
Has thanked: 135 times
Been thanked: 418 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by limi »

Try the vadjust file from MegaAGS and see if that helps?

https://github.com/Optiroc/AGSImager/tr ... ata/config
User avatar
limi
Top Contributor
Posts: 619
Joined: Sun May 24, 2020 6:53 pm
Has thanked: 135 times
Been thanked: 418 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by limi »

Also, we added integer scaling settings on a per-game basis for 700+ games, more info here.
metalfacemark
Posts: 159
Joined: Mon Jan 04, 2021 12:04 pm
Has thanked: 14 times
Been thanked: 15 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by metalfacemark »

limi wrote: Thu Mar 18, 2021 5:04 pm Try the vadjust file from MegaAGS and see if that helps?

https://github.com/Optiroc/AGSImager/tr ... ata/config
Thank you, may I ask where i put that file? Edit - i found it - its fixed it on my Oled, but same on the CRT, will just use that when i need to. Appreciate the advice!
User avatar
atrac17
Core Developer
Posts: 161
Joined: Sun May 24, 2020 10:51 pm
Has thanked: 31 times
Been thanked: 379 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by atrac17 »

BlockABoots wrote: Thu Feb 25, 2021 9:13 pm
atrac17 wrote: Mon Feb 22, 2021 9:09 pm
BlockABoots wrote: Mon Feb 22, 2021 7:26 pm Yeah im still unsure why 5x Mode gives me graphically glitches on the CPS1 games but the 5x Compatibility Mode does not
What .rbf date? You've screen capped and submitted to github? Or you can post it here and I'll take care of it.
Before taking the below video i use the Update_all script so i have the latest .rbf files for the CPS1 games.

I took 2 videos with my phone showing the odd graphically glitch when using CPS1_5x mode.

This is CPS1_5x mode......

https://youtu.be/WWIKDZMYIqY

and then CP1_5x_Compatability_Mode....

https://youtu.be/iEtlJi5QTU4

Also any idea why having the following set to anything other than default causes your modelines not to display correctly for CPS games (get borders top and bottom)....

; These parameters have the same format as video_mode.
; You need to supply both PAL and NTSC modes if you want vsync_adjust to switch between
; predefined modes as a base. This will reduce the range of pixel clock.
video_mode_ntsc=0
video_mode_pal=9
When you define a video_mode for NTSC and PAL they will supersede any settings you have that are custom and also ignore your normal video_mode as well.
pedroTFP
Posts: 36
Joined: Tue Mar 23, 2021 2:07 pm
Been thanked: 2 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by pedroTFP »

Thanks to atrac17 for the custom INI, I'm using it untouched except for "video_mode=8". My LCD is 1080p.
How can I change the scaling (3x; 4x; 5x...) in each core menu? Which is the setting?
FoxbatStargazer
Top Contributor
Posts: 994
Joined: Thu Dec 10, 2020 5:44 pm
Has thanked: 309 times
Been thanked: 228 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by FoxbatStargazer »

You cant' directly change it there. All you can do is adjust vscale_mode to control the granularity (0=free, 1=integer, 2=half-integer, etc.) and then it goes up to the highest magnification allowed by your resolution. For 1080p most cores will fill out to 1080p on vscale_mode=0, 4x resolution at 1, 4.5x resolution at 2, etc.

If you want 5x cut, you need to set vscale_mode=0 and be using 1080p video_mode (which you are.) Then in many cores there will be an option for 5x cut, sometimes it will be hidden under "border" settings. Most cores supporitng 5x mode also have options for horizontal integer scaling (HV Integer -/+)
pedroTFP
Posts: 36
Joined: Tue Mar 23, 2021 2:07 pm
Been thanked: 2 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by pedroTFP »

That's very clear.
Thanks a lot!
retro
Posts: 130
Joined: Fri Jun 04, 2021 5:19 am
Location: Kuala Lumpur, Malaysia
Has thanked: 44 times
Been thanked: 13 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by retro »

meauxdal wrote: Mon Feb 15, 2021 6:06 pm I think I finally cracked the Amiga code...

turrican21.png

cannon1.png

mega1.png

beast31.png

I think my problem was related to the "Adjust screen position" option, which apparently saves adjustments made to a file, minimig_vadjust.dat. I renamed that file in both the shared Amiga and main config folders and now the ratios I had tried previously appear to be working properly. Only tested with Video area by: Blank thus far, but both PAL and NTSC seem to be working OK in low res video modes.

tl;dr Don't touch "adjust screen position" unless you know exactly what you are doing!
Have you tested with Banshee?

When I set Video Area to Blank, the vertical scale of this particular game during gameplay doesn't seem right. The Player 2 portion of the HUD is cropped.

When I set Video Area to Blank+, the entire HUD is gone altogether and the gameplay area is stretched horizontally.
Kenzo
Posts: 21
Joined: Sun Jul 04, 2021 11:08 am
Has thanked: 18 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by Kenzo »

Would someone mind very quickly instructing me on how to use the AR calculator to get the desired output to put in the ini for my 1600x1200p screen? I would like to use custom AR for HV integer scaling on some of the arcade cores I use (CPS2/CPS1.5 etc)?
User avatar
morf77
Posts: 63
Joined: Fri Aug 28, 2020 1:42 pm
Has thanked: 12 times
Been thanked: 24 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by morf77 »

Most of it is self-explanatory.
Visible pixels is the horizontal resolution of the core.
Visible lines is the vertical resolution of the core.
Pixel clock in mhz is more difficult to find out for arcade cores but you could use references like https://pineight.com/mw/index.php?title=Dot_clock_rates though it isn't guaranteed that's the pixel clock the mister core is running at.

The output will include a 1200p custom_aspect_ratio line you can copy paste in your mister.ini for that specific arcade core tag. The arcade core name (you will need this for the tag in the ini) can be seen in the mister menu when the core is loaded, alternatively you can find the name in the MRA files.

Example for ghost 'n ghoblins in the mister.ini file (just an example, not claiming these values are correct or recommended):

Code: Select all

[gng]
custom_aspect_ratio_1=32:35      ; 256:224 @ 8.000, 4:5 PAR (1024:1120)
The info after ; is just commentary to denote the values used and the PAR it translates to - it can be left out of the ini.
Yim
Posts: 125
Joined: Mon Jan 18, 2021 11:51 pm
Has thanked: 3 times
Been thanked: 87 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by Yim »

Not actually what you’re asking but here’s how you calculate it for yourself, using CPS2 as an example:

The core’s resolution is 384x224, and the original display aspect ratio is 4:3. Your screen has a vertical resolution of 1200 lines, so the 224 lines will fit five times using 1120 of those lines. To get the original aspect ratio of 4:3 you divide that by three (373.3333) and multiply by four (1493.3333) for the horizontal resolution. Divide that by the core’s horizontal resolution of 384 and you get the horizontal multiple of 3.88889. That’s not an integer, so you’ll want to round to either 3 (much narrower) or 4 (slightly wider) and multiply the core resolution by that. 4x384=1536, so that’s your output resolution. So you should set the aspect ratio to 1536:1120, or if you simplify it 48:35. This is not exactly the 4:3 aspect ratio you’d get on an original cabinet but it’s as close as you’ll get with integer scaling on a 1600x1200 screen.
Kenzo
Posts: 21
Joined: Sun Jul 04, 2021 11:08 am
Has thanked: 18 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by Kenzo »

Do I keep vscale=1? Or does this override custom ratios at the bottom of the ini?

Thank you both so much.
Yim
Posts: 125
Joined: Mon Jan 18, 2021 11:51 pm
Has thanked: 3 times
Been thanked: 87 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by Yim »

Still need vscale=1, yeah. Without that it’ll fill the full height of the screen so you won’t get integer scaling. The custom aspect ratio doesn’t change the vertical scaling, only the horizontal.
Kenzo
Posts: 21
Joined: Sun Jul 04, 2021 11:08 am
Has thanked: 18 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by Kenzo »

Yim wrote: Sat Jul 10, 2021 10:38 am Still need vscale=1, yeah. Without that it’ll fill the full height of the screen so you won’t get integer scaling. The custom aspect ratio doesn’t change the vertical scaling, only the horizontal.
Thanks!

what is the difference between vscale=1 + custom AR for HV integer scaling and atrac17's modelines?
User avatar
morf77
Posts: 63
Joined: Fri Aug 28, 2020 1:42 pm
Has thanked: 12 times
Been thanked: 24 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by morf77 »

If I'm not mistaking atrac17's modelines were calculated using the AR calculator using a custom resolution. Meauxdal also calculated a lot of these AR's eg see https://github.com/meauxdal/MiSTer_Cus ... /1200p.txt

Both methods require vscale_mode=1, they're just different approaches to calculating them (the calculator taking the pixel_clock into account).
Kenzo
Posts: 21
Joined: Sun Jul 04, 2021 11:08 am
Has thanked: 18 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by Kenzo »

morf77 wrote: Sat Jul 10, 2021 12:24 pm If I'm not mistaking atrac17's modelines were calculated using the AR calculator using a custom resolution. Meauxdal also calculated a lot of these AR's eg see https://github.com/meauxdal/MiSTer_Cus ... /1200p.txt

Both methods require vscale_mode=1, they're just different approaches to calculating them (the calculator taking the pixel_clock into account).
Thanks, I guess the console custom ratios are now defunct with the osd option to HV scale.

This has been really helpful /insightful. Thanks for taking the time out to explain. Appreciated.
User avatar
morf77
Posts: 63
Joined: Fri Aug 28, 2020 1:42 pm
Has thanked: 12 times
Been thanked: 24 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by morf77 »

Kenzo wrote: Sat Jul 10, 2021 1:07 pm Thanks, I guess the console custom ratios are now defunct with the osd option to HV scale.
They are. It would be great to have a similar option for arcade cores but it would have to be implemented by all the different arcade core devs.
User avatar
LamerDeluxe
Top Contributor
Posts: 1160
Joined: Sun May 24, 2020 10:25 pm
Has thanked: 798 times
Been thanked: 257 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by LamerDeluxe »

You can get integer horizontal scaling with correct aspect ratio by just calculating the correct value for the vscale border. That's what I use with the vertical arcade cores to get perfectly clean vertical scanlines.
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by rhester72 »

LamerDeluxe wrote: Sun Jul 11, 2021 7:52 am You can get integer horizontal scaling with correct aspect ratio by just calculating the correct value for the vscale border. That's what I use with the vertical arcade cores to get perfectly clean vertical scanlines.
Can you expand on this a bit if you don't mind?
Yim
Posts: 125
Joined: Mon Jan 18, 2021 11:51 pm
Has thanked: 3 times
Been thanked: 87 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by Yim »

Using the border is an alternative way to get vertical integer scaling without using vscale_mode=1. You can use it for any core, but it’s most useful for vertical arcade cores because vscale_mode=1 doesn’t work properly for them (I think it gets applied before rotation, so the result after rotation is incorrect).

Basically you need to calculate the largest integer multiple of the vertical resolution that will fit on your screen, and subtract that figure from the screen’s resolution, then divide the result by 2. Put that figure in the ini for the core as vscale_border=whatever. That puts a border of the number of pixels you specified above and below the image from the core, which results in the space available to the core to display in being an integer multiple. Then you can put in a custom aspect ratio for the horizontal scaling as I described earlier in this thread.

For example, say you have a vertical core with a resolution of 224x256 pixels and an original aspect ratio of 3:4, and you want to integer scale it onto a 1920x1080 screen. The vertical resolution of 256 will fit four times (1024 pixels) into 1080 with 56 pixels left over. So set vscale_border=28, and you get 28 blank pixels above, 1024 pixels of integer scaled output, and 28 blank pixels below = 1080 lines total. Then to get as close to the original 3:4 aspect ratio as possible while integer scaling, divide the vertical resolution (1024) by four and multiply it by three to get 768. Dividing that by the horizontal resolution (224) give a multiple of ~3.4, which is not ideal because it means your integer multiples will be fairly far from the original. You can then choose to multiply 224 by three (672) and have a picture that’s a bit narrow, or by four (896) for a picture that’s a bit wide. Then set a custom aspect ratio to reflect it. The simplest way is to just make the ratio the resolution you want, either 672:1024 or 896:1024. You can have two custom ratios, so you could just set them both and switch between on the OSD to see which you like better.
User avatar
LamerDeluxe
Top Contributor
Posts: 1160
Joined: Sun May 24, 2020 10:25 pm
Has thanked: 798 times
Been thanked: 257 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by LamerDeluxe »

rhester72 wrote: Tue Nov 23, 2021 8:41 pm
LamerDeluxe wrote: Sun Jul 11, 2021 7:52 am You can get integer horizontal scaling with correct aspect ratio by just calculating the correct value for the vscale border. That's what I use with the vertical arcade cores to get perfectly clean vertical scanlines.
Can you expand on this a bit if you don't mind?
Sorry, I read your message late in the evening and then forgot to reply another time. I've written a whole explanation just now, but I see Yim has already done that as well. Here's my explanation anyway:

The idea is to use the full screen mode (vscale_mode = 0) and shrink it down, using the vscale_border setting, to make the horizontal width of the image an integer scale, while still keeping the correct aspect ratio (the vertical scale will usually be non-integer). This is the exact opposite of MiSter's standard vertical integer scaling.

The result will look really sharp, with perfect vertical scanlines (no interference patterns).

The following example is for the Scramble core, using a 1920 x 1080 output resolution. Look up the source resolution at the top left of your screen when starting the core (values at the top) or alternatively take a screenshot.

Scramble source resolution: 224 x 256

The display aspect ratio, if you can't find it and assume square pixels, you can calculate it here:

Go to https://www.bellevuefineart.com/aspect- ... alculator/ to simplify your aspect ratio:
Enter 224 for W1 and 256 for H1, below it it will say "Your aspect ratio is: 7:8"

Scramble's aspect ratio is 7:8 (224:256)

It will usually be either 3:4 or 7:8, so you can always try both. Or just use the source resolution values instead (224:256).

Output display resolution is 1920 x 1080

At 7:8 aspect full screen scaling (vscale_mode=0), the output image width is:
1080 * 7 / 8 = 945

Shrink the horizontal ratio to an integer multiple:
945 / 224 = 4,21875 (this is our current horizontal scale)
Rounded down this is 4 (which is 4x integer horizontal scale)

4 x 224 = 896 (this is our new integer 4x scale output image width)

At 896 width our new image height, at the correct 7:8 aspect ratio, becomes:

896 * 8 / 7 = 1024 (non-integer scaled output image height)

So our total border size needs to be:
1080 - 1024 = 56 (output display height minus output image height)

Divided by two because we have a border above and below the image:
56 / 2 = 28 (this is the vscale_border size we will use)

In mister.ini this becomes (just add it at the end of the file if you don't have core-specific settings yet):

[scramble]
vscale_mode = 0 (if this isn't your default)
vscale_border = 28
(and video_mode=8 if your default resolution differs)
rhester72
Top Contributor
Posts: 1107
Joined: Thu Jun 11, 2020 2:31 am
Has thanked: 13 times
Been thanked: 169 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by rhester72 »

Thank you both VERY much - this is exactly what I was looking for!
User avatar
LamerDeluxe
Top Contributor
Posts: 1160
Joined: Sun May 24, 2020 10:25 pm
Has thanked: 798 times
Been thanked: 257 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by LamerDeluxe »

rhester72 wrote: Sat Nov 27, 2021 9:22 pm Thank you both VERY much - this is exactly what I was looking for!
Glad to be of help. I was really happy when I finally figured out how to do it, vertical scanlines look so much better now. I had been trying to make a case for a horizontal integer mode in mister.ini, but for some reason it just wasn't going to happen.
User avatar
LamerDeluxe
Top Contributor
Posts: 1160
Joined: Sun May 24, 2020 10:25 pm
Has thanked: 798 times
Been thanked: 257 times

Re: MiSTer Custom Aspect Ratios for Horizontal Integer Scaling

Unread post by LamerDeluxe »

For anyone wanting to try the shadow mask support in the recently updated vertical arcade cores, I've calculated the border values for integer horizontal scaling (at 1080p) with the correct aspect ratios. This provides really clean scan-lines and shadow mask patterns. Add this to your mister.ini (leave out the vscale_mode part if you already have that set to 0 globally):

Code: Select all

[ArkanoidJ]
vscale_mode=0
vscale_border=28

[Arkanoid]
vscale_mode=0
vscale_border=28

[Gyruss]
vscale_mode=0
vscale_border=28

[GyrussB]
vscale_mode=0
vscale_border=28

[GyrussCe]
vscale_mode=0
vscale_border=28

[Jackal]
vscale_mode=0
vscale_border=60

[JackalBl]
vscale_mode=0
vscale_border=60

[JackalR]
vscale_mode=0
vscale_border=60

[JailBreak]
vscale_mode=0
vscale_border=28

[ScotrSht]
vscale_mode=0
vscale_border=28

[TimePlt]
vscale_mode=0
vscale_border=28

[TP84]
vscale_mode=0
vscale_border=28
Post Reply