Simulating CRT or Vector displays for more realistic emulation

simulated-crt-monitor-for-emulatorsScaled down it’s not as obvious that this image isn’t a crystal clear rendering of Mortal Kombat gameplay. But we’ve linked it to the full size version (just click on the image) so that you can get a better look. Notice the scan lines? This is the result of an effort to more accurately mimic the original hardware displays used in classic games. [Jason Scott] takes a look at the initiative by describing what he thinks is missing with the picture perfect quality of modern emulators.

One such effort is being mounted for MAME (Multiple Arcade Machine Emulator). There is a series of filters available — each with their own collection of settings — that will make your modern LCD display look like it’s a run-of-the-mill CRT. This is a novelty if you’re a casual gamer who dusts off the coin-op favorites twice a year. But if you’re building a standalone game cabinet this may be a suitable alternative to sourcing a working display that’s already decades old.

32 thoughts on “Simulating CRT or Vector displays for more realistic emulation

        1. Actually would, NES shooting games didn’t use the standard method for lightguns, I suppose the graphics chip wasn’t designed with the right counters in. In NES games the screen goes black, then white, then the duck sprite flashes white. Or something like that. So it’d work on any screen.

          1. No, it wouldn’t work because CRT monitors draw on a per-scanline basis, while LCDs draw per-screen. The light gun works by sending the brightness change as a pulse to the NES, which then compares when the pulse occured with respect to when (yes, when) it was while drawing the screen. If the whole screen is updated at the end of vsync, the pulse will occur outside the viewable area screen.

    1. I actually do render the “sub-pixels”, way to prove that you didn’t actually try it or investigate the settings before trying to crap all over my work, I guess. If you had actually bothered to look at the code, you’d see that it does far more than just scanlines, but don’t let that stop you from jumping in and trying to make as ignorant a post as possible as quickly as possible.

      While the shader set allows you to specify a separate bitmap for specifying the shape of the phosphor mask, it doesn’t have a visually pleasing result just yet, due to the moiré that occurs when downsampling to your screen’s resolution. To accurately capture the rounded nature of the phosphor dots, you need about a 32×32 bitmap. Assuming even a fairly low-res system like the NES (256×224), you’d end up with an 8192×7168 bitmap that you now need to perform a non-integer stretch down to screen resolution. This produces ugly moiré, as I don’t yet have a separate shader pass to perform a proper Lanczos downsample. Soon, though. Soon.

      1. Arcade monitors mostly used a “slot mask” type of shadow mask as a way to have the sharper, brighter picture of the Trinitron without paying Sony’s licensing fees. Most CRT TVs also went to slot mask in the 80’s. Slot mask is more forgiving of temperature caused misalignments than the old dot triad masks.

        Yet another benefit of slot mask was the phosphors were easier to apply, just vertical stripes like the Trinitron instead of the finicky round dots that had to be printed very accurately on the inside of a curved piece of glass.

        Other companies didn’t have long to take advantage of the patent expiration on the Trinitron design before true-flat CRT and then plasma and LCD made it obsolete. There’s just a few non-Sony made Trinitron CRT television models.

      2. One more thing on dot triad VS other shadow mask types. Dot triad makes a smoother looking image but in the quest for higher brightness Trinitron and slot mask were invented. In really fine dot pitch dot triad CRT the dots are practically invisible without getting really close. Slot masks just fine enough for the video signal they’re displaying look like watching through a screen door – but it’s a *bright* image, so it’s “better”, right?

    2. It does. It also does a mathematically intense simulation of all manner of electronic and physical aspects of a CRT display, and lets you configure any or all of them as being out of adjustment (as was often the case). Most people tend to configure it to cartoonish effect (especially WRT the display curvature), but you can tune it to match most any real-world CRT display if you’re willing to put some work into it.

    3. Follow the link and click the Mortal Kombat screenshot to enlarge, they did actually render the subpixels.

      The monarch image is especially cool too. As [Jason] would put it, “I Do See All This Shit Going On”, and it’s both impressive and nostalgic, even though I don’t mess with emulators much.

  1. As the guy who wrote the HLSL shader suite for MAME, I should point out that there’s only one set of CRT filters, it’s just that there’s a whole ton of different parameters that can be tweaked.

    For people running game consoles in MESS like the NES and Apple 2, however, you can also enable an NTSC filter that provides proper artifacting as you would see when running through a composite connection. Unlike existing NTSC filters that just simulate the sort of artifacts, the NTSC artifacting in MAME/MESS is based off of the physical effects of encoding an RGB scene as composite and then decoding it. The first pass takes the final RGB output from the emulator (as, say, a 560×192 bitmap from the Apple 2 driver) and outputs a bitmap of equal size but with 4 composite samples per pixel packed into all four color channels. The second pass uses an 83-sample-wide Hann window to extract the individual Y, I and Q values from the composite samples, with (I believe) 6MHz of bandwidth for Y, 1.2MHz of bandwidth for I, and 600kHz for Q.

    If anyone has any questions, don’t hesitate to ask.

    1. Nope. Light guns rely on the timing of the physical movement of the electron beams in a CRT. There are various methods of the gun recognizing when it’s aimed at the right target, but they’re all tied in with the screen trace timing.

      All digital screens like plasma and LCD don’t have any screen trace, the entire image is refreshed at once, many times per second.

      The earliest use of a light gun on a game console was much simpler and could possibly be simulated on an LCD. Instead of any fancy timing signals the light gun game simply made the target the brightest spot on the screen and if the sensor was aimed at part of the screen dimmer than the target, it wouldn’t register a hit. The problem is the system didn’t have an upper threshold. Players quickly discovered they could point the gun at any lamp and pull the trigger to run the score up.

      Other light gun systems could be done on plasma and LCD but it would involve additional hardware and precise positioning of the game image, and programming so that the game would register a hit only when the Zapper is pointed close enough to the duck to register a hit in Duck Hunt. If such a system can be developed, there could be enough interest to make a retrofit kit for the Nintendo Zapper, with a USB cable replacing the original cord.

      1. The Nintendo Zapper didn’t rely on any fancy shit like that. It followed this process to determine what’s a hit and what’s a miss:
        1) Flash the screen black for 1 frame, this is a calibration frame that represents miss.
        2) Flash a white rectangle over a black background, the white rectangle being a hit box.
        3) Repeat step 2 for each additional hit box.
        4) Compare the signal from the Zapper’s photo-diode from each frame against the black calibration frame.

        From there it’s just testing against a threshold value to determine whether the Zapper was pointed at one of the white rectangles, and testing timing on any hits to determine what rectangle was hit.

        The problem with doing this sort of thing on a PC is three-fold. First the emulation must be spot-on with timing, which most are close enough to fool human sense but not code that needs microsecond accuracy. Second is the input latency on a computer, while 200Mhz USB busses that clock up to 1000Mhz sounds fast, there is so much additional processing that by time the software gets the signal there is a noticeable latency attached to it. Third is the brightness of an LCD display, due to the nature of LCDs even a black screen is giving off a lot of light still, I imagine if you get over the first two problems you’d have to develop a hack to adjust the threshold values different games use to determine hit or miss.

    1. (edit) for Vector though, can’t really do that short of playing on a vector display.
      But anyway 15khz RGB monitors are out there (even in the USA if you look hard enough) and with soft15khz you can put out the exact same RGB signal as the original of whatever’s being emulated (as in same pixel width and all that, not the same as outputting a fullscreened emulator running at a TV-ish resolution to your TV (via RGB or otherwise)).

      1. Not everyone has the fortitude to install or maintain a CRT, and over time it will be harder and harder to find NOS tubes.

        While people looking for the color gamut of a real CRT (among other things) will always prefer a real CRT, trying to simulate the physical effects of the CRT at least provides a happy middle-ground for the hobbyists, and is at the *very* least preferable to a bilinear-upscaled texture on an LCD.

  2. To FULLY emulate the 80’s CRT games from my local Arcade I would need to remove a LOT of sharpness too and replace it with distorted colors from magnetizing. I would also need really loud humming noise from the speakers whenever something big and bright enters the screen.
    I don’t want any of that but I still want it to be CRT-like and I must say that the screenshot linked in this post looks awesome.

  3. While I definitely appreciate the idea of playing the games as they were meant to look, I’m not a fan of scanline filters myself. I prefer smooth graphics over nostalgia.

    However, from the looks of it, this does far more than most CRT filters I’ve seen. The phosphor glow, in particular, looks pretty awesome, and I can definitely appreciate the asteroids sentiment. I can’t stand analog fuzz, which was the majority of my experience playing on real CRTs, but I do love vector graphics. I also like how this system allows for adjusting to make it look like a GOOD CRT, not just a crappy fuzzball.

  4. Slightly off topic, but I have a MAME box with a proper arcade monitor and get all this old school nostalgia for free, however I have been thinking about removing the arcade CRT monitor and putting in a nice LCD or IPS monitor instead. Combined with the above filters I will get to keep the original look and feel and at the same time banish the really annoying high pitched squeal that the current monitor puts out (to the relief of all the dogs in my neighbourhood, I’m sure). :)

    Does anyone know of a good LCD/IPS monitor replacement for a standard arcade machine? It seems to be very difficult to find a 4:3 LCD of any size. (I think I measured the diagonal viewable area as around 25″, I’ll have to check again though).

    1. It’s hard to find 4:3 monitors now. Some people have been doing things like running a 32″ lcd tv in portrait mode to fit the cabinet width.

      But that sort of setup (portrait) really needs a higher resolution than 1080P if you want to run the HLSL effects. As MooglyGuy said above, better filtering is going to help, but the aperture mask effects want as much resolution as you can give them if you want them to look good.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s