Please show off what crt shaders can do!

My bad. I thought you wanted me to test the mask at my native res of 1920x1080.

The following images are with this test1 (100% Black) mask at 4x PSP integer res 1920x1088.

LUT Width/Height - 4.0/4.0

LUT Width/Height - 2.0/2.0 (This looks almost like ReShade settings!)

hmmm, that looks better but something is still off - are you using glow or something? Try disabling all effects except for gamma correction and use nearest neighbor filtering. Also try disabling mask cutoff if you’re using that. After that you should have 1:1 mapping of the pixels to the mask.

Edited slotmask looks nice, though!

1 Like

New guest-dr-venom settings for an older but nicely bright Samsung LED-lit TV I recently acquired. Happy to report that I’m getting 100% magenta/green phosphors over white with 90% mask strength.

2 Likes

I was inspired by your question and this page and wrote a quick and dirty composite shader from scratch. it’s not perfect, but it gets pretty damn close most of the time (NES requires NTSC palette): (compare to the shots on the page. You have to hover your mouse over it to get the composite version)

#version 450

layout(push_constant) uniform Push
{
	vec4 SourceSize;
	vec4 OriginalSize;
	vec4 OutputSize;
	uint FrameCount;
	float SPLIT;
	float I_SHIFT;
	float Q_SHIFT;
	float Y_MUL;
	float I_MUL;
	float Q_MUL;
} params;

#pragma parameter SPLIT "Split" 0.0 -1.0 1.0 0.1
#pragma parameter I_SHIFT "I Shift" 0.0 -1.0 1.0 0.02
#pragma parameter Q_SHIFT "Q Shift" 0.0 -1.0 1.0 0.02
#pragma parameter Y_MUL "Y Multiplier" 1.0 0.0 2.0 0.1
#pragma parameter I_MUL "I Multiplier" 1.0 0.0 2.0 0.1
#pragma parameter Q_MUL "Q Multiplier" 1.0 0.0 2.0 0.1

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;

vec4 RGB_YIQ(vec4 col)
{
	mat3 conv_mat = mat3(0.299,   0.587,  0.114,
					 0.5959, -0.2746,-0.3213,
					 0.2115, -0.5227, 0.3113);

	col.rgb *= conv_mat;

	return col;
}

vec4 YIQ_RGB(vec4 col)
{
	mat3 conv_mat = mat3(1.0,  0.956,  0.619,
					 1.0, -0.272, -0.647,
					 1.0, -1.106,  1.703);

	col.rgb *= conv_mat;

	return col;
}

void main()
{
	#define ms *pow(10.0, -9.0)
	#define MHz *pow(10.0, 9.0);

	const float max_col_res = 0.5 * 52.6 ms * 315.0/88.0 MHz;
	const float max_lum_res = 52.6 ms * 315.0/88.0 MHz;

	const int viewport_col_res = int(ceil((params.OutputSize.x / params.OriginalSize.x) * (params.OriginalSize.x / max_col_res)));
	const int viewport_lum_res = int(ceil((params.OutputSize.x / params.OriginalSize.x) * (params.OriginalSize.x / max_lum_res)));

	if(vTexCoord.x - params.SPLIT - 1.0 > 0.0 || vTexCoord.x - params.SPLIT < 0.0)
	{
		FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0);
	}
	else
	{
		vec4 col = vec4(0.0, 0.0, 0.0, 1.0);

		col += RGB_YIQ(texture(Source, vTexCoord));

		for(int i = 1; i < viewport_col_res; i++)
		{
			col.yz += RGB_YIQ(texture(Source, vTexCoord - vec2((i - viewport_col_res/2) * params.OutputSize.z, 0.0))).yz;
		}
		for(int i = 1; i < viewport_lum_res; i++)
		{
			col.x += RGB_YIQ(texture(Source, vTexCoord - vec2((i - viewport_col_res/2) * params.OutputSize.z, 0.0))).x;
		}

		col.yz /= viewport_col_res;
		col.x /= viewport_lum_res;


		col.y = mod((col.y + 1.0) + params.I_SHIFT, 2.0) - 1.0;
		col.y = 0.9 * col.y + 0.1 * col.y * col.x;

		col.z = mod((col.z + 1.0) + params.Q_SHIFT, 2.0) - 1.0;
		col.z = 0.4 * col.z + 0.6 * col.z * col.x;
		col.x += 0.5*col.y;

		col.z *= params.Q_MUL;
		col.y *= params.I_MUL;
		col.x *= params.Y_MUL;


		col = YIQ_RGB(col);
	   
		FragColor = col;
	}
}
6 Likes

heh, clever idea using the ms and MHz macros :smiley:

The results look good, too!

2 Likes

Any specific filtering or scaling I need to do to run this?

1 Like

Not really, I use “don’t care” for both :slight_smile:

@hunterk :man_facepalming:t2:I just realized I wrote ms for μs because I shortened it from microseconds by deleting the letters in the middle… But thanks :smiley:

1 Like

Looks nice! I’m still totally confused about composite shaders, though. What are the maximum values for YIQ in TVout-tweaks without exceeding the maximum bandwidth for composite?

Edit: if it’s 4:1:1 chroma subsampling and 525 lines, does that result in the following values?

Y - 350
I - 87.5
Q - 87.5

Is your composite shader doing maximum composite YIQ values or something else?

1 Like

Honestly I just tweaked it until it looked like the screenshots while keeping in mind that luma has more bandwidth than chroma, and that I and Q have the same bandwidth (I think at least) :smirk: I really want to look into this matter more but it’s pretty hard for me to find accurate info on this stuff :frowning: so I just decided to wing it for now… Sorry!

3 Likes

Awesome shader, if you could split I and Q to individual Mhz it would be great because 4:1:1 subsampling was a later standard IIRC.

The RGB images look quite sharp in the image, it just looks like a simple horizontal convolution 1 1 1 . And good refs for D93 temperature.

2 Likes

See I didn’t really know. Actually I thought that there was only one way to send an NTSC compliant signal through composite, and that I and Q share the same subcarrier, except that one is amplitude modulated and the other quadrature modulated :confused:

And yeah I feel pretty lucky to have found that site :slight_smile: I just realized there’s a part 2 in the link so I’m gonna have to check that out as well :smiley:

2 Likes

I knew the site but forgot about it now that I’m into RA shaders. What I observed is that greens get tamed down heavily, probably doing a clamp and limiting precision to integer can get some of the YIQ gamut colorimetry.

Yesterday I was playing with clamping YIQ to clamp(yiq,vec3(0.0,-0.5957,-0.5226),vec3(1.0,0.5957,0.5226))

1 Like

Thanks for sharing this, and the Gamecube one, just looking through them gave me some big insight into how much difference some sharpness and gamma tweaks can make.

1 Like

No effects were used other than the Blend Overlay shader in all my previous tests. But, I did notice that the PPSSPP core was not saving my Texture Filtering setting to Nearest so I manually edited the retroarch-core-options.cfg to set it.

Same mask as my previous post. LUT Width/Height - 4.0/4.0

Nice Garou pic btw.

1 Like

As my internet was down all morning, I decided to test Guest-Dr-Venom with some movies!

Dragon Ball Super Broly :

Blade Runner :

Isle of Dogs :

What We Do in the Shadows :

5 Likes

What format do I need videos to be in to use them with retroarch (Avi, mp4, etc.)?

Also guest-dr-venom looks great with videos, at least from what I’m seeing in the screenshots!

Lastly, @guest.r would it be possible to make the black in the masks be adjustable, like be able to make the black more of a grey color like 50% black? Just curious it’s not a big deal either way, just thought grey would look nicer in some situations.

4 Likes

Most of my collection is in MKV format, but I don’t think that matters. What matters is the codec used for both the video and audio in containers like (avi, mp4, mkv, wmv etc.).

For example - one of the movies I have (Amazon digital 4K) has HEVC for video codec (like most in my collection) and E-AC-3 JOC for audio, which RA can’t process. So, I just get the video with glitched/broken audio.

2 Likes

I would give anything to be able to run a browser within RA and watch some of my Netflix shows with a CRT shader :pensive:

2 Likes

@Doriphor

Crunchyroll and Boomerang would be pretty nice as well, lol.

I feel you though, I wish reshade’s shader setup was more inline with how RA does it (the multipass layering; referencing previous shader passes).

EDIT: Kinda curious on whether I can use reshade on chrome(would be hilarious, and useful-ish), might test it when I wake back up.

2 Likes

Keep me updated I’d want that too :blush:

2 Likes