Zfast CRT shader - increase scanline beam width variability

First of all, just wanted to thank the author for his work on this shader. It’s been a godsend for the Raspberry Pi and other low powered devices like Intel NUCs.

My question is, is it possible to increase the scanline beam width variability by adjusting the shader? As I’m sure you know, on a CRT, the width of the scanline beam (the visible line) varies depending on the adjacent pixel color and the amount of energy being applied by the electron guns. The visible beam becomes wider over brightly colored pixels and thinner over darker colored pixels.

The shader replicates this effect very well with the following scanline pattern (at 5x vertical scale):

darkened line

unaltered line

darkened line

black line

black line

When the pixel is very dark, the darkened lines become almost black, so that when viewed at a normal distance, the darkened lines blend in with the black lines and the black lines appear to be thicker.

I’m wondering:

-What is the formula used for the darkened lines? Is a fixed value subtracted from the RGB value…? Or is a fixed % of the value subtracted? Or does the % of the value subtracted vary with the pixel color? Just curious how this works.

-Is it possible to make the darkened lines completely black when the pixel color is very dark, so that the visible line is actually thinner? I wonder if this would look good.

-Likewise, is it possible to darken the darkened lines less when the pixel color is very bright, so that the darkened lines are more or less unaltered from the original pixel color?

-Basically, is it possible to adjust my current settings to increase the scanline beam width variability? Or would this require an update to the shader…?

Any help from the author or anyone knowledgeable enough would be appreciated! :smiley:

edit: Oops, wrong category. Could someone please move this thread to the shaders category? Thanks!

I don’t think I can move things, unfortunately.

Anywho, I glanced around in the shader and I don’t see anything that would directly do what you’re wanting. However, there are a couple of magic numbers 2.-something down toward the bottom that you might try playing with.

2 Likes

Thanks!! Very helpful, as always. Good to see you’re still around. :smiley:

1 Like

I played around with it some, but there’s not much room for improvement- you can increase the number after “LOWLUMSCAN” to anything less than 4.00 before it explodes. This reduces brightness even further, however, and the shader is already at the limit of what my display’s backlight can compensate for when it’s cranked up to 100% (with the mask completely disabled). Oh well! I’ll just have to wait for an HDR display.

Unfortunately, I don’t know of any easy way (i.e., something we can use) to tell a display to activate HDR mode. I had hoped there would be a simple API call we could make, but that doesn’t seem to be the case. So, without being able to tell a display to function in HDR, we don’t have any way of actually benefiting from it even if a display has it, AFAIK.

That makes me sad :frowning: With 1000 Nit you could add scanlines and any mask effect you want and still easily compensate for the lost brightness.

EDIT: found this article which may be of interest.