[HN Gopher] Cathode-Retro: A collection of shaders to emulate th...
       ___________________________________________________________________
        
       Cathode-Retro: A collection of shaders to emulate the display of an
       NTSC signal
        
       Author : todsacerdoti
       Score  : 146 points
       Date   : 2023-11-13 13:14 UTC (9 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | fjfaase wrote:
       | NTSC was also known for its poor colour reproducability compared
       | to PAL due to how the color signal was modulated. PAL had
       | automatic control where NTSC often required manual adjustment in
       | case the hue was drifted. For that reason NTSC was often said to
       | stand for 'Never Twice the Same Color' or 'Never The Same Color'.
       | 
       | I wonder if any of the shaders also has this behavior of randomly
       | shifting the hue or an ability to change it by a give offset.
        
         | c-hendricks wrote:
         | Retroarch does have some NTSC filters (combined with
         | svideo/composite input) that are appropriately noisy.
        
         | phkahler wrote:
         | Fair point for home games. Arcade games skipped NTSC and just
         | used RGB on separate wires.
        
           | orbital-decay wrote:
           | A lot of home hardware had RGB as well. The variety of
           | hardware in general was pretty high, to the point that many
           | tricks pixel artists employed only worked on very specific
           | hardware combinations. Case in point:
           | 
           | https://www.youtube.com/watch?v=j-G02cjXpZ0
           | 
           | Notice the glass tubes at 0:47+. On the composite output,
           | they look smooth and have that rainbow effect. This only
           | worked on first revisions of the Megadrive; later ones had
           | better quality output, mostly losing the effect.
           | 
           | The same applied to displays - crispness, scanlines, bleeding
           | etc were all different.
        
             | pests wrote:
             | I didn't see your 0:47 reference and almost couldn't tellt
             | he difference but then it was obvious.
             | 
             | Isn't there a similar issue with sonic in front of the
             | waterfall not working correctly on emulators?
        
         | bogantech wrote:
         | As a PAL person I wonder if there are any shaders that give
         | Hanover bars
        
         | kloch wrote:
         | NTSC colors were bad - _really bad_ - but wideband bayer
         | filters + sRGB are the source of the mediocre colors we see
         | today.
         | 
         | We could have beautiful Kodachrome quality colors If we used
         | narrow-band RGB filters and a wide gamut (Rec.2020, or
         | Rec.2100PQ) colorspace. If you look at the spectral sensitivity
         | specs of Kodachrome film they are fairly narrow-band and
         | closely matched the perceptual sensitivity of human vision (CIE
         | 1931).
         | 
         | If you display an sRGB encoded image with Rec.2020 gamut
         | (without colorspace conversion) the colors will appear very
         | washed out. If you display a Rec.2020 encoded image on sRGB
         | (without colorspace conversion) it will appear oversaturated.
         | Separately, narrower and/or more widely spaced bandpass filters
         | will increase color saturation. It turns out that narrow-band
         | filters approximating the CIE1931 curves are a natural match
         | for the Rec.2020 colorspace. Since CIE1931 approximates how
         | humans perceive color the colors are also more _accurate_.
         | 
         | It was a "lucky" accident that the properties of CRT phosphors,
         | from which sRGB is derived were a good match for the wideband
         | color filters used in color video cameras.
        
           | zokier wrote:
           | There is good reason why many high end projectors use lasers
           | as light sources these days; you can't get much more narrow-
           | band than that.
           | 
           | https://www.christiedigital.com/about/display-
           | technology/las...
           | 
           | https://www.barco.com/en/inspiration/news-insights/barco-
           | res...
        
       | scoopr wrote:
       | I wonder if the composite emulation is good enough for
       | 8088mph[0][1][2]? :)
       | 
       | [0] https://www.youtube.com/watch?v=hNRO7lno_DM
       | 
       | [1] https://trixter.oldskool.org/2015/04/07/8088-mph-we-break-
       | al...
       | 
       | [2] https://int10h.org/blog/2015/04/cga-in-1024-colors-new-
       | mode-...
        
       | dylan604 wrote:
       | I'd love to see an option to have the image pincushion and
       | introduces a buzz in the audio from an video signal that was too
       | strong? That was one of my favorite. Everyone focuses on the
       | interlacing, giant pixels shapes, and the fun with chroma bleed,
       | but some of the most bizarre things could happen when you pushed
       | the analog signal too far. The 1 volt peak-to-peak was a rule for
       | a reason, and going past was possible. Terms like whiter-than-
       | white from pushing the video signal from a test pattern past
       | 100ire on a scope could cause issues with the combined RF
       | modulated audio/video signals. The most flagrant offender was
       | white text. If you were competent at your job, you never used
       | 8-bit 255,255,255 for white. That was out of bounds for NTSC, so
       | 235,235,235 was typical instead for white.
       | 
       | The next filter would be the infamous "broadcast safe" filter
       | that would clamp the video signal to video was not higher than
       | 100ire. Allowing for chroma clamping separate from video clamping
       | would be a bonus. Hell, just give the basic functions of a TBC to
       | the users. They don't need to understand what they are doing to
       | the signal so much as just a few knobs to get creative!
        
         | reactordev wrote:
         | Also, while the representation of the pixel grid is fairly
         | accurate, it's missing the chromatic aberration from the fact
         | that they were individual electron emitters of red, green, and
         | blue phosphor dots. Pushing the red channel _0.05f_ and the
         | blue channel _-0.05f_ on the _x_ axis should do the trick.
        
           | dylan604 wrote:
           | There's a fun technique in After Effects to separate the
           | image by channels, and then apply an effect turning the image
           | into grids of small circles. Nudge the red a couple of pixels
           | left, the blue a couple of pixels right, and then the green a
           | couple of pixels up. When these are merged back, you get that
           | very look you've described.
        
             | reactordev wrote:
             | Yeah, we can do it in the shader by taking the UV texcoord,
             | sampling the texture rgb, then using a _collector_ , add
             | the r, g, b values to the collector with the offsets in
             | uv's to return the pixel color. It's extremely easy to do
             | in HLSL/GLSL/WGSL/SPIRV/Metal. It can even be controlled
             | using a vector map for the offsets so you can tune it and
             | vignette the chromatic aberration around the edges of the
             | screen. Giving it that truly retro CRT arcade feel. The
             | more the spherical projection, the more aberration.
             | 
             | https://lettier.github.io/3d-game-shaders-for-
             | beginners/chro...
        
               | dylan604 wrote:
               | The first time I spoke with a 3D graphics type person
               | that started to talk to me a video engineer type person
               | about UV this UV that, I could not grok their use of the
               | chroma channels needing coordinate position. Just another
               | example of how terms get new definitions depending on the
               | field using them. To this day, my default for UV is
               | chroma related, not projection related, so I sometimes
               | have to re-read something in the right context.
        
         | foobiekr wrote:
         | The horrible sound of high frequency CRT screaming meant that I
         | couldn't go into many electronics areas or stores until the
         | nineties.
        
           | contravariant wrote:
           | Unbearable high frequency noise does tend to fix itself given
           | a few decades or so.
        
             | dylan604 wrote:
             | They were referring the fact that CRTs went the way of the
             | dodo, and flat panels replaced them. This high frequency
             | noise was a unique _feature_ of the CRT.
        
               | NobodyNada wrote:
               | > until the nineties.
               | 
               | CRTs lasted well into the 2000's. I think the reference
               | is to the fact that one loses the ability to hear CRT
               | whine as one gets older, since the upper frequency limit
               | of human hearing declines with age.
        
               | foobiekr wrote:
               | No, it's more an illustration that I was forgetting when
               | the transition occurred. In reality it was probably 2002
               | or 2004 before the pain stopped.
        
               | dylan604 wrote:
               | glad i was on the same page with you, and not like
               | everyone else making assumptions about your hearing
               | ability!! =)
        
               | eesmith wrote:
               | I suspect contravariant was making a joke that as you get
               | older, your ability to hear high frequencies gets worse.
               | After "a few decades or so" you likely won't be able to
               | hear the flyback transformer squealing at 15 625 Hz any
               | more.
        
           | dylan604 wrote:
           | At the end of my day at one of the post houses I was at
           | around this time, I had to ensure all of the monitors were
           | off. I could do it in the dark just by listening for this
           | noise and know if any where on or not. Some of the reference
           | monitors were never turned off though, and I had to ensure
           | they had the correct signal routed to them to avoid burn-in.
        
           | mytailorisrich wrote:
           | I had an Atari ST in the living room and sometimes I would
           | forget to turn the monitor off when I went to bed... but I
           | was always reminded by the high pitch noise I could hear all
           | the way in my bedroom.
        
       | DrNosferatu wrote:
       | What about PAL?
        
         | xcv123 wrote:
         | https://github.com/LMP88959/PAL-CRT
        
       | djbusby wrote:
       | Seems like a good spot to mention
       | https://github.com/Swordfish90/cool-retro-term
       | 
       | Cool Retro Terminal is a nice accessory for when doing recording
       | or screenshots - cause it looks cool. Can't use it as my daily
       | driver tho.
       | 
       | And enough settings in there you can make it look like your
       | favourite old one.
        
         | com2kid wrote:
         | I really wish cool retro term supported multiple tabs in MacOS.
         | 
         | I actually daily drive it, if you set things up just right it
         | is absurdly readable, more so than a regular terminal IMHO.
        
         | westurner wrote:
         | A similar theme for JupyterLab/JupyterLite would be cool
         | 
         | jupyterlab_miami_nights is real nice, too
         | https://anaconda.org/conda-forge/jupyterlab_miami_nights
         | 
         | DI's Synthwave station somewhat matches the decade:
         | https://www.di.fm/synthwave
         | 
         | Lighter almost solarized red for terminal text is also a decent
         | terminal experience IMHO
        
       | weinzierl wrote:
       | All these CRT emulations seem to be optimized for realtime
       | filtering (especially for retro gaming). What I am looking for is
       | a high quality CRT node for Nuke, Natron or Blender. Is there
       | something like that?
        
         | jfaulken wrote:
         | Check out MrmoTarius' work for Blender.
         | 
         | https://mrmotarius.itch.io/mrmocrt
        
       | layer8 wrote:
       | They should show comparison photos like the ones from
       | https://wackoid.com/game/10-pictures-that-show-why-crt-tvs-a....
       | 
       | Additionally, LCD and OLED have their own subpixel artifacts, so
       | I wonder if that has to/can be compensated for when displaying a
       | CRT emulation.
        
         | paol wrote:
         | Thanks! I once read this article and could never find it again.
         | 
         | The screenshots here are second to none for showing why the
         | quest to reproduce CRT rendering is so important for
         | preservation efforts. Without it graphics from this era simply
         | don't look even remotely as intended.
        
           | andai wrote:
           | The way it's meant to be played!
        
         | crazygringo wrote:
         | > _Additionally, LCD and OLED have their own subpixel
         | artifacts_
         | 
         | Can you elaborate? I've never heard anything about that,
         | regarding a regular grid of R/G/B stripes.
         | 
         | Or are you talking specifically about the weird PenTile
         | layouts?
        
       | jonwest wrote:
       | The "Death to Pixels" shader pack for Retroarch has done an
       | awesome job of tricking my nostalgia brain when playing old
       | games. (https://forums.libretro.com/t/cyberlab-death-to-pixels-
       | shade...)
       | 
       | I wonder if these are more efficient in sone way? Or accurate?
        
         | BearOso wrote:
         | I doubt there's much difference. Just implementation details.
         | The retroarch spec is a lot to code if you're just looking for
         | one or two shaders.
         | 
         | Also FYI: your link features a lot of shaders using the
         | megabezel presets, which are extremely unoptimized. The koko-
         | aio bezels in the same slang-shaders repository can do the same
         | effects, but with much better performance.
        
       | karmakaze wrote:
       | The shadow mask is overly represented. This may work better on a
       | yet even higher resolution display, or perhaps there's an option
       | to reduce the shadow mask effect. The other thing that this
       | emulation can't get right is that phosphor-based displays had
       | more vibrant colors (at lower intensities) than currently popular
       | (IPS) LCD panels. VA panels are better for this.
        
         | doublepg23 wrote:
         | I was blown away how _sharp_ an Apple ][ display is in person.
         | It's really hard to get across how cool it looks.
        
           | foobiekr wrote:
           | Amazingly, a classic first release Macintosh was vastly
           | worse. Blurry and visible scan lines/interlace.
        
         | crazygringo wrote:
         | > _The shadow mask is overly represented._
         | 
         | Is it? When I look up "CRT macro lens" on Google Images [1] the
         | shadow mask is extremely pronounced -- possibly even _more_
         | than here.
         | 
         | I've just tried looking at the screenshots on both a Retina and
         | non-Retina display, and they seem pretty faithful to what I
         | remember growing up. I'm really quite impressed.
         | 
         | Also -- what do you mean by "more vibrant colors"? If you mean
         | (presumably) greater color saturation = wider color gamut, I
         | can't find any source supporting the idea that CRT's had a
         | wider gamut than modern IPS panels -- to the contrary, IPS
         | seems to be at least as good if not better (although early LCD
         | displays weren't). And P3 IPS displays like Apple's certainly
         | blow CRT color gamuts out of the water.
         | 
         | [1] https://www.google.com/search?q=crt+macro+lens&tbm=isch
        
           | masswerk wrote:
           | Mind that CRTs had a viewing distance, much like the subject
           | point in classic painting. E.g., at this distance, dithering
           | tended to blend into a solid tint on common consumer CRTs.
           | (The granularity of a shadow mask is generally smaller than
           | that of a pixel/PEL, so there are actually two kinds of
           | rasterization involved, which helps blending. The effect also
           | depends on the shape of the mask, as in round, oval, square
           | holes, or even a Trinitron-style wire mesh.) Also, the
           | expectation to actually perceive CRT colors when reproduced
           | on a modern panel may be overly optimistic.
           | 
           | I'm generally impressed by these shaders (they are about the
           | best, I've seen), but I also think that colors are too muted
           | and that the mask is overrepresented.
           | 
           | Edit: Regarding CRT intensities, mind that a CRT set up for
           | daylight viewing would give you headaches when viewed in the
           | dark, which is hard to achieve with a modern display panel.
        
             | crazygringo wrote:
             | > _Regarding CRT intensities, mind that a CRT set up for
             | daylight viewing would give you headaches when viewed in
             | the dark, which is hard to achieve with a modern display
             | panel._
             | 
             | Are you suggesting CRT's were _brighter_ than modern LCD
             | screens?
             | 
             | That's not the case at all. Average consumer CRT's were 100
             | nits, the super-bright ones in the 2000's around 200 nits.
             | While your cheapest MacBook is 400 nits, and iPhones have
             | been over 600 for a long time. (Current cheaper laptop
             | brands can be lower around 200 today though.)
        
       | unixhero wrote:
       | I never understood why anyone would want interlaced mode. Can
       | someone enlighten me?
        
         | bogantech wrote:
         | It doubled the amount of lines that could be displayed on
         | screen back in the day.
         | 
         | It usually doesn't look that bad if there aren't any thin
         | horizontal lines imo
        
           | unixhero wrote:
           | Yes now that you say it. It was possible to go higher on VGA
           | also and get dithering. And it was also the case for the
           | vieeo out on composite or svideo. The result was barerly
           | readable mud.
        
         | whaleofatw2022 wrote:
         | The biggest value is when you are emulating hardware that
         | output to such a display. Often the designers of software
         | (especially games) optimized their art for the display.
         | Castlevania Symphony of the night is one of my more favored
         | examples of this, look up a crt-lcd comparison
         | 
         | Aside from thqt, maybe artistic looks for new video...
        
         | dbcurtis wrote:
         | People notice flicker below about 50Hz. So two 1/2-frames at 60
         | Hz gives flicker-free viewing of 30 fps video. The "light
         | chaser phenomenon" kicks in at 15 Hz, so that is the minimum
         | full-frame rate for the illusion of smooth motion.
        
       | malkia wrote:
       | My son (15) got hooked up on using old-"tv" effects, but he was
       | not happy with existing shaders, Adobe Premiere / After Effects /
       | etc, so by pure luck one day driving home saw an old Cathode
       | TV/VHS combo boxset left outside for someone to pick up - and
       | I've got it - the VHS does not work, but he's now happy with
       | doing the effects he wants (plus old Hi8 camera for others).
        
       | pdntspa wrote:
       | I always hated the weird fuzziness, soft lines, and curved image
       | that old TVs imparted on games, it is amazing to me that entire
       | communities have been built up around it. When I started playing
       | games on an emulator and pixels were hard and square and the
       | image was actually flat, I was like YES!!
        
         | c-hendricks wrote:
         | It's interesting, because artists on some games accounted for
         | the fuzziness and used it to their advantage. You should play
         | them how you want of course, but for something like Gameboy
         | emulation I absolutely turn on shaders to avoid the nasty
         | black-and-white.
        
           | pdntspa wrote:
           | Is a shader really needed just to get the correct color
           | palette? That should be a simple LUT
        
           | crazygringo wrote:
           | > _because artists on some games accounted for the fuzziness
           | and used it to their advantage_
           | 
           | Everybody repeats this, but I've honestly never been
           | convinced.
           | 
           | Different screens and different systems had different types
           | of different degrees of fuzziness. Designing for it seems
           | like it would be impossible.
           | 
           | I've never once seen an example of pixel art that looked good
           | crisp and bad fuzzy, and then was somehow modified in a way
           | to look _worse_ crisp and yet _better_ fuzzy. It doesn 't
           | even make sense to me how that could be.
           | 
           | I'm happy to be proven wrong, but I need to see an example
           | with my own eyes. And I've never seen anybody demonstrate it
           | with a 2x2 example like that.
           | 
           | Super Mario on a crisp LCD has always seemed aesthetically
           | better than on a CRT. Not as nostalgic, sure. But nothing
           | feels lost artistically -- to the contrary, it's clearer.
        
       | bane wrote:
       | I love the current infatuation with modeling old CRT display
       | systems. Old graphics and videos from the "time before" rely a
       | bit on how those display systems and signals worked in order to
       | make low-color and resolution artifacts look "better" in terms of
       | smoother color gradients and softer edges and diagonals. The
       | shift to modern displays mades everything form that era look
       | blocky and chunky.
       | 
       | The thing that makes this all really "meta-interesting" is that
       | everybody who remembers that time remembers it differently and so
       | there's no "correct" way to do this. We all had different TVs,
       | monitors, different manufactures from different time periods.
       | Some of us played color 16-bit games on tiny black and white TVs,
       | or remember the flicker of the Atari 2600 on a giant RGB front-
       | projection TV.
       | 
       | As a result we have literally thousands of filters like this that
       | try to reproduce or at least model how these old systems looked
       | to give back some semblance of what we remember, even if it's all
       | entirely wrong.
       | 
       | I found after experimenting with a bunch of this that what seems
       | to be more important than all the phosphor glow, scan lines, and
       | shadow mask stuff, is that the display has to be curved for it to
       | finally _click_ with me. And then having reflections of the
       | screen in the bezel are _chef 's kiss_. It's so subtle, but just
       | those two effects alone seem to do more for me personally than
       | the rest.
       | 
       | The Megabezel project is dedicated to what I'm talking about.
       | 
       | http://www.megabezel.com/
        
         | andai wrote:
         | >having reflections of the screen in the bezel are chef's kiss
         | 
         | At first I thought this was a strange thing to ask for, but
         | then I saw the image in the link and suddenly I agree 100%.
         | This is beautiful!
        
       | winstonrc wrote:
       | I'm really excited by the current appreciation of CRTs. There is
       | something so nostalgic about them that matches the warmth of
       | listening to my favorite vinyl. I have had much more fun playing
       | SNES and Genesis via my MiSTer on a PVM than I have had playing
       | most modern games on an OLED display (although OLED is
       | unquestionably beautiful, and I'm looking forward to the OLED
       | Steam Deck).
       | 
       | My biggest concern with my current setup is what will happen when
       | my PVM dies? Will there be anyone around to fix it? Will I trust
       | myself to safely open it up and fix it? The PVM I have isn't
       | _too_ large, but it's certainly more heavy and inconvenient than
       | a modern display. I'm really excited by the excellent work
       | towards recreating how good CRTs look to preserve this bit of
       | history and also provide another artistic option for future games
       | to consider.
        
       | mike_hock wrote:
       | Should be integrated into CRT (the terminal emulator).
        
       ___________________________________________________________________
       (page generated 2023-11-13 23:00 UTC)