
CRT simulation (2014) - bashtian
http://www.piratehearts.com/blog/2014/03/28/crt-simulation/
======
tadfisher
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](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-...](http://static.giantbomb.com/uploads/original/0/4527/1093273-super_metroid___title_screen_550x.jpg)

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.

~~~
rasz_pl
>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
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.

------
fake-name
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.

~~~
mrob
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
In what respect do you think CRTs had universally inferior image quality:
viewing angles, contrast, brightness, gamut, color accuracy, spatial
resolution, or something else?

~~~
pdkl95
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
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](https://www.youtube.com/watch?v=nCHgmCxGEzY)

~~~
pdkl95
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.

------
tdicola
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
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...](http://www.jwz.org/blog/2011/01/cathode-vintage-terminal-emulator/) \-
and a mirror of the file where it is implemented -
[https://github.com/danfuzz/xscreensaver/blob/master/hacks/an...](https://github.com/danfuzz/xscreensaver/blob/master/hacks/analogtv.c)

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

~~~
tdicola
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.

------
Animats
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
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
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
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.

~~~
herpaderpa

      > you didn't notice them
    

There are four lights.

[http://en.wikipedia.org/wiki/Asch_conformity_experiments](http://en.wikipedia.org/wiki/Asch_conformity_experiments)

...anyway, the apparent presence of the motion trails would depend heavily on
a person's use of the brightness, contrast and saturation setting per each
individual television set.

