Settings

Theme

CRT simulation (2014)

piratehearts.com

86 points by bashtian 11 years ago · 34 comments

Reader

tadfisher 11 years ago

This technique is very important for emulation and simulating the look of early games.

For example, the Genesis/Mega Drive did not support hardware alpha transparency. Many games (including the Sonic series) simulate the effect by alternating vertical lines, and relying on the "visual munging" of CRTs to produce a convincing effect. Here is a video that demonstrates the effect in Shinobi 3: https://youtu.be/YFOkbfpIlaY?t=2m52s

(You can also notice the stippled pattern in the pool of water to the right, used to produce the same effect.)

Another technique is the use of stippling to simulate smooth textures and surfaces. For example, this screenshot of the Super Metroid start screen looks pretty terrible by modern standards: http://static.giantbomb.com/uploads/original/0/4527/1093273-...

This would have looked much more convincing on a CRT display. Without simulating CRT distortion, you are not getting the same visual experience one would have had when running the game on hardware it was designed for. For modern games looking to simulate this experience, using these techniques along with a CRT shader will be very effective at bringing back the home console experience of the 80s and 90s.

  • mrob 11 years ago

    It's hardly fair to call it "terrible" when you're scaling it with non-integer ratio nearest neighbor scaling (causing uneven original pixel sizes), then compressing with a lossy algorithm designed for completely different images.

    SNES (and NES) screenshots are difficult to display well on modern systems because the (S)NES had rectangular pixels instead of square pixels as used today. I recommend scaling to some large integer multiple of the original size with nearest neighbor, and then scaling to the correct aspect ratio with your favorite resampling filter. And if you insist on using JPEG compression then at least use 4:4:4 chroma subsampling - chroma artifacts are very obvious in pixel art.

    I also dispute the assertion that CRT artifacts were required or intended by all graphics designer back then. Evidence: LCD based portable systems and line doubled mode 13h DOS games both used the same dithering techniques, but they had sharp pixels. And many games used dithering type patterns to represent fine detail instead of blended colors, eg. the typewriter in the background near the start of Chrono Trigger. I grew up with DOS games so I personally prefer sharp pixels.

    The most important feature of a CRT is the low persistence - eliminating sample and hold blur. This is now available in fast modern LCDs with strobing backlights, or with black frame insertion displaying 60Hz content on a 120Hz monitor. It makes a very big difference for fast scrolling 2D games.

  • 6502nerdface 11 years ago

    In addition to the physical characteristics of a cathode ray tube itself, there is an orthogonal set of visual artifacts that follow from quirks of the analog NTSC signal encoding, and in the case of the NES, certain technical compromises in the design of the picture processing unit (PPU) that result in "ragged" vertical lines and chroma/luma interference; see [1] for documentation and example images.

    It would be cool to see an NES emulator that combined an accurate simulation of the PPU's quirky NTSC encoding logic (already present in some emulators) with the kind of CRT/phosphor-simulation shown in TFA.

    [1] http://wiki.nesdev.com/w/index.php/NTSC_video

  • rasz_pl 11 years ago

    >This technique is very important for emulation and simulating the look of early games

    Why? I dont see people emulating the look and feel of 1920 black and white film projection, or Edison sound cylinders. Its because quality was SHIT, just like CRT.

    • ChrisClark 11 years ago

      Because the art was generated in a way to take advantage of the blurring and inaccuracies of the screen. Showing just the pure pixels takes away the transparency effects, the shading that took advantage of the blurring, etc.

    • burnte 11 years ago

      Actually, you DO see such emulations, just look at Instagram, or people using tube amps to get fuzier sounds, listening to vinyl records, etc. It recreates the sound/image one remembers from their youth and thus helps magnify the nostalgic effect, enhancing the emotional recollection.

    • justifier 11 years ago

      i am less convinced

      i read a long time ago someone's interpretation of the history of film as being invented in reverse: starting with impressionism and developing hyper realism;

      it's an overly simplistic break down with all the standard caveats but it has a certain amiable pithiness to it

      look at some of these movies that are attempting higher frame rates and you'll see the audience is suddenly unimpressed by the same set tricks and computer effects that were stunning them days before in another film at lower frame rates

      i remember the first time i saw an HD tv that i was truly impressed by they were playing a battle scene from film i had seen many times before, i walked by and stopped in my tracks because the wall mount appeared to be a window, the title characters were riding horses on an expanse of pasture before the battle, it was stunningly beautiful, but after some dialogue they took off running down a hill to meet another army and the camera panned back and i could very easily pick out which ten of the hundreds of charging horses were real and which were drawn in triangles, i could nearly count the triangles

      very similar to the effect while watching an animated film with lush painted backdrops: you see a forest scene and you just know that one tree branch is going to break off because it was painted by the animators and the hue and stroke is just slightly off

      i think efforts like the one in the article, and the one in the comment above linking the shinobi 3 video, may come prebaked into visual media

      i buy a copy of iron man 3 in the year 2071 and it will display on my super pixel screen in such a way to make it appear like it is being watched on the tech it was built for, smudging those lines between organics and triangles

      with the option to turn it off, then right back on again

fake-name 11 years ago

While this is technically awesome, I'd much, MUCH prefer to play without all the visual munging.

Nostalgia aside, CRTs didn't actually look that good originally. They weren't used for their visual effects, they were used because they were cheap and easy. Why would you actively make your content look shittier?

I suspect if you went back, and offered the people developing these games the option to play them on a modern display, without all the distortion and such, they'd much prefer it over the "CRT look".

At least, please, PLEASE let the player turn the effects off.

  • Karunamon 11 years ago

    >They weren't used for their visual effects, they were used because they were cheap and easy. Why would you actively make your content look shittier?

    What you're missing is that sometimes, the characteristics of a CRT are used for a visual effect that is completely missing on non-CRT displays.

    For instance, it's arguable that a lot of low-res 16 bit sprites actually look better when on a technically inferior display because that's what the developers were using - and they would have drawn the sprites with the blur in mind. You remove the blur, and the sprites are a bit harder to look at [1]. (Take any of the SNES Squaresoft RPGs for a good example of this.) Scaliness were often used as a cheap method of texture blending.

    A good description of this comes from here[2]: The chunky sprites with their often thick, cartoony outlines just weren't designed to be reproduced with sharp edges resulting from nearest-neighbor upscaling.

    [1]: http://www.tested.com/tech/gaming/2982-a-link-to-the-past-ho...

    [2]: http://cyber4education.blogspot.com/2010/12/crt-pixel-shader...

    It's your system and you can play your games however you want, but it's not in question that many games were designed to be played on older displays.

  • joshuapants 11 years ago

    If you gave the people developing these games the ability to have amazing 3D graphics they might not have bothered with pixel art in the first place. The limitations are part of the medium, and since they used those limitations to their advantage when making the game, you need to simulate them to make the game look right.

    And then you have modern games like the one posted here that aim to mimic those effects because they are now a style unto themselves. No need to denigrate it.

  • Sephiroth87 11 years ago

    Except developer totally used the CRTs limitations to their advantages for cool effects (transparency, more colors on screen than allowed, etc...), so having them enabled, while maybe not looking sharp, are how the game is actually supposed to look... Look at the first post for a concrete example

  • mrob 11 years ago

    CRTs, even high end ones, always had poor image quality. CRTs did however have superb motion quality, and it's only very recently with strobed 120Hz/144Hz LCDs that LCDs have matched CRT motion quality.

    • wtallis 11 years ago

      In what respect do you think CRTs had universally inferior image quality: viewing angles, contrast, brightness, gamut, color accuracy, spatial resolution, or something else?

      • mrob 11 years ago

        Viewing angles are usually better, but there are LCDs with good enough viewing angles that in practice neither is a problem.

        CRT contrast was markedly inferior at high spatial frequencies (as opposed to VESA contrast). The linked article is deliberately trying to simulate this. Even on aperture grille tubes this is obvious with pure white/black 50% ordered dither. This makes a big difference to legibility of text.

        Brightness is lower than most LCDs, and fades quickly with age if it's set too high. Gamut is lower than high gamut LCDs, and color accuracy is similar to good LCDs.

        Spatial resolution is much worse, especially as you can't benefit from sub pixel rendering. I've spent a lot of time tweaking CRT controls, and you can never get perfect focus and convergence across the whole screen. You can never get perfect geometry either, which is not an issue with LCDs.

        Comparing a high end CRT to a high end image quality optimized LCD (eg. IPS or VA), viewing still images, from a normal desktop viewing position, I'm confident that the vast majority of viewers will prefer the LCD.

      • pdkl95 11 years ago

        CRTs have significantly better motion and latency. The LCD ghosting problem is well-known, and while some more modern screen have minimized the problem, there can still be some ghosting errors depending on the input. Gamut doesn't matter when you have previous frames ghosting over thing

        More importantly, LCDs buffer a least one frame. Many buffer 3-5 frames (!). This can be a serious problem playing for video games or other interactive uses if you need to rely on well under 100ms late4ncy. Rockband/GuitarHero is the canonical example of this problem, where they had to develop various types of adjustable latency compensation into the later games. Bad firmware can make this unpredictable, too; it is common for the firmware to select different algorithms based on the name of the input that you're using. (e.g. and LCD might buffer fewer frames if [[ $input_name =~ /game/ ]].

        • mrob 11 years ago

          It's very common for LCDs to buffer, and if you're strobing then buffering at least one frame is required to prevent artifacts (although one frame at 144Hz is much less serious than one frame at 60Hz). However, there's nothing inherent in the technology that requires frame buffering and I've seen many benchmarks of LCDs with less than one frame of latency. If you look at high speed camera footage of LCDs you usually see them update with a CRT style raster scan:

          https://www.youtube.com/watch?v=nCHgmCxGEzY

          • pdkl95 11 years ago

            I should clarify - I am speaking about the 60Hz LCDs found ~everywhere. Unfortunately, I cannot afford one of the newer fancier >60Hz models, and so I have little experience with them.

            Once of the sources of multiple-frames of latency was the scaling/resampling stage that was needed to be compatible with non-native resolutions. Some of those algorithms are very slow. A friend of mine that makes FPGAs used in some LCDs has suggested that this slowness may be because the company making the monitor is too cheap to buy parts that were fast enough. That was a few years ago, though, so maybe these newer 144Hz monitors improved the situation.

  • bitwize 11 years ago

    > Nostalgia aside, CRTs didn't actually look that good originally. They weren't used for their visual effects, they were used because they were cheap and easy. Why would you actively make your content look shittier?

    For the same reason Quentin Tarantino is pouring much of his personal fortune into a movie theater that will run films in celluloid only. For the same reason vinyl is making a huge comeback. People think the shitty output is "richer", "warmer", and "more authentic"; and the better output is "cold" and "mechanical".

    It's post hoc justification of nostalgia: people want to recreate the experience they had when they first saw a movie/listened to a record/played a game. They want the thrill back, or at least a reminder of it.

    I'm guilty of this myself; when I run an xterm it's usually green (#7fff7f) on black or amber (#daa520, X11 color "goldenrod") on black, in a nice pixely font like Glass Tty VT220. Because I'm on a Unix system and want to feel the thrill of Unixing.

    • kragen 11 years ago

      Um, while someone might build a celluloid-only movie theater, I don't think it's going to be Tarantino. Celluloid is a high explosive, which is why it was abandoned in the late 1940s and early 1950s, and Tarantino has shown no signs of being suicidal.

  • pdkl95 11 years ago

    In a lot of the older systems (this was VERY common on the NES and SNES), the designers utilized some very heavy-handed dithering under the assumption that the dithering would be blurred heavily by both the CRT and the NTSC encoding. As these images demonstrate, the colors are incorrect if you skip emulating the NTSC chroma bleed.

    http://slack.net/~ant/old/ntsc-vs-palette/

    It was also very common to assume there wou9ld be darkening from the scanline effect on arcade machines, leading to brightness problem in the emulation of some ames.

  • drewolbrich 11 years ago

    bashtian, I suggest that you disregard fake-name's criticism. Do whatever you think looks best to you, and stick with it.

    • fake-name 11 years ago

      To be clean, I think this is quite cool. Just, if you're going to release it, give me an option to turn it off.

tdicola 11 years ago

I love these CRT shaders but have always wondered, has anyone thought about or worked on a physically accurate simulation of a CRT television? Something that takes a framebuffer as input and simulates the electric signals that control the magnets around the tube, how those magnets affect the electron beam, how the beam interacts with the shadowmask, etc. elements in the front of the tube, and finally how each individual phosphor on the screen is illuminated by the beam.

I wouldn't even worry about doing stuff in real time to start with, instead just focus on the most accurate physical simulation possible. Then use the learnings from the simulation to try to create more accurate shaders that any program could use for simulating CRT tubes.

  • rogerbinns 11 years ago

    Yes, they have. There are terminal emulators (Cathode) and a very accurate simulation as part of xscreensaver. See jwz's post about it - http://www.jwz.org/blog/2011/01/cathode-vintage-terminal-emu... - and a mirror of the file where it is implemented - https://github.com/danfuzz/xscreensaver/blob/master/hacks/an...

    The comments in that C file show just how much attention to detail was made.

    • tdicola 11 years ago

      Yeah that looks like a great start, especially with how the NTSC signal is generated and interpreted. I don't see much around simulating the electron beam and its interaction with the phosphors and front of the tube though. I imagine a truly accurate physical simulation would need to use monte carlo methods or similar techniques, almost like an advanced 3D renderer does for global illumination.

    • FireBeyond 11 years ago

      Everything I saw about Cathode (also available on the App Store) didn't seem to actually give much detail or confirmation that there was any simulation of those characteristics, more a "fast, accurate emulation", which could easily be a stereotyped / exaggerated experience.

  • _tzxu 11 years ago

    This ..... redefines the concept of "ray tracing" as I know it. An interesting proposition. Wonder if you could write a pov-ray module for this.

Animats 11 years ago

It's not a CRT thing, it's a NTSC thing. He seems to be trying to emulate NTSC (analog broadcast TV) color, not RGB. NTSC color signals have much lower bandwidth than the intensity signal. You can only go through the entire color gamut about 10 times across the width of the screen. So, for NTSC emulation, you should convert each scan line from RGB to YUV, then low-pass filter the UV component, then reassemble. You'll now have sharp edges where the intensity changes and fuzzy edges where the color changes, just like crappy old NTSC devices. This is strictly a horizontal phenomenon - in the vertical dimension, adjacent scan lines can be completely different colors without artifacts.

  • 6502nerdface 11 years ago

    I think TFA's also trying to emulate specifically CRT-related effects like phosphor glow/trails. Maybe sort of conflating NTSC and CRT effects into one "CRT simulation"

Aqwis 11 years ago

Why the motion trails? The Mario example doesn't have them and I can't recall any extreme motion trails from my days of playing console games on CRT TVs.

  • tadfisher 11 years ago

    The screenshots are exaggerated; you didn't notice them because they lag by only about a frame. They did in fact exist, because it took time for the phosphors to lose their excitation.

  • DiThi 11 years ago

    > One unfortunate downside to this implementation of trails is that it depends on having a consistent frame rate; it has been tuned for 60fps and will not behave exactly as expected at other rates or if vsync is disabled.

    It's a very subtle effect, and probably absent in more recent CRTs.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection