So you're running MAME on an LCD, and it looks terrible. Sharp edged pixels, no scanlines, no wonky geometry or convergence issues, and you miss how the games look on a CRT. What can be done? Until we get high enough resolution LCDs to simulate a true CRT shadowmask, it'll never look the same - but we can get things looking a lot better than they do untweaked.

There are a few settings to do this effectively in mame.ini (or the individual game .ini file):

If you've got a multiprocessor or multicore machine (or even plain old P4 hyperthreading) then it's well worth having multithreading turned on - MAME will use a seperate thread to do all the fancy video effects so the emulation performance won't suffer as badly as with it off.

We have to use DirectDraw rather than Direct3D. MAME peforms the scaling and image effects differently with both. In ddraw mode, the image is scaled internally (prescaled), then the effect is applied, then it's fed out to the graphics card. In d3d the image is fed out to the graphics card which handles the scaling, and the card then applies the effect to the scaled image.

We have to force the aspect ratio to 4:3 - this is the aspect ratio of the monitors we're trying to simulate. Allowing MAME to use arbitrary (or so it seems) aspect ratios makes a mess of things. I suspect in most cases MAME looks at the game resolution and works out the aspect ratio from there - wrongly.

We double the image in width and height internally in MAME. This is needed for the effect we wish to apply. Prescaling by a higher amount uses more CPU power, and would need a different effect image suited to the extra scaling. I'd love to see a good "prescale 4" effect but the difference between 2 and 4 in performance on this machine is a 50% framerate drop, and we need the eventual graphics card blurring to complete the effect, which would be lost if we're prescaling up to the output resolution.

We use the graphics card to scale the image up to the monitor resolution. Disabling this is fine if you're running custom resolutions, using a VGA CRT (like in a Naomi), but on a high resolution LCD - I've been testing with a 1280x1024 display - this causes MAME to behave in a similar fashion to using d3d. With it disabled MAME scales the image up to the screen resolution, then applies the effect.

Lastly, the most important bit is a good overlay effect .png image (attached at the post bottom).

effect_cools_demo.png (346 Bytes) Viewed 31606 times

This demo image is scaled up by 2000 percent so you can see what's going on. Normally it's a 2x4 image (which is attached). I've been through the ones available elsewhere and I'm not a fan of any (they either do the scanline or the shadowmask, not both), so I've spent a few hours playing about with this one till I'm happy with it. With the settings above, MAME takes this image, and tiles and applies it to the internally prescaled image before handing it over to the graphics card. Since we're prescaling by 2 times, we're doubling the the number of pixels in both directions. The dark lines in the effect dim every second line in our prescaled image so they appear as scanlines, and the alternating light grey/white squares apply a subtle change to the lines we want to see, simulating the ever so slightly speckled effect of a CRT shadowmask. By altering how light or dark the pixels in the effect image are we can control the strength of the scanlines and shadowmask simulation. Most important is to keep the levels far apart - by making the shadowmask effect stronger (darker pixels) or the scanline effect weaker (lighter lines) you end up with a display that simply looks speckled, losing the scanline effect that we're really after.

And the result? Here's R-Type Leo.

Note: I've run this specifically in 640x480 with switchres on to get the screenshot. This is what gets handed off to your graphics card, which will do the final stretch up to the resolution you're running the LCD at - adding in it's own bit of blur which adds to the effect. To see how it looks on your setup, try setting this as your desktop wallpaper - stretched to the edges of the screen.

Hope this lot helps some of you - I've never been satisfied with the current video effects, and I've not seen a decent guide available to exactly what MAME does to the picture and what can be done with it.

I've been tinkering with lcd friendly scanlines today. Mainly because I'm in the dilemma atm of reducing my cabs to only one - and I want to convince myself that the vewlix CAN be the one cab that I keep.

Anyway, this is what I've come up with (slarp.png):

zoomed in:

The img itself (right-click, save as and place in mame's 'artwork' folder):

I've found that the best solution is resolution dependent, so it varies for different lcd sizes. The vewlix is 1366x768 so a 3x height scale is almost ideal (width can more comfortably vary) for most old games. Therefore I've made a 3x3 effect to tile across the screen (upped to 6x6 to add a little variation in the aperture grill), which suits my resolution. My settings are a bit different to yours Cools as I just couldn't get on with the stretched scanline effect - possibly due to the screen depth I'm using - but the scanline effect with your settings turned out very jagged for me. On this matter, I found that if I want to stretch up to the absolute maximum screen size, it is far preferable to me to keep the scanlines at a fixed 3 pixel tiling (instead of stretched to align with pixels) EVEN if that means that not ALL pixels are aligned identically to the overlayed effect. The scanlines simply make the image comfortable to look at and during gameplay you never notice the alignment - as apposed to varying random scanline placement, which is very hard on the eye. (I'm not sure how much sense this paragraph will make to anyone who hasn't already spent a long time fiddling with scanlines!)

Anyway, for a 3x stretched image, the result is perfect alignment anyway so I'm happy enough with the result on my screen.

(I'd love to make an effect for a 1200 line screen or greater, because then I could make up to a 5x5 effect which would fit a nice amount of aperture and scan line detail).

Anyway, I'm quite happy with what I've come up with so far. I'm currently fiddling with game brightness to compensate for the overlayed effect, but I'm posting the examples below 'straight'. Here's how it looks...

incase you wondering, I cut the images in half to try and prevent browser scaling. Click on them to view full size.

One suggestion - try staggering the alternate "bright" lines and making the scanline line darker.

A Vewlix with MAME inside makes a hell of a lot of sense, as it's a noisy **** anyway so you can get away with a monstrous PC, and running on an LCD is far more straightforward for resolution selection.

I just disconnected the fan on the vewlix. Might swap it for a quieter one one day (it is a 12cm fan afterall), but it seems okay without it tbh. I can't stand noisy pc or cab fans.

Darker scanlines I didn't get on with so much. Well I like them, but I feel it makes the image get a bit too dark overall - and if I offset this by lightening the other two 'rgb' lines, you get a kinda a too crisp effect, like a gameboy screen. There is of course a lot of personal preference involved.

I'm only using basic gui mame though. Maybe I should look into other versions, because if darker scanlines could be combined with a lighter, saturated image (and maybe with some sort of very slight 'bloom' effect), then I'd love to play around with those settings. On the version I used, everything I did to brighten the image just washed the colours out too much.

It's silly, but I put a fair amount of work into that little group of pixels tbh. I started making a 3x3 grayscale scanline image with very subtle light variation (vertically as well as horizontally). I then found an rgb aperture grill image and reduced it right down in size before picking out the resulting colours. I overlayed the two images and tweaked the colours to simplify it (eg: removed the honeycomb effect of the grill). Then I played with layer opacity and colour satuation. ...I actually ended up with about a 5 layer working file and I tried out loads of different results - all for that small bunch of pixels.

Could you explain what you mean a bit further about 'staggering' the bright lines?

I did find that if I varied the left 3 pixels to the right 3 too much, the result was a bit wobbly. For example, I tried to keep the aperture grill 'honeycomb' effect at one point (the right 3 lighter pixels were basically flipped vertically) but the resulting effect was too obvious wavy lines. So I had to keep the variation very subtle.

Staggering - your bright areas are directly above and below each other. If you look at my first posted one, they're not. This reduces the cross stitch appearance of the image.

I found playing around with darker scanlines and the brightness/contrast/gamma in MAME (it's in your GUI settings) worked quite well, but yeah it's a lot of personal preference with this. Mark will tell you I tend to set up monitors with brightness set for darkest black (no raster lines), contrast set so there's minimum blooming or blurring, and red set a little high (this is down to my colourblindness).

I absolutely loathed the effect when the scanlines were offset from the pixels, for example

I understand what you mean about loathing the pixel misalignment. I just think, from what I've tried so far, it's preferable to scanlines that vary in thickness - especially during gameplay. How bad that effect is depends on how high your monitor resolution is though. I've noticed just now on my phone, that once I'm already close in, if I zoom in fractionally more on the images on this page, it's not so bad. I guess the 768 lines on the lcd I'm using just aren't enough to get past the hard omg jaggies stage.

I've been fiddling with scanline images again, and then realised that mame has SEVERE input lag at the moment. Emulation speed is fine, but the lag is unbearable. It's not constant but, what happens is, if I am holding or pressing multiple buttons at the same time it is building up an input back log which can last for a very long time (I got wonderboy to carry on running and jumping for 20 seconds on his own).

It's not just game inputs, if I pressed esc, then that was taking a while to be recognised too.

First thing I did was put prescale back to "1", as you mentioned that being a performance killer, but it made no difference.

At this point, I started thinking it may be the JVS-pac which I just installed this afternoon.

But just now, I have deleted the mame.ini file and it seems to be okay again. Obviously that means it must be some other setting messing things up, but I don't know what it is. Have you ever come across anything like this? As I say, game speed is perfect - it's just very bad input lag.

Bit off topic this, so I would be very happy to receive a PM if you have an answer that is not straight forward.

(btw, rainbow islands, with it's large areas of bright flat colour, is a real **** test for scanlines. So if ths looks even half decent, then everything else looks a lot better.)

Although there is unavoidable variation in scanlines, it is not too bad considering it's scaling up FULLY to a messy screen resolution ...and full screen stretch is the best option to have as a default really. Prescale 3 was too much hassel as a default option on my screen and at full screen hardware stretch, the scanlines looked worse.

P.S. I really like this prescale method cools. It is the only way to get half decent pixel regularity while scaling up to screen sizes that aren't an exact multiple of the original image - while still retaining (some) pixel sharpness.

For example, this:

instead of this:

I just wish the same effect could be applied to other low res software...

Last edited by pubjoe on November 14th, 2009, 2:58 am, edited 3 times in total.