(updated 2021-03-23)
How to get perfect image sharpness - square or even pixels - using custom_ratio and vscale_border in MiSTer.ini
Visit this spreadsheet to calculate the settings for your MiSTer.ini for some cores ... more cores will be added:
https://docs.google.com/spreadsheets/d/ ... edit#gid=0
MiSTer lacks an easy setting to make the video signal match your flatpanel's pixels perfectly for all cores - each core needs to have integer implemented seperately - some cores luckily have that but many still don't.
Here's a how to get a pixel perfect image anyway (unless a core changes its resolution while running - if a core uses more than one resolution there's no way to get the perfect pixel output yet)
Guide:
• Make sure the resolution set with video_mode= in MiSTer.ini matches your screen's native resolution - or perhaps the exact half (native is best, though) - e.g. 1920x1080
• Set video_info=10 in MiSTer.ini (shows the resolution of the core for 10 seconds when it boots)
• Run your favorite core (e.g. Ghost'n'goblins - jtgng) and look at the resolution (video info) in the top left corner when it boots. Write down the top line's resolution (e.g. 256x224).
• Calculate the largest size of an integer-scaled image possible on you monitor's native resolution (e.g. the JTGNG core's image size will be limited by the 1080 height of your display in this example and so the largest image will be 224 times 4 = 894 ... thus the width would be 256 times 4 ... or 5 ... that gives these resolutions: 1024x896 ... or 1289x896 for a larger width).
• Calculate the size of the smallest black area around the largest image of the core (e.g. 1080 minus 896 = 184) and divide it by two (92 in this example). If the result is e.g. 37.5 things get more complex. But let's assume it's an integer like 92.
• Add the appropriate custom ratios and border size to the end of your MiSTer.ini (or adjust the existing lines) - all core section must be at the end of the MiSTer.ini:
[JTGNG] ; 256 x 224
vscale_border=92
custom_aspect_ratio_1=1024:896
custom_aspect_ratio_2=1280:896
(you may need to add vscale_mode=0 too)
• Boot your favorite core, make sure it's set to Scandoubler fx: None and Scale filter - Internal (not Scale filter - Custom) in the OSD (F12)
• Change the ratio from Original to one of the custom ratios you just created and click Save Settings if you're satisfied with the look.
... that's it
You can test if it worked by changing Scale filter - Internal to Scale filter - Custom and choose e.g. Gaussian_Sharp_06 ... now click Scale filter - Custom several times to switch back and forth between Scale filter - Internal and Custom. If the graphics stay unchanged (e.g. characters don't shift or blur with each click) then it worked! - the scaling filter has no effect since every pixel in the video matches 1, 3x3, 4x4 or even 4x5 pixels on your flatpanel.
Another way to test is to use the LCD_NN_Type1_020 filter. It creates a grid of black thin pixel lines around each scaled-up pixel. Look for un-evenness (moiré) in the grid. If the grid looks perfectly even, it worked.
Note: SMS core already seems to have square pixels - for all cores with square pixels all you need to do to get perfect sharpness is to set Aspect ratio to Original and make sure it's set to Scale filter - Internal (not Custom) - and of course set the vscale_mode=1 to force integer height (and again: Make sure the video_mode= matches your flatpanel's native resolution) in MiSTer.ini
The downsides are ...
1) the output of all cores will not necessarily be as large as with a (somewhat blurry) non-pixel-perfect scaling ... but if - like me - you prefer the pixel perfect sharpness that's fine.
2) the graphics will probably be a bit squeezed since the original pixels were seldomly square like today's flatpanels.