Going back on what I said, the cropping of the screen at 5x integer scaling DID end up bothering me, so I had a play around with non-integer scaling, and I think I’ve got something I’m happy with. I posted this on the retropie forums - it goes over some old ground, but anyway!
THE PROBLEM
Most console systems and arcade games from the 80s until the mid 90s, output in ‘raster’ resolution, which seems to almost always be 320x224. With a modern 1080p screen, you have an issue where there’s no way of dividing the vertical number (224) in to 1080.
Your options are:
[ul]
[li] scale each pixel to represent 4x4 1080p pixels (ie, 4224=896 pixels high), BUT this leaves you with black borders on the top and bottom of the image[/li][li] scale each pixel to represent 5x5 1080p pixels (ie, 5224=1120 pixels high), BUT this means you will cut off the top and bottom of the image, which often contain important score/credit info[/li][li] turn off integer scaling and let the emulator work it out, BUT this ends up with ugly thick rows of pixels where they’ve clearly been expanded at a different size to their neighbours, to make the maths work[/li][/ul]
Option 1 works for many people and is absolutely the best way to get a 100% correctly scaled scanline image on a 1080p screen.
Option 2 is sometimes acceptable - eg, the NES seems to always treat the bottom and top 4 lines as an overscan, so you can crop that image without losing anything useful.
Option 3 bugged me. How come I’m noticing one row of pixels being 1/1080 bigger than another?! This set me off…
THE SOLUTION (SORT OF!)
By default in Retropie, Retroarch runs at 640x480, regardless of your video output setting. This explained the scaling issues to me - in trying to fit 224 into 480, it has to DOUBLE the size of the occasional row of pixels. If you change your Retroarch render resolution to ‘output’ in the launch menu (press ‘x’ on a keyboard when a rom is loading), it will render at your output resolution (1080p), and suddenly scaling is much better! I can’t notice any thick rows of pixels at this resolution.
What about scanline overlays? These have the same issue. How do you create a scanline image which fits 224 scanlines, in 1080 pixel high image? The maths doesn’t work! What I’ve done is tested out a variety of image scaling techniques, and believe I’ve found the best fit with ‘linear’ scaling. I’ve generated a 1080p overlay .png, with 224 lines of scanlines. If you look closely at the screen, you might see a few instances where the lines aren’t exactly lined up with the pixel edge, but it seems very rare, and unnoticeable (to me!). <strong>NOTE:</strong> I always set my scanlines to .35 opacity. This keeps them visible, but doesn’t darken the image (much). You may want something else…
This last bit is optional, but I’ve had good results with the dotmask retroarch shader. It gives a subtle ‘aperture grill’ effect on the image, softening the edges a little, without blurring. To add this, go into the the Retroarch menu (select + X for me), core options > video > shaders > shader pass to 0 > select the dotmask.glsl in opt/retropie/emulators/retroarch/shader/crt/, leaving both options as ‘don’t mind’
RESULTS
Here are a couple of screenshots. Will probably look weird at anything less than 1080p, but you can get the full thing if you download them.
INSTRUCTIONS
[ol]
[li] Extract the attached .zip file to /opt/retropie/emulators/retroarch/overlays[/li][li]launch any game on the system and hit X during load to get into the launch menu. Set ‘Retroarch render res’ to ‘output’[/li][li]Go into the retroarch menu (select + X by default)[/li][li]Frontend Settings > Video Settings > Turn OFF Integer Scale[/li][li]Frontend Settings > Video Settings > Turn OFF HW Bilinear Filtering[/li][li]Frontend Settings > Video Settings > Aspect Ratio Index to ‘config’ (not sure what this does but it helpfully refreshes the display)[/li][li]Frontend Settings > Onscreen overlay settings > Display Overlay ON[/li][li]Frontend Settings > Onscreen overlay settings > Overlay preset > select the one we uploaded in step 1[/li][li]Frontend Settings > Onscreen overlay settings > Overlay Opacity 0.35 (try higher if you like darker scanlines)[/li][li]Frontend Settings > Onscreen overlay settings > Overlay scale 1.00[/li][li]Core Settings > Shader Options > Shader Passes 1[/li][li]Core Settings > Shader Options > Shader #0 > opt/retropie/emulators/retroarch/shader/crt/dotmask.glsl (leave both settings as ‘don’t mind’)[/li][li]Core Settings > Shader Options > Apply Shader Changes[/li][li]Frontend Settings > Configuration Settings > Save Config on exit to ON (this saves when we exit the game - might want to turn this off later, in case you mess anything up later by accident)[/li][li]Exit the menu (select + x again) and have a look :)[/li][/ol]