top | item 32969342

Simulating a CRT TV with C++ and OpenGL

68 points| ingve | 3 years ago |nicktasios.nl | reply

51 comments

order
[+] 323|3 years ago|reply
Has author actually seen a CRT TV image in real life?

Because it didn't look like that, you didn't have those clear distinct lines.

Color CRT displaying a game, no lines: https://i.imgur.com/eI2yb7Y.jpeg

Black & white CRT, you can barely make out the lines: https://d23gn3985hkc32.cloudfront.net/wp-content/uploads/202...

[+] Asooka|3 years ago|reply
Some CRTs do have visible scanlines, some do not. Check out this thread https://shmups.system11.org/viewtopic.php?f=6&t=63197 . Personally I'd like the simulated CRT to have no scanlines, rather what I want is temporal ghosting (previous frame blending in the next one, used for transparency effects in games by blinking two images rapidly); and a filter to make pixels less blocky and implement colour bleed. Given the great number of CRTs out there you probably can't have a single one be the best ever, but perhaps emulating several known ones by twiddling the parameters of the shader and letting people pick would be the best.
[+] mras0|3 years ago|reply
Guess it depends. I haven't had a CRT TV for many years, but I have an old multisync CRT monitor and I can clearly see the individual raster lines (close up of 320x200 progressive scan: https://i.imgur.com/Osc4ZMm.jpeg). At normal viewing distances it's not noticeable though.
[+] an1sotropy|3 years ago|reply
Another way to think about the horizontal scanlines is that within the lines, there is really a continuous analog signal, undergoing various (analog) filters along the way from initial detection up through final display, but between scanlines there is discrete sampling. This can be emulated by digital filters, but even if the final display doesn't show the scanlines, there should be a different point-spread-function in the horizontal versus the vertical direction.

There's also the possibility of emulating how the time resolution could be less than the refresh rate (sometimes sluggish phosphors create a kind of motion blur).

Really old tv transmissions also had an effects like a high-pass filtering (I think to show better detail within limited dynamic range)[1], and how really bright spots would be surrounded by dark halos [2]. The distinctive "look" of old TV has a lot to do not just with the CRT display, but the characteristics of the analog method of video signal generation, in a video camera tube [3] that had its own cathode raw sweeping across the source image.

[1] look at the edges of the desk at around 0:36 in https://www.newsweek.com/wmttv-black-white-color-first-time-...

[2] https://movies.stackexchange.com/questions/113358/whats-with...

[3] https://en.wikipedia.org/wiki/Video_camera_tube

[+] bjt2n3904|3 years ago|reply
Yeah -- it seems that so many of the CRT simulations way overemphasize the scan lines. I think if they added a bit of "bloom" to each pixel, it would make them less obvious?
[+] naikrovek|3 years ago|reply
I had a consumer CRT as a child (the family TV in the living room) whose scanlines were apparent even at 6ft away, and it was only a 19" screen.

maybe my eyes were better than most, I don't know, but I distinctly remember trying to adjust the settings so the lines would go away, thus reducing the annoyance of my "all I can see is colored lines" brother.

[+] werdnapk|3 years ago|reply
I recall as a kid, getting right up close to the screen and looking at the picture on the TV and noticing the lines. Further away from the TV, then yes, the lines were not visible.
[+] SyneRyder|3 years ago|reply
> Color CRT displaying a game, no lines: https://i.imgur.com/eI2yb7Y.jpeg

Try loading the 4000x3000 version of that image you linked and zooming to full size. Especially on the green character's outfit, you can see the scanlines on that color CRT display.

[+] kevin_thibedeau|3 years ago|reply
That is a late 90s television with a small tube. You can most definitely see the scanlines on old arcade CRTs. The shadowmask on a color CRT enhances the lines so comparison to B&W isn't meaningful.
[+] ogurechny|3 years ago|reply
Along with different properties of the beam other comments mention, there was also a question of dot pitch, i. e. properties of the phosphor grid. Also, the circuits generating the signals in consumer hardware often did not have that much of the full bandwidth, or the most correct wave forms.
[+] hulitu|3 years ago|reply
It seems that he didn't. And he also does not understand how a cathodic tube works (i.e. persistence).
[+] MarkusWandel|3 years ago|reply
This may not be perfectly realistic, but it's getting close and can be made closer. Not long ago, replacing a dead 26" colour CRT (say, in an arcade game machine) with a suitably masked 4K LCD panel would have been ludicrous. But we're pretty much there now.

I thought when incandescent bulbs pretty much went away that I would miss the bare filament in a clear bulb look. I kind of do, but not much. I have a chandelier with the fake-filament LED type bulbs in it. Despite dubious cooling of the LEDs they seem to be holding up just fine in extended use, and while it doesn't look quite traditional, it's good enough.

And emulation of older video game systems has moved into the browser!

[+] mrandish|3 years ago|reply
Wow, I consider myself a pretty obsessive retro-gaming enthusiast (a custom-built arcade with 25-inch multi-scanning CRT, hacked graphics card and hand-tweaked GroovyMAME build) but damn, physically simulating a cathode ray tube is next level. Respect.
[+] simonblack|3 years ago|reply
but damn, physically simulating a cathode ray tube is next level. Respect.

Definitely. While I have simulated monitor screens that were originally physical CRTs, I still simulated them as though they were digital monitors with defined pixels.

Definitely respect.

[+] some-guy|3 years ago|reply
I used a CRT for the first time in a long time a few months ago (embedded in a PowerMac 7200 all-in-one), and I forgot how stunning the picture looked compared to LCD/LED screens throughout the 2000s.

Big problem though, I forgot how much they made my eyes _hurt_. I couldn't handle using it for more than 30 minutes. Increasing the refresh rate to 75hz helped a little bit, but wasn't enough to get me to stop causing a headache. I'm all for nostalgia but I think in the end it is good that we moved away from CRT technology (for many reasons).

[+] anthk|3 years ago|reply
NFSU2 on CRT looked glorious and vibrant. On LCD's it's pretty much bland and faded off.
[+] atum47|3 years ago|reply
I did a project a few weeks ago where I was trying to emulate CRT images as well. End up creating a CRT converter for still images.

https://victorribeiro.com/CRT/

I guess each one of us remember CRT a little bit differently, since my images end up with vertical stripes instead of horizontal ones.

[+] dtx1|3 years ago|reply
Quite interesting. The hardest part would probably not be the simulation but actually displaying what is simulated (in real time). You would need pretty high peak brightness and an insane refresh rate.
[+] jeroenhd|3 years ago|reply
I think modern (HDR with loads of nits of brightness, 144+ fps) gaming monitors should be able to get the effect down quite well. Nothing you'll find in a productivity oriented laptop but with the right tools you should be able to come quite close.
[+] jeffbee|3 years ago|reply
These seem to regularly pop up on HN but the new ones never seem to describe the ways in which they differ from the now-20-years-old xanalogtv hack.
[+] ncmncm|3 years ago|reply
I was hoping it would distort the image to round the corners and compress the edges.

Extra credit for added snow.