New CRT shader from Guest + CRT Guest Advanced updates

I’d like to use crt-guest-sm but it’s not well suited to a plasma display. A plasma doesn’t have subpixels that work like those on an LCD and it greatly interferes with the mask/phosphor emulation, unfortunately. I’ve been trying to find something that will do decently sharp scanlines with options for adjusting the sharpness of the image and color/brightness/gamma options.

Guest-dr-venom - looks great after disabling a lot of the options and maxing out the scanlines, but I get sudden brightness/color shifts when the screen is scrolling quickly, which can be quite jarring. It looks like really aggressive ABL. This is something I’ve only experienced with this shader. Seems like the kind of thing that might be a driver/graphics card issue.

guest-sm - looks great when maxing the scanlines, but removing the mask completely results in some strange and harsh looking edges. This is only an issue with more recent versions. Older versions that use the 1.00 - 5.00 horizontal sharpness adjustment look better (sans mask).

crt-geom - looks great and the interlacing simulation is a really nice feature, but a lot of the parameters in the slang version appear to be broken. Sharpness adjustment could be improved.

crt-aperture - my old standby, scanlines look great but the color/brightness options aren’t as nice as those in guest-sm and guest-dr-venom. Sharpness adjustment could be improved.

I’m using the slang versions of these shaders.

Regarding the new autobright feature: it looks great, except that very bright spots look like an over-exposed photograph. I think this is probably unavoidable since those overexposed spots are how the image is made brighter. It’s a nice option to have, though!

After playing around with the shader settings and disabling a lot of the options I was able to almost completely eliminate this problem. I think the plasma has some amount of ABL that can’t be disabled in order to prevent it from getting too hot. Seems to only be noticeable when there’s fast horizontal scrolling. It’s not too big of a deal, though.

Anyway, crt-guest-dr-venom is now looking good on my plasma, but it’s missing one important feature, IMO, and that’s the interlacing simulation in crt-geom. Any way to add this in? Everything else is great. @guest.r

2 Likes

I’ve been crying for interlacing forever XD, lol.

2 Likes

I only really started using it recently because I’ve been playing some PSX stuff that occasionally displays in 480i, but it’s very convincing! I personally don’t really like 480i flickering, but the alternative is weird looking scanlines and that’s even worse.

2 Likes

This is why I was I’ve been crying about it, lol. 480i content has needs for it. -_-

2 Likes

I figured interlacing with cdr-guest-dr-venom, but the absence of proper vertical smoothing makes it an doubtful choice if you prefer nice filtering. In fact, i produced a smooth interlacing shader which i didn’t publish yet, has a very wide filter and looks cool with PSX content in 2x res. No scanlines though…

I didn’t publish it because most of the relevant content switches to 30fps as it pleases and it made me a bit mad. :grin:

When i’m finished with completing the ‘sm’ shader, i’ll try to find a good solution for 400px+ vertical resolution games too…it won’t necessary be interlacing, but rather bilinear interpolation with scanlines turned off. Something that’s simple to implement…

Have you managed to integrate the code i posted in this thread?

It’s proper interlacing (slang version needs s params. tweak to work).

1 Like

I’m not going to lie, I may have tested that… I may have not… I remember the conversation now that I’m seeing it, and I remember that code, lol.

I just don’t remember if I tried it, if I did and don’t remember it (it would probably be because I didn’t like it.).

I saving it to my desktop now and naming it so I’ll remember, lol. Thanks for this, I sincerely apologise about this, I’ve been extremely busy lately and I’ve been doing a bunch of tests on shaders recently so sorry about forgetting about this.

You know at the rate I’m going, I’ll end up with a version of your shader with a bunch of extra features that aren’t in the repo version, :joy::joy::joy:.

How hard would it be to to add a vertical filter for crt-guest-dr-venom-interlaced?

@guest.r

Okay, so I was able to get guest-sm looking nice on my plasma by just lowering the mask strength a lot and using a previous version with the old horizontal sharpness adjustment (0.00 - 5.00). I still need to re-test the newer version with the updated sharpness adjustment.

Whatever crt-geom is doing, it works. I was able to get guest-sm looking pretty good with a few tweaks, but guest-dr-venom just looks washed out and dull. Increasing saturation doesn’t help; blue still looks under-saturated and red looks oversaturated when I increase saturation. I tried replacing the first two passes of the shader with “stock” but the problem persists. I’m using 0-255 instead of the RGB standard range of 16-235 if that makes a difference. I’m not sure what guest-dr-venom is doing differently, but it seems like it’s preserving brightness at the expense of saturation…?

crt-geom:

guest-sm:

guest-dr-venom:

crt-geom:

shaders = "1"
shader0 = "shaders_slang/crt/shaders/crt-geom.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
parameters = "CRTgamma;monitorgamma;d;CURVATURE;R;cornersize;cornersmooth;x_tilt;y_tilt;overscan_x;overscan_y;DOTMASK;SHARPER;scanline_weight;lum;interlace_detect"
CRTgamma = "2.400000"
monitorgamma = "2.200000"
d = "3.000000"
CURVATURE = "0.000000"
R = "2.000000"
cornersize = "0.001000"
cornersmooth = "1000.000000"
x_tilt = "0.000000"
y_tilt = "0.000000"
overscan_x = "100.000000"
overscan_y = "100.000000"
DOTMASK = "0.300000"
SHARPER = "1.000000"
scanline_weight = "0.250000"
lum = "0.000000"
interlace_detect = "1.000000"

guest-sm:

shaders = "2"
shader0 = "shaders_slang/crt/shaders/guest/d65-d50.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-guest-sm.slang"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = ""
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"
parameters = "WP;wp_saturation;smart;brightboost1;brightboost2;stype;scanline1;scanline2;beam_min;beam_max;s_beam;saturation1;h_sharp;mask;maskmode;maskdark;maskbright;masksize;gamma_out"
WP = "0.000000"
wp_saturation = "1.000000"
smart = "0.000000"
brightboost1 = "1.150001"
brightboost2 = "1.150000"
stype = "0.000000"
scanline1 = "14.000000"
scanline2 = "16.000000"
beam_min = "1.000000"
beam_max = "1.000000"
s_beam = "0.000000"
saturation1 = "1.000000"
h_sharp = "1.000000"
mask = "0.000000"
maskmode = "0.000000"
maskdark = "0.450000"
maskbright = "0.300000"
masksize = "1.000000"
gamma_out = "2.200000"

guest-dr-venom:

shaders = "11"
shader0 = "shaders_slang/stock.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/stock.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = ""
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/d65-d50.slang"
filter_linear2 = "false"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = "WhitePointPass"
float_framebuffer2 = "false"
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/afterglow.slang"
filter_linear3 = "false"
wrap_mode3 = "clamp_to_border"
mipmap_input3 = "false"
alias3 = "AfterglowPass"
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/avg-lum0.slang"
filter_linear4 = "false"
wrap_mode4 = "clamp_to_border"
mipmap_input4 = "false"
alias4 = ""
float_framebuffer4 = "false"
srgb_framebuffer4 = "false"
scale_type_x4 = "source"
scale_x4 = "1.000000"
scale_type_y4 = "source"
scale_y4 = "1.000000"
shader5 = "shaders_slang/crt/shaders/guest/avg-lum.slang"
filter_linear5 = "false"
wrap_mode5 = "clamp_to_border"
mipmap_input5 = "true"
alias5 = "AvgLumPass"
float_framebuffer5 = "false"
srgb_framebuffer5 = "false"
scale_type_x5 = "source"
scale_x5 = "1.000000"
scale_type_y5 = "source"
scale_y5 = "1.000000"
shader6 = "shaders_slang/crt/shaders/guest/linearize.slang"
filter_linear6 = "false"
wrap_mode6 = "clamp_to_border"
mipmap_input6 = "false"
alias6 = "LinearizePass"
float_framebuffer6 = "true"
srgb_framebuffer6 = "false"
scale_type_x6 = "source"
scale_x6 = "1.000000"
scale_type_y6 = "source"
scale_y6 = "1.000000"
shader7 = "shaders_slang/crt/shaders/guest/blur_horiz.slang"
filter_linear7 = "false"
wrap_mode7 = "clamp_to_border"
mipmap_input7 = "false"
alias7 = ""
float_framebuffer7 = "true"
srgb_framebuffer7 = "false"
scale_type_x7 = "source"
scale_x7 = "1.000000"
scale_type_y7 = "source"
scale_y7 = "1.000000"
shader8 = "shaders_slang/crt/shaders/guest/blur_vert.slang"
filter_linear8 = "false"
wrap_mode8 = "clamp_to_border"
mipmap_input8 = "false"
alias8 = "GlowPass"
float_framebuffer8 = "true"
srgb_framebuffer8 = "false"
scale_type_x8 = "source"
scale_x8 = "1.000000"
scale_type_y8 = "source"
scale_y8 = "1.000000"
shader9 = "shaders_slang/crt/shaders/guest/linearize_scanlines.slang"
filter_linear9 = "true"
wrap_mode9 = "clamp_to_border"
mipmap_input9 = "false"
alias9 = ""
float_framebuffer9 = "true"
srgb_framebuffer9 = "false"
scale_type_x9 = "source"
scale_x9 = "1.000000"
scale_type_y9 = "source"
scale_y9 = "1.000000"
shader10 = "shaders_slang/crt/shaders/guest/crt-guest-dr-venom.slang"
filter_linear10 = "true"
wrap_mode10 = "clamp_to_border"
mipmap_input10 = "false"
alias10 = ""
float_framebuffer10 = "false"
srgb_framebuffer10 = "false"
scale_type_x10 = "viewport"
scale_x10 = "1.000000"
scale_type_y10 = "viewport"
scale_y10 = "1.000000"
parameters = "WP;wp_saturation;SW;AR;PR;AG;PG;AB;PB;sat;STH;GAMMA_INPUT;TAPSH;GLOW_FALLOFF_H;TAPSV;GLOW_FALLOFF_V;TATE;IOS;OS;BLOOM;brightboost;brightboost1;gsl;scanline1;scanline2;beam_min;beam_max;beam_size;h_sharp;s_sharp;csize;bsize;warpX;warpY;glow;shadowMask;masksize;vertmask;slotmask;slotwidth;double_slot;mcut;maskDark;maskLight;CGWG;gamma_out;spike"
WP = "0.000000"
wp_saturation = "1.000000"
SW = "1.000000"
AR = "0.070000"
PR = "0.050000"
AG = "0.070000"
PG = "0.050000"
AB = "0.070000"
PB = "0.050000"
sat = "0.100000"
STH = "0.700000"
GAMMA_INPUT = "2.400000"
TAPSH = "4.000000"
GLOW_FALLOFF_H = "0.000000"
TAPSV = "4.000000"
GLOW_FALLOFF_V = "0.000000"
TATE = "0.000000"
IOS = "0.000000"
OS = "1.000000"
BLOOM = "0.000000"
brightboost = "1.150000"
brightboost1 = "1.150000"
gsl = "2.000000"
scanline1 = "15.000000"
scanline2 = "23.000000"
beam_min = "1.000000"
beam_max = "1.000000"
beam_size = "0.000000"
h_sharp = "3.750000"
s_sharp = "0.000000"
csize = "0.000000"
bsize = "600.000000"
warpX = "0.000000"
warpY = "0.000000"
glow = "0.000000"
shadowMask = "0.000000"
masksize = "1.000000"
vertmask = "0.000000"
slotmask = "0.000000"
slotwidth = "2.000000"
double_slot = "1.000000"
mcut = "0.200000"
maskDark = "0.500000"
maskLight = "1.500000"
CGWG = "0.300000"
gamma_out = "2.200000"
spike = "0.000000"
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

Thanks for complaining a bit where due ^^. :stuck_out_tongue_winking_eye:

I took another look at the scanline function and it uses some older oversaturation prevention code.

While working on a new shader things improved. You could try to copy/paste this code into the shader, i guess the colors will be better.

vec3 sw2(vec3 x, vec3 color, float scanline)
{
	float mx = max(max(color.r, color.g),color.b);
	vec3 tmp = mix(vec3(2.5*beam_min),vec3(beam_max), color);
	tmp = mix(vec3(beam_max), tmp, pow(x, color+0.3));
	vec3 ex = x*tmp;
	vec3 res = exp2(-scanline*ex*ex)/(0.6 + 0.4*mx);
	mx = max(max(res.r,res.g),res.b);
	return mix(vec3(mx), res, 0.65);	
}
2 Likes

Only for ‘Dr. Venom’, newer shader uses something similar already.

2 Likes

I was ninja’d it was like you knew.

2 Likes

Where should this go? I tried pasting this right after the #defines but the shader fails to load.

1 Like

@Nesguy Where the shader already has vec3 sw2, copy and paste that code over it.

@Syh

That did it, thanks!

@guest.r

Colors look a lot better now with the updated code!

One major difference I’ve noticed between guest-dr-venom and geom is that geom preserves dark details and black edges better. However, it can also have some awkward looking edges where a very bright pixel is next to a black pixel. The blur in guest-dr-venom causes the bright pixels to bleed into the dark pixels, which makes black edges less sharp but also looks more natural in most situations. IDK if anything can be done about this; seems like an unavoidable trade-off.

2 Likes

Yeah, that’s types of horizontal filtering. Crt-geom uses a lanczos filter, which does sharper edges when contrast exists between pixels. crt-guest-dr-venom uses a gaussian filter, which is wider and smoother in general, but my adaptation can work similar to ‘lanczos/cubic’ with help of substractive sharpness. Can you check the version in this thread?

Should work out nice, if it works for you. :slight_smile:

1 Like

Gaussian usually does a better approximation of natural, analog-y effects (fog, blur, etc.), IMO, and lanczos is bad about ringing, which gets obscured pretty well by geom’s scanlines and mask, but it’s still there if you look closely.

2 Likes

I also think a wider filter (like gaussian 5 or 6 pixles width) is nicer for filtering 2D elements with increased internal resolution. A fine option to have i guess.

4 Likes

That’s a good summary. I agree that gaussian looks more natural in most situations. The ringing effects from lanczos can be pretty distracting. Does crt-hyllian also use lanczos?

What other types of filtering can be used in crt shaders, and what are the pros and cons of each? Is gaussian pretty much the best in terms of looks and performance? I think I read somewhere that the natural blur on a CRT is essentially gaussian.

Basically, this will make black edges and dark details more distinct, at the expense of adding ringing artifacts? Could be a nice option for some games. I’ll check it out!

1 Like

Ringing isn’t that notable because of the anti-ringing which is implemented. It’s a good implementation to 4 colors clamping, filter native 5 would allow too much ringing already. In fact, Hyllian started with anti-ringing and his shader is very nice about it (cheers Trogglemonkey too). His default filtering method is polynomial Catmull-Rom Spline filter, but you can edit the shader for some alternatives.

1 Like

Guess it’s a good release version. I tweaked the shader for good brightness, contrast and performance. It would be very nice, if the SLANG repo version could be updated. Many thanks. :smile:

https://mega.nz/#!t1xAzS4T!NkjlMLf3K--gCSzYy3T0Bl0PHSK-kWIotWctmpgTw3A

4 Likes