Please show off what crt shaders can do!

Yeah, I’m not sure how/if Kell factor is applicable here. 2/3 ratio looks good, though.

@Dogway that mario kart shot is great.

4 Likes

Some tests with a different curvature and different vignette settings. Also re-added some lower vertical deconvergence to the images. (Less the half of the previous version.) I also think I’ll be switching the mask next shots as I’m not liking how this mask looks for these settings.

Next time I test I’ll take screens of a different game, lol. Everyone must be over the Super Mario World screens.

5 Likes

I have strong memories of playing Alex Kidd on a bad TV set. Using hunterk’s instructions to modify the newpixie shader I added a tvout pass with composite. It’s wonderfully terrible now.

5 Likes

@BendBombBoom Could you share this combined preset? I also have these memories!

1 Like

Sure. You will need two things. First here is the preset:

shaders = "6"
shader0 = "shaders_slang/crt/shaders/tvout-tweaks.slang"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
shader1 = "shaders_slang/crt/shaders/crtsim/composite.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = ""
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"
shader2 = "shaders_slang/crt/shaders/newpixie/accumulate2.slang"
filter_linear2 = "true"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = "accum1"
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/newpixie/blur_horiz.slang"
filter_linear3 = "true"
wrap_mode3 = "clamp_to_border"
mipmap_input3 = "false"
alias3 = "blur1"
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/newpixie/blur_vert.slang"
filter_linear4 = "true"
wrap_mode4 = "clamp_to_border"
mipmap_input4 = "false"
alias4 = "blur2"
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/newpixie/newpixie-crt.slang"
filter_linear5 = "true"
wrap_mode5 = "clamp_to_border"
mipmap_input5 = "false"
alias5 = ""
float_framebuffer5 = "false"
srgb_framebuffer5 = "false"
parameters = "TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;TVOUT_RESOLUTION_Y;TVOUT_RESOLUTION_I;TVOUT_RESOLUTION_Q;Tuning_Sharp;Tuning_Persistence_R;Tuning_Persistence_G;Tuning_Persistence_B;Tuning_Bleed;Tuning_Artifacts;NTSCLerp;NTSCArtifactScale;animate_artifacts;acc_modulate;blur_x;blur_y;use_frame;curvature"
TVOUT_RESOLUTION = "256.000000"
TVOUT_COMPOSITE_CONNECTION = "1.000000"
TVOUT_TV_COLOR_LEVELS = "0.000000"
TVOUT_RESOLUTION_Y = "512.000000"
TVOUT_RESOLUTION_I = "163.199997"
TVOUT_RESOLUTION_Q = "89.599998"
Tuning_Sharp = "0.200000"
Tuning_Persistence_R = "0.065000"
Tuning_Persistence_G = "0.050000"
Tuning_Persistence_B = "0.050000"
Tuning_Bleed = "0.500000"
Tuning_Artifacts = "0.300000"
NTSCLerp = "1.000000"
NTSCArtifactScale = "480.000000"
animate_artifacts = "1.000000"
acc_modulate = "0.650000"
blur_x = "1.000000"
blur_y = "1.000000"
use_frame = "0.000000"
curvature = "2.000000"
textures = "frametexture;NTSCArtifactSampler;shadowMaskSampler"
frametexture = "shaders_slang/crt/shaders/newpixie/crtframe.png"
frametexture_linear = "true"
frametexture_wrap_mode = "clamp_to_border"
frametexture_mipmap = "false"
NTSCArtifactSampler = "shaders_slang/crt/shaders/crtsim/artifacts.png"
NTSCArtifactSampler_linear = "true"
NTSCArtifactSampler_wrap_mode = "clamp_to_border"
NTSCArtifactSampler_mipmap = "false"
shadowMaskSampler = "shaders_slang/crt/shaders/crtsim/mask.png"
shadowMaskSampler_linear = "true"
shadowMaskSampler_wrap_mode = "clamp_to_border"
shadowMaskSampler_mipmap = "false"

Then you will need to save this as accumulate2.slang in your shaders\shaders_slang\crt\shaders\newpixie folder. All I have done is modify accumulate.slang so the two entries that say “PassFeedback1” now say “PassFeedback3” and renamed it. I hope you enjoy.

#version 450

// newpixie CRT
// by Mattias Gustavsson
// adapted for slang by hunterk

/*
------------------------------------------------------------------------------
This software is available under 2 licenses - you may choose the one you like.
------------------------------------------------------------------------------
ALTERNATIVE A - MIT License
Copyright (c) 2016 Mattias Gustavsson
Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), to deal in 
the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.
------------------------------------------------------------------------------
ALTERNATIVE B - Public Domain (www.unlicense.org)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this 
software, either in source code form or as a compiled binary, for any purpose, 
commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this 
software dedicate any and all copyright interest in the software to the public 
domain. We make this dedication for the benefit of the public at large and to 
the detriment of our heirs and successors. We intend this dedication to be an 
overt act of relinquishment in perpetuity of all present and future rights to 
this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------
*/

layout(push_constant) uniform Push
{
	vec4 SourceSize;
	vec4 OriginalSize;
	vec4 OutputSize;
	uint FrameCount;
	float acc_modulate;
} params;

#pragma parameter acc_modulate "Accumulate Modulation" 0.65 0.0 1.0 0.01
#define modulate params.acc_modulate

#define tex0 PassFeedback3
#define tex1 Source

layout(std140, set = 0, binding = 0) uniform UBO
{
	mat4 MVP;
} global;

#pragma stage vertex
layout(location = 0) in vec4 Position;
layout(location = 1) in vec2 TexCoord;
layout(location = 0) out vec2 vTexCoord;

void main()
{
   gl_Position = global.MVP * Position;
   vTexCoord = TexCoord;
}

#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
layout(set = 0, binding = 3) uniform sampler2D PassFeedback3;

void main()
{
   vec4 a = texture(tex0, vTexCoord.xy) * vec4(modulate);
   vec4 b = texture(tex1, vTexCoord.xy);
   FragColor = max( a, b * 0.96 );
}
4 Likes

First shot is a Samsung plasma TV with a simple black line scanline filter, 2 visible lines to 1 black line. The plasma’s phosphors make it very CRT-like, as you can see.

300-400 TVL would be a common figure for consumer-grade CRTs going back to the early 80s and up through the 90s. 250 TVL is the lowest I’ve seen advertised; that was for a 9” professional monitor.

Beam dynamics are almost entirely a function of beam focus and TVL. Both slotmask and aperture grille are capable of very pronounced scanlines. A 500 TVL slotmask CRT with good beam focus will be almost identical to a 500 TVL aperture grille CRT with good beam focus at a normal viewing distance. Brightness and contrast controls on a CRT also affect the width of the scanlines.

It would be cool if we had something empirical to base the beam dynamics on; can we predict the beam spot size variation on a CRT based on color intensity/voltage and TVL? I’d like to see someone derive a function from empirical data on CRTs that associates color intensity/voltage to beam spot size variation. Then we could apply that to shaders. Don’t look at me, though. :stuck_out_tongue:

Those shots are looking great. I think you could definitely fool some CRT fans with those.

Regarding the backlight thing, now I’m not sure if this is the most important thing. What really matters for human visual perception is the contrast ratio and dynamic range. Some theater setups have like 50 nits and it looks fine in a totally dark environment.

I think what we want to do is max out the backlight and then gradually increase the scanlines and mask until white no longer appears pure white, and then lower the mask/scanlines strength until white looks pure white. Or we can measure the black/white luminance ratio if we want to get fancy.

It’s very possible for an LCD to pass the max brightness test while still having a horrible contrast ratio.

1 Like

I know, I know, I said no more Super Mario World, but these were just some test shots that I did early. I didn’t feel like re-inputing all the values for shader to take these in another game.

I’m setting the black to an off-black. Mask has been changed, still using the same deconvergence and scanline set-up that I’ve used in the last few shots, basically everythings the same.

For these shots I ended up changing some code in the shader to get the mask and scanlines to appear in the bloom halos. Let me know what you guys think about the effect, I’d like to make this effect more blurry or something, to make it less prominent but I’m having issues with that, lol. (I think the effect of the mask and scanlines appearing in the bloom halos looks better than default, imo. I feel it makes the bloom blend better with the image.) Love to hear what others think about this effect.

EDIT: Saving shader presets still works.

3 Likes

If that just started over the last couple of days, let me know in another thread because we just pushed some changes to the custom preset saving process a couple of days ago and it might have caused some problems or something.

3 Likes

I thought of an interesting idea, imo.

Instead of applying the bloom halation after the scanlines I’m going to try and apply it before the scanlines. And then do the diffusion after the scanlines.

So it’ll look like this.

Sample blur passes like normal, apply blur passes and halation adjust (setting) to the image, then apply the scanlines on top of that, then finish off the bloom by applying the diffusion after the scanlines to blur.

Edit: So that was fun, it’s not worth taking a screenshot of right now as it needs tweaked but you kinda end up with a result like crtglow.

1 Like

Some more experimenting. I think these are the happiest I’ve been with, wish I could do a little more with the scanlines but I have to sacrifice the curvature for it.

2 Likes

With the heavy deconvergence, it looks like a projection screen TV :slight_smile:

2 Likes

Are you talking about those giant monster TV’s, the rear-projection ones?

Yep, rear projection CRT. They were known for having pretty bad picture quality :stuck_out_tongue: Their big selling point was screen size.

1 Like

Hopefully these look less like a rear-projection tv. Changed the curvature some, and lowered the deconvergence some. Is the paleness part of the issue? (If so my next shots I’ll fix that some.)

1 Like

heh, yeah, that was part of it. I didn’t mean it as a dig, though.

1 Like

Fiddled with the settings some more, reduced the paleness some. Reduced the deconvergence some, did some new stuff with color. (Removed some green from white, and added some yellow to red, on top of the rest that I normally do.) And lowered the vignette strength slightly.

@hunterk you’re fine man, I didn’t take it that way. As soon as you said it I was like “oh, yeah, I see that.”. That’s just not what I was going for currently.

1 Like

The images are a bit washed out and lacking in dynamic range, which is also reminiscent of RPTVs. The color tinting stuff just washes the image out more; not good unless you’re going for a particular vintage.

It’s just really difficult to have good dynamic range while having a decent scanline ratio and using a mask effect.

Hmmm, I’ll try something tomorrow. There’s a few things I’m doing that may be able to be adjusted so this looks better. For starters I won’t mess with the black level. But there’s some other things I’m doing that’s washing out the image some as well.

Here’s a combination screenshot set. I attempted to fix the washout. And at the same time I took two screenshots of every scene The first shot I’m leaving the color alone and the second shot has color adjustments. (I’ll have to play around with the color adjustments more, as I’m messing with the blue too much it seems.)

2 Likes

@Syh - a bit too blurry I think. Everything else looking great!

2 Likes