Scanlines: A Guide (how to min/max)

Scanlines: A Guide

Note: here “scanline” is used to refer to the black gaps between lines.

This guide will provide step-by-step instructions for making scanlines either as thick as possible or as thin as possible for the display being used. Of course, most people will prefer something in the middle, but understanding how to get min/max thickness will make it easier for the user to obtain the desired results.

This guide refers to settings used by the guest-dr-venom shader, but it can be applied to other shaders. The names of the settings might differ but the basic concepts are the same. Dogway’s grading shader is required; scoll to the end of this post for links to everything you’ll need. All the test patterns referred to here can be found in Fudoh’s 240p Test Suite (link at the bottom).

A calibrated display is required to get the best results. If the display has a backlight setting, it is recommended that this be adjusted to 100% before adjusting the scanlines.

If you’re particular about how the scanlines look, then start by defining the scanlines before moving on to any color-related work. If you’re seeking to maximize dynamic range, then save the scanlines for last. See section on “dynamic scanlines.”

For best results, integer scaling and 5x or higher vertical scale is recommended. Scroll to the end of the post for additional info and tips to improve image quality.

Feedback and suggestions are welcome :slight_smile:

Minimum TVL/scanline thickness

Start with the following settings. Anything not listed should be left at the default setting.

horizontal glow grade: 0
vertical glow grade: 0
raster bloom %: 0
bright boost dark pixels: 1.00
bright boost bright pixels: 1.00
scanline type: 2.00
beam shape low: 15.00
beam shape high: 23.00
scanline dark: 1.00
scanline bright: 1.00
increased bright scanline beam: 0.00
curvaturex: 0.00
curvaturey: 0.00
glow strength: 0.00
CRT mask: -1.00
bloom strength: 0.00
scanline saturation: 1.00
  1. display the “color bars” test pattern
  2. gradually lower “beam shape high” until the scanlines over the “F” column disappear over one or more colors. Then raise beam shape high by 1.00.
  3. lower “scanline bright” by 0.05 and then lower “scanline dark” by 0.05. Continue lowering them gradually, alternating between the two, until any scanlines over the “F” column disappear. Then raise the lower of the two values by 0.05. The scanlines under the F column should now all be visible.
  4. If you want the scanlines to be darker, follow the process in reverse. Gradually raise “scanline bright” and “scanline dark” until the scanlines are as dark as desired.

Maximum TVL/scanline thickness

Start with the following settings. Anything not listed should be left at the default setting.

horizontal glow grade: 0
vertical glow grade: 0
raster bloom %: 0
bright boost dark pixels: 1.00
bright boost bright pixels: 1.00
scanline type: 2.00
beam shape low: 15.00
beam shape high: 23.00
scanline dark: 1.00
scanline bright: 1.00
increased bright scanline beam: 0.00
curvaturex: 0.00
curvaturey: 0.00
glow strength: 0.00
CRT mask: -1.00
bloom strength: 0.00
scanline saturation: 1.00
  1. display white screen test pattern
  2. gradually increase “scanline dark” and “scanline bright” by 0.05 at a time, alternating between the two. Measure the light output of the screen with a light meter or smartphone app with each adjustment made until the light output falls below the desired target.
  3. reduce the higher of the two values by 0.05. The scanlines should now be as dark as possible while still maintaining adequate brightness. You can also eyeball this- you just want white to be really white. If using a light meter, 100 - 120 nits is a good target.
  4. check “color bars” test pattern for any artifacts. If there are any artifacts, gradually lower “scanline bright” and “scanline dark” until there are no artifacts present. (Scanline patterns can cause artifacts with some displays with some configurations)
  5. If you want the scanlines to be lighter, follow the process in reverse. Gradually lower “scanline bright” and “scanline dark” until the scanlines are as dark as desired.

Dynamic Scanlines

These settings will maximize the beam width variance and dynamic range in the image. Do this if you want the best possible objective picture quality. These are the settings I use for all systems.

horizontal glow grade: 0
vertical glow grade: 0
raster bloom %: 0
bright boost dark pixels: 1.00
bright boost bright pixels: 1.00
scanline type: 2.00
beam shape low: 15.00
beam shape high: 5.00
scanline dark: 1.30
scanline bright: 0.70
increased bright scanline beam: 0.00
curvaturex: 0.00
curvaturey: 0.00
glow strength: 0.02
CRT mask: -1.00
bloom strength: 0.00
scanline saturation: 1.00

You don’t need to do anything else to these settings, but you might be able to expand the dynamic range a little bit further by raising the scanline dark parameter a bit and/or lowing the scanline bright parameter a bit. Display color bars when making any adjustments to ensure that there’s no clipping or crushed blacks and no eye strain when attempting to distinguish any of the color bars.

Helpful links

GTUv50 test program

Fudoh’s 240p Test Suite.

Dogway’s Grading Shader

Modular Image Adjustment Shader

12 Likes

I recall seeing a sin or cos method for scanlines, was that better for low resolutions? I just had this thought of recreating slotmask with the same method

4 Likes

Don’t know :slight_smile:

@guest.r or @hunterk might be able to shed some light on this…

3 Likes

Are you suggesting doing an aligned slot-mask with this? As I think an unaligned slot-mask would be more complicated with this.

As I’m assuming you’re going do what amounts to vertical (scan)lines for this slot mask method right?

If I’m wrong, just carry on, there’s nothing to see here, lol.

2 Likes

Yes, aligned. I would take the pattern I just posted in the other thread and recreate with a cos, mask out with another rotated cos of 1/4 thickness or so in even patterns. But I don’t know how it relates to subpixel accuracy, if it’s worth trying.

2 Likes

Yeah I thought you were talking about an aligned mask, as I saw your screenshot in the other thread. Just didn’t feel like commenting as I didn’t really have anything to add there besides, nice screenshot, lol.

Sounds like a cool idea to me.

1 Like

You can have nice scanlines with this method, there might even be some advantages related with the fact that these functios can reach zero values (exp or exp2 are non negative), but there might be much tweaking if you want to have regular dynamics with sine or cosine. In the end effect you can use other functions as pow or smoothstep… If you know your function you can use some of them which shader HW supports. Exp(2) is very nice for non-integer scaling though, nice variations are possible. You might use sine or cosine for a fast and edgy setup.

5 Likes

Updated the instructions with a better method for maximizing the beam width variation. Happy to discover that Trinitron-like beam dynamics are very achievable at 5x scale! :slight_smile:

2 Likes

I followed the instructions to get Minimum TVL/scanline thickness Sem-t-tulo

It looks good for me but I want your professional opinion!

2 Likes

@JHorbach1

Perfect!

Now you might consider doing some color grading.

2 Likes

Thanks for the guide @Nesguy!

2 Likes