from Hacker News

CRT Simulation in a GPU Shader, Looks Better Than Black Frame Insertion

by bangonkeyboard on 12/25/24, 1:26 AM with 88 comments

  • by user_7832 on 12/25/24, 6:31 AM

    Just a mini-warning/FYI: running the 120hz test on my 60hz LCD IPad (Air 4) has caused that part of the screen with the crt effect to flicker even after leaving the demo. I don’t know what might cause this but it’s weird and worth a warning to anyone interested in trying this out.

    (The flickering is more obvious when the control centre is opened, I managed to take a video of it but it’s only partially clear in it. It’s been about 5 minutes so far and I think the effect has reduced. I’m also quite perceptive to flickers so others might not notice it.)

  • by modeless on 12/25/24, 6:21 AM

    Looks way more flickery than a real CRT at 120 Hz on an OLED phone. Maybe 240 Hz would be better.

    Edit: I misunderstood and was running the 240 Hz version at 120 Hz. The 120 Hz version doesn't flicker noticeably. It does seem to reduce motion blur for 60 Hz content with a brightness penalty. It doesn't immediately make me feel like I'm looking at a CRT. Maybe it would if I had a 480 Hz monitor. There is a slight rolling banding artifact on my phone, maybe an artifact introduced by the display controller as described in the article.

  • by blensor on 12/25/24, 11:26 AM

    I assume some people will approach this as stupidly as I did.

    I wanted to see something and clicked on the 120Hz version not knowing what my laptop display actually is and while I am not photosensitive this was quite uncomfortable. Thinking I don't understand what that is supposed to be I clicked on the 480Hz to see if that is better/different and that was even worse. As a hail mary I clicked on the 240Hz and well that really made sense and was actually comfortable to look at.

    So if you are like me and didn't really read through the text, this will only work for you if you select the Hz that matches your display ( which kinda is the whole point of why they are doing that ). If it looks bad you clicked the wrong link

  • by BlurBusters on 12/27/24, 7:08 AM

    I'm the author of this shader, here's some tips:

    - Throw as much native:emulated Hz ratio as you can.

    - 120Hz = up to 50% blur reduction

    - 240Hz = up to 75% blur reduction

    - 480Hz = up to 87.5% blur reduction

    - Calibrate your black levels and white levels (e.g. via TestUFO PLUGE test and White Level tests), since you need all of the levels for the simulated phosphor fades.

    - Use SDR mode, not HDR, the math in the shader is designed to the Adobe sRGB curve. I wish I had more direct access to the complex HDR curves and ABL to auto-compensate for Talbot Plateau Theorem.

    - Use odd number native:emulated Hz ratio on LCD to make it immune to image retention + slightly better behaviors with LCD 6-bit FRC

    - Adjust Gain-vs-Blur and gamma, if there's problems. Using low Gain-vs-Blur will reduce color ghosting. Use 0.5 for 120Hz, and if you're getting too many artifacts, try testing numbers as low as 0.25 for 240Hz to see if color ghosting problems disappear. (A fix will be coming)

    - Artifacts reduce dramatically at 480Hz versus 240Hz vs 120Hz, more Hz really helps CRT simulation. More Hz the merrier, for BYOA (Bring Your Own Algorithm approaches)

    There will be an improved version of my shader on Github, involving:

    - Global refresh mode (like a phosphorescent BFI)

    - Color balancing modes

    - Black level lifter (to fix any thin dark bands caused by violations to Talbot-Plateau Theorem due to certain displays' crappy handling of below-2% greyscales, etc)

    Keep an eye out for it in January 2025, just star the Github repo or wait for Retroarch (etc) to implement the improved version of my shader (after I'm finished deadline work for a client at CES 2025)

  • by BearOso on 12/25/24, 6:33 PM

    I adapted this to a retroarch slang shader really quick, and I'm seeing some pretty persistent banding on 120hz to 60hz. It shows up obviously when scrolling the same direction as the fake beam scanout. If you take the shadertoy version and edit the scanout direction to left-to-right and fullscreen it, you can see it there, too. The perpendicular scanout and scrolling the demo uses by default disguises it pretty well.

    I guess you probably need a higher ratio for this to work really well.

  • by pavon on 12/25/24, 5:01 PM

    Awesome. I find it so ironic that the main thing tempting me to buy to a high resolution high framerate monitor is the desire to better emulate a low resolution low frame rate CRT.
  • by redox99 on 12/25/24, 7:25 AM

    This looks REALLY good on a 240hz monitor. Much better than BFI (which I don't use because it's pretty bad on my monitor)
  • by ahartmetz on 12/25/24, 12:58 PM

    Ignoring the heavy flicker, it seems to reduce motion blur even with the 120 Hz demo running on a standard 60 Hz display. Especially visible on the windows. It doesn't seem like it should work, but it does?

    But I find it hard to say that what it's supposed to look like. Motion blur is considered fine and correct in the "film look". Our eyes do crazy processing and can't really be emulated by a display technology without going to crazy lengths with high DPI, high dynamic range, high refresh rate (to emulate certain effects, not because we can properly see 90+ or so Hz) and probably eye tracking.

    I think I like the slight (static) pixel blur of CRTs more than the motion-related behavior. The crazy DPI numbers of state of the art screens are seemingly not so much about showing detail than about hiding pixels. Calculating all of these pixels is, in a way, a waste of work. I'm talking about ~100 DPI, i.e. making a decent resolution look nicer, not about making low res crap look blurred instead of pixelated.

  • by vslira on 12/25/24, 4:09 PM

    I’m a complete layperson on graphics and such, so please someone help me here: does this mean we’re now able to simulate old video game visuals on crt? That would be the best Christmas gift ever
  • by yincrash on 12/25/24, 2:45 PM

    The 120Hz shadertoy works on the Pixel 8 (and hopefully other 120Hz Android devices) if you go to Developer Options and enable "Force peak refresh rate"

    I wonder if there's a way to ask Android Chrome to ask for 120Hz.

  • by nyanpasu64 on 12/25/24, 4:55 AM

    I'm still interested in a "selective MPRT" GPU or monitor setting, that only does black frame insertion on changed parts of an image and a "safety margin" around them. This should reduce flicker on non-moving portions of an image/still screen while keeping moving portions sharper. But this probably isn't useful for office tasks, perhaps video, and high-framerate gaming (but only games running at a lower FPS than the screen can (partially?) redraw).
  • by stuaxo on 12/25/24, 12:33 PM

    I've thought for a while that we need to simulate how phosphorus face in and out, at the very least.
  • by naoru on 12/25/24, 1:15 PM

    This is better than BFI, although 120Hz demo on my screen looks like it's just alternating two or three parts of the image. Maybe there is a way to use fake interlacing to make it look convincing.

    240Hz demo in 144Hz mode looks flickery but much more realistic.

  • by Hakkin on 12/25/24, 5:15 PM

    I have an AOC Q27G3XMN and while I do get reduced motion blur from this, I also experience very bad color banding/shifting. Messing with some of the values in the script config makes it slightly better, and changing the overdrive setting on the monitor seems to affect it as well, but there is still pretty strong banding no matter what strength it's on. I tested on my phone (Pixel 8) and it works very well there without any banding or color weirdness, so I guess it's just something about this particular monitor that doesn't work well with this method.
  • by stelonix on 12/25/24, 7:27 AM

    Tried on my simple 60Hz PC screen and also on my phone with OLED screen and sadly, it's just a flickering image. Will try later this week on my friends' retrogaming setup. Looks promising
  • by phafu on 12/25/24, 11:34 AM

    I'm wondering if it would rather make more sense to emulate a CRT with a video projector and some shutter device (maybe a fan?) in front. Has anyone tried that yet?
  • by jtxt on 12/25/24, 5:09 PM

    Nice! Does-this/can-this handle interlacing?

    https://en.m.wikipedia.org/wiki/Interlaced_video

    (Half vertical resolution, offset a bit every other frame)

  • by akoboldfrying on 12/25/24, 10:31 PM

    Can anyone explain why this requires a relatively high-end GPU? Looking at the slo-mo GIFs, it looks like `brightness *= SomeLUT[(y + t) % sizeOfTheLUT]` for each colour channel would do the trick.

    What makes it so complicated?

  • by kristopolous on 12/25/24, 6:14 PM

    Just start making CRTs again. There's clearly consumer demand
  • by zanfr on 12/26/24, 4:40 PM

    It's cute but on my AOC (at 120hz) the discoloration is substantial. Also any inconsistency in frame time will break the illusion
  • by isoprophlex on 12/25/24, 10:13 AM

    This probably goes without saying but...

    If you have photosensitive migraine or epilepsy, stay the hell away from those demos.

  • by dsp_person on 12/25/24, 3:55 AM

    I tried the 120Hz demo but can't really tell there's any effect. Does it look cooler with 240Hz?
  • by c22 on 12/25/24, 7:50 AM

    Can I use this to play Duck Hunt?
  • by op00to on 12/26/24, 4:25 PM

    Could this be used to simulate CRT displays in video game cabinets?
  • by brcmthrowaway on 12/25/24, 4:35 AM

    I just see a flickering image. What am I missing on iPhone?
  • by amelius on 12/26/24, 5:27 PM

    > Q: It looks like crap! Why?

    > A: You need a bright display, try a 240Hz+ OLED. Also some local dimming LCDs have a backlight lag that sometimes interferes with quality.

    Come on now. If you can simulate a CRT then surely you can make it look nice on a conventional monitor?

  • by kizer on 12/25/24, 6:10 PM

    Could someone explain the point to me? I read the post and still don’t quite understand. I remember CRTs looked smoother when pixels were still noticeable in (o)led displays. Is it to effectively lower the frame rate?
  • by londons_explore on 12/25/24, 4:26 PM

    To me this highlights that none of my hardware (pc, phone laptop) can actually render anything at native screen resolution and not occasionally drop frames.

    Can we please design software to be frame-drop-free? Ie. if it drops a frame, even once, send a bug report to the developer to fix it, and if he cannot, refund me for the hardware?

    My analogue TV from 1956 does not drop frames, I can assure you.

  • by cmiller1 on 12/25/24, 9:50 PM

    Now add different phosphor decays on the black parts for each subpixel!
  • by Stevvo on 12/25/24, 11:52 PM

    Please flag. A couple of commenters damaged their displays, and a photosensitive person may have damaged themselves. The risks outweigh the benefits of having it up for discussion.