Please show off what crt shaders can do!

I think the only real way to judge settings is by using Fudoh’s 240p Test Suite and a variety of games. It’s important when using games to calibrate that you only use things from the same region, gamma and color temp varied by the standard used (PAL, NTSC, NTSC-J) so you should wind up with 3 different presets. Even then, some developers made weird choices and you may find that you want to do some color correcting of your own.

A 20" TV from the 1980s had probably 2 phosphor triads per scanline. At 8x (vertical) scale we can use this pattern to get a pretty good approximation of a slotmask.

image

I think this is the best pattern to use; the magenta/green one really over-represents the crossbars.

You’ll want to get a display with very high SDR brightness (1000 nits) to do black frame insertion + scanlines + phosphor emulation. AFAIK only the Samsung QLEDs are capable of that, and they also have the specs for gaming (input lag, refresh rates, etc). They’re not perfect, though, and I’m really hoping that dual-layer LCD or microLED is commercialized eventually. I would also strongly recommend avoiding a matte screen, it really puts a damper on CRT emulation IMO.

1 Like

I stopped being lazy and added grade.

shaders = "7"
shader0 = "shaders_slang/misc/grade.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "shaders_slang/crt/shaders/guest/crt-gdv-new/afterglow0.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = "AfterglowPass"
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "shaders_slang/crt/shaders/guest/crt-gdv-new/pre-shaders-afterglow.slang"
filter_linear2 = "false"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = "LinearizePass"
float_framebuffer2 = "true"
srgb_framebuffer2 = "false"
scale_type_x2 = "source"
scale_x2 = "1.000000"
scale_type_y2 = "source"
scale_y2 = "1.000000"
shader3 = "shaders_slang/crt/shaders/guest/crt-gdv-new/avg-lum.slang"
filter_linear3 = "true"
wrap_mode3 = "clamp_to_border"
mipmap_input3 = "true"
alias3 = "AvgLumPass"
float_framebuffer3 = "false"
srgb_framebuffer3 = "false"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "shaders_slang/crt/shaders/guest/crt-gdv-new/blur_horiz2.slang"
filter_linear4 = "true"
wrap_mode4 = "clamp_to_border"
mipmap_input4 = "false"
alias4 = ""
float_framebuffer4 = "true"
srgb_framebuffer4 = "false"
scale_type_x4 = "absolute"
scale_x4 = "800"
scale_type_y4 = "source"
scale_y4 = "1.000000"
shader5 = "shaders_slang/crt/shaders/guest/crt-gdv-new/blur_vert2.slang"
filter_linear5 = "true"
wrap_mode5 = "clamp_to_border"
mipmap_input5 = "false"
alias5 = "GlowPass"
float_framebuffer5 = "true"
srgb_framebuffer5 = "false"
scale_type_x5 = "absolute"
scale_x5 = "800"
scale_type_y5 = "absolute"
scale_y5 = "600"
shader6 = "shaders_slang/crt/shaders/guest/crt-gdv-new/crt-guest-dr-venom2.slang"
filter_linear6 = "true"
wrap_mode6 = "clamp_to_border"
mipmap_input6 = "false"
alias6 = ""
float_framebuffer6 = "false"
srgb_framebuffer6 = "false"
scale_type_x6 = "viewport"
scale_x6 = "1.000000"
scale_type_y6 = "viewport"
scale_y6 = "1.000000"
parameters = "PR;PG;PB;AS;sat;TNTC;CP;CS;WP;wp_saturation;GAMMA_INPUT;lsmooth;SIZEH;GLOW_FALLOFF_H;SIZEV;GLOW_FALLOFF_V;glow;bloom;TATE;IOS;OS;BLOOM;gamma_c;brightboost;brightboost1;gsl;scanline1;scanline2;beam_min;beam_max;beam_size;vertmask;scans;spike;h_sharp;s_sharp;csize;bsize;warpX;warpY;shadowMask;masksize;maskDark;maskLight;CGWG;mcut;slotmask;slotwidth;double_slot;slotms;mclip;inter;interm;gamma_out"
PR = "0.170000"
PG = "0.170000"
PB = "0.170000"
AS = "0.070000"
sat = "0.100000"
TNTC = "0.000000"
CP = "0.000000"
CS = "0.000000"
WP = "-50.000000"
wp_saturation = "1.000000"
GAMMA_INPUT = "2.400000"
lsmooth = "0.900000"
SIZEH = "4.000000"
GLOW_FALLOFF_H = "0.300000"
SIZEV = "4.000000"
GLOW_FALLOFF_V = "0.300000"
glow = "0.010000"
bloom = "0.000000"
TATE = "0.000000"
IOS = "0.000000"
OS = "1.000000"
BLOOM = "0.000000"
gamma_c = "1.000000"
brightboost = "1.000000"
brightboost1 = "1.500000"
gsl = "0.000000"
scanline1 = "5.000000"
scanline2 = "20.000000"
beam_min = "2.000000"
beam_max = "1.000000"
beam_size = "1.000000"
vertmask = "0.000000"
scans = "0.500000"
spike = "0.000000"
h_sharp = "3.000001"
s_sharp = "1.000000"
csize = "0.000000"
bsize = "600.000000"
warpX = "0.000000"
warpY = "0.000000"
shadowMask = "2.000000"
masksize = "1.000000"
maskDark = "0.500000"
maskLight = "1.000000"
CGWG = "0.300000"
mcut = "1.150000"
slotmask = "0.000000"
slotwidth = "2.000000"
double_slot = "1.000000"
slotms = "1.000000"
mclip = "0.400000"
inter = "350.000000"
interm = "1.000000"
gamma_out = "2.200000"
textures = "SamplerLUT1;SamplerLUT2;SamplerLUT3"
SamplerLUT1 = "shaders_slang/crt/shaders/guest/lut/sony_trinitron1.png"
SamplerLUT1_linear = "true"
SamplerLUT1_wrap_mode = "clamp_to_border"
SamplerLUT1_mipmap = "false"
SamplerLUT2 = "shaders_slang/crt/shaders/guest/lut/sony_trinitron2.png"
SamplerLUT2_linear = "true"
SamplerLUT2_wrap_mode = "clamp_to_border"
SamplerLUT2_mipmap = "false"
SamplerLUT3 = "shaders_slang/crt/shaders/guest/lut/other1.png"
SamplerLUT3_linear = "true"
SamplerLUT3_wrap_mode = "clamp_to_border"
SamplerLUT3_mipmap = "false"
1 Like

I was testing the shadow masks from lottes shader (pasted on crt-hyllian) on my PS3 Retroarch on a Plasma TV and I have a question:

Is it normal that the ShadowMask number 2 (the Aperture Grill one) has the reds a bit saturated? I think my screen became too much red overall.

Anyway, here’s the crt-hyllian I was testing: crt-hyllian with lottes shadowmasks

Lottes shader run too slow on PS3, so I’m pasting its shadowmasks to my crt-hyllian. It runs fullspeed.

2 Likes

Yes, I think all of the Lottes masks do something to the colors due to chromatic aberration/uneven subpixel spacing.

A red/blue/green/black pattern should solve this, or the magenta/green pattern.

1 Like

Oh, I see. Which other shader with balanced aperture grill masks do you recommend that I could try porting to crt-hyllian? I’m not an expert in shadow masks, so I need to borrow free code, kkk.

2 Likes

This might have what you’re looking for:

At 1080p though you’re limited to the two options just described.

1 Like

@Hyllian

Btw that is one shady file hosting site you used, lol. I can’t even copy&paste the text before the popups get me.

Edit: you should also consider adding grade, the color temp adjustment is very useful for correcting any weird tint from masks.

Really? I have no problem using it. If you want, I can paste the shader here.

Thanks, I just ported that to Cg and it worked flawlessly.

Do you know why some of the layouts produce moire and others not?

For the first param “vec2 coord” I’m passing this:

texCoord.xy*(texture_size.xy/video_size.xy)*output_size.xy

As I’m used to use it in cg shaders. Maybe hunterk can confirm if that’s correct.

From my experience, moire is happening because dark colors/patterns.

Usually I can mitigate moire at the cost of decreased scanline strength and/or lowering the mask strength.

1 Like

Lowering strengh reduce moire, indeed. Thanks.

1 Like

Moire is caused when the mask pattern used is x pixels in height, where x is greater than 1 and is not a factor of y, with y being the vertical scale. So e.g., 5x vertical scale with a pattern that is 2 pixels tall will produce moire.

Curvature also produces moire.

Other than that, not using integer scale will produce moire.

These are all the sources of moire in shaders afaik.

Can you get a slang version up when you get a chance? Curious to see what you’ve been working on.

2 Likes

I was talking in relation to curvature XD. As that’s been my only moire encounter afaik.

Also kinda interested in want hyllian cooked up.

I’ve not changed more than some parameters and added these masks. Other than that, the algorithm is the same. I’ll look at the slang one.

Anyway, I like Mask 10 with internsity 0.70 from the list for 4k. But, as my Plasma is 1080p, I have to choose among 2, 3 and 4.

Mask 10:

5 Likes

The problem with such fine masks IMO is that while they do look very nice in a screenshot, at 1080p when actually playing a game in fullscreen mode the LCD pixel grid and screen door effect really gets in the way. Plus, the CGWG magenta/green pattern really isn’t any better than the Lottes masks when it comes to chromatic aberration if the mask strength is less than 100%, which is obviously too dark (I’ve confirmed this empirically). That’s why I’ve been opting for coarser masks like the standard RGB aperture grille or a red, green, blue, black aperture grille.

1 Like

Yeah, that should work fine… You might need to do this silly bit (used in the Cg Lottes port): floor(texCoord.xy*(texture_size.xy/video_size.xy)*output_size.xy)+float2(0.5,0.5)

1 Like

Ok, here’s the slang one: crt-hyllian using masks (slang shader)

It only works if it’s in the crt shader folder, because it uses the mask_subpixel include file.

1 Like

I get this error:

[ERROR] Cannot find “shaders” param.

I tried it in the main crt directory and crt/shaders/

No idea. Here it works inside /Retroarch/shaders/shaders_slang/crt/shaders

Got it working. Looks great!

edit: fixed vignette, slightly modified some stuff.

shaders = "2"
shader0 = "shaders_slang/misc/grade.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = "StockPass"
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "shaders_slang/crt/shaders/hyllian-new.slang"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = "AfterglowPass"
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"
parameters = "g_gamma_in;g_signal_type;g_gamma_type;g_crtgamut;g_space_out;g_hue_degrees;g_I_SHIFT;g_Q_SHIFT;g_I_MUL;g_Q_MUL;g_lum_fix;g_vignette;g_vstr;g_vpower;g_lum;g_cntrst;g_mid;wp_temperature;g_sat;g_vibr;g_satr;g_satg;g_satb;g_lift;blr;blg;blb;wlr;wlg;wlb;rg;rb;gr;gb;br;bg;LUT_Size1;LUT1_toggle;LUT_Size2;LUT2_toggle;VSCANLINES;InputGamma;OutputGamma;SHARPNESS;COLOR_BOOST;RED_BOOST;GREEN_BOOST;BLUE_BOOST;SCANLINES_STRENGTH;BEAM_MIN_WIDTH;BEAM_MAX_WIDTH;CRT_ANTI_RINGING;PHOSPHOR_LAYOUT;MASK_INTENSITY"
g_gamma_in = "2.400000"
g_signal_type = "1.000000"
g_gamma_type = "1.000000"
g_crtgamut = "2.000000"
g_space_out = "0.000000"
g_hue_degrees = "0.000000"
g_I_SHIFT = "0.000000"
g_Q_SHIFT = "0.000000"
g_I_MUL = "1.000000"
g_Q_MUL = "1.000000"
g_lum_fix = "0.000000"
g_vignette = "0.000000"
g_vstr = "40.000000"
g_vpower = "0.200000"
g_lum = "0.000000"
g_cntrst = "0.000000"
g_mid = "0.500000"
wp_temperature = "8005.000000"
g_sat = "0.000000"
g_vibr = "0.000000"
g_satr = "0.000000"
g_satg = "0.000000"
g_satb = "0.000000"
g_lift = "0.000000"
blr = "0.000000"
blg = "0.000000"
blb = "0.000000"
wlr = "1.000000"
wlg = "1.000000"
wlb = "1.000000"
rg = "0.000000"
rb = "0.000000"
gr = "0.000000"
gb = "0.000000"
br = "0.000000"
bg = "0.000000"
LUT_Size1 = "16.000000"
LUT1_toggle = "0.000000"
LUT_Size2 = "64.000000"
LUT2_toggle = "0.000000"
VSCANLINES = "0.000000"
InputGamma = "2.400000"
OutputGamma = "2.400000"
SHARPNESS = "1.000000"
COLOR_BOOST = "1.250000"
RED_BOOST = "1.000000"
GREEN_BOOST = "1.000000"
BLUE_BOOST = "1.000000"
SCANLINES_STRENGTH = "0.800000"
BEAM_MIN_WIDTH = "0.680000"
BEAM_MAX_WIDTH = "1.000000"
CRT_ANTI_RINGING = "0.000000"
PHOSPHOR_LAYOUT = "6.000000"
MASK_INTENSITY = "0.500000"
textures = "SamplerLUT1;SamplerLUT2;SamplerLUT3"
SamplerLUT1 = "shaders_slang/crt/shaders/guest/lut/sony_trinitron1.png"
SamplerLUT1_linear = "true"
SamplerLUT1_wrap_mode = "clamp_to_border"
SamplerLUT1_mipmap = "false"
SamplerLUT2 = "shaders_slang/crt/shaders/guest/lut/sony_trinitron2.png"
SamplerLUT2_linear = "true"
SamplerLUT2_wrap_mode = "clamp_to_border"
SamplerLUT2_mipmap = "false"
SamplerLUT3 = "shaders_slang/crt/shaders/guest/lut/other1.png"
SamplerLUT3_linear = "true"
SamplerLUT3_wrap_mode = "clamp_to_border"
SamplerLUT3_mipmap = "false"