New CRT shader from Guest + CRT Guest Advanced updates

Okay, I have PR open to bring the repo up to date, if anyone cares to test it (or just take a look at all of the changes):

I also modified ntsc-pass1 a bit to make it automatically merge fields for svideo and composite (this is how blargg’s filter does it, and I think it’s technically correct) and leave them unmerged for RF, but with the ability to control it manually if it’s in ‘custom’ mode, and I added ‘NTSC’ to all of the NTSC shaders’ parameters to make them clearer in the parameter list.

6 Likes

Thanks @hunterk! for the effort!

I would only suggest the ‘last minute change’ to the ntsc-pass1 file (vertex shader part), like this:

	float res = global.ntsc_scale;
	gl_Position = global.MVP * Position;
	vTexCoord = TexCoord;
	if (res < 1.0) pix_no = TexCoord * global.SourceSize.xy * (res * global.OutputSize.xy / global.SourceSize.xy); else
                   pix_no = TexCoord * global.SourceSize.xy * (      global.OutputSize.xy / global.SourceSize.xy);
	phase = (global.ntsc_phase < 1.5) ? ((global.OriginalSize.x > 300.0) ? 2.0 : 3.0) : ((global.ntsc_phase > 2.5) ? 3.0 : 2.0);
	
	res = max(res, 1.0);
	CHROMA_MOD_FREQ = (phase < 2.5) ? (4.0 * PI / 15.0) : (PI / 3.0);
	ARTIFACTING = (global.quality > -0.5) ? global.quality * 0.5*(res+1.0) : global.cust_artifacting;
	FRINGING = (global.quality > -0.5) ? global.quality : global.cust_fringing;
	SATURATION = global.ntsc_sat;
	BRIGHTNESS = global.ntsc_bright;
	pix_no.x = pix_no.x * res;  

The position of the res = max(res, 1.0); line was incorrect, should be exactly like above.

And thanks again. :smiley:

2 Likes

Got it! Thanks for the review :slight_smile:

2 Likes

With this release GameCube games look a bit too pixelated again.

2 Likes

Have you tried downsampling under Interlacing options?

1 Like

Yeah that or adjusting NTSC resolution scaling can work. I just liked that it was automatic before lol.

2 Likes

I think there’s a problem with ntsc when fringing and artifacting are active. (phase 3 here)
When pushing the resolution scaling parameter to the max at 3, it produces horizontal lines:

around 2.8 it’s diagonal lines.

If I do the scaling manually with x12 on pass1 and x0.166667 on pas2 I don’t have this problem, the result is clean.

2 Likes

It’s just out of the safe zone of the parameter and you can still do the scaling manually. :wink: With regular scaling there are more values at hand, you can fake the effect to a degree only. The scaling was originally limited to 2x though.

3 Likes

NTSC Adaptive shaders update:

I managed to improve the ntsc resolution scale feature for “upscaling”, which works much nicer now. Before “fixing” chroma channels broke luma and vice-versa. It’s possible to adapt both for scaling though with some extra lines of code.

Download link for ntsc-adaptive shaders:

https://mega.nz/file/wpQBFQiY#Eqs9yIzHtd96t-_woH0kKRwBjmeFy2Z5R8nOAUUwwBc

7 Likes

It’s a lot better at non integer scale now, here for 1.5 upscaling:

:+1:

7 Likes

@guest.r

Have you considered adding the sharpness filter from guest-advanced-ntsc to vanilla guest-advanced? Or would it not be feasible? I just like what it does for pixel art regardless of accuracy.

3 Likes

There are two types of sharpening possible. One at original resolution and one at output resolution.

For first one you can just use a sharpen filter instead of the early stock passes. There is already a sharpen filter at output resolution (substractive sharpness), but the end color is clamped to avoid ringing artifacts. I tested different sharpen approaches at output res, but the current is best balanced. The only (current) drawback is it’s poor at sharpening with high regular sharpness.

2 Likes

Can you give an example? Still a bit confused.

1 Like

You can use either the custom fast sharpen, which sharpens horizontally or the regular version.

shaders = "12"
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/crt/shaders/guest/advanced/custom-fast-sharpen.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = "StockPass"
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
5 Likes

Found that the NTSC shader does a wonderful job on Handheld emulation. This legitimately allows me to fullscreen these games now instead of running them in smaller windows.

The major changes to make this work right, are

  • S-Video Preset

  • NTSC Phase 3

  • NTSC Blend Mode 0

  • Scanline Type -1

  • CRT Mask -1

Attached is a Before/After pulled from Golden Sun. mGBA core with the settings for color correction set to ON.

6 Likes

New Release Version (2021-08-20-r1):

Notable changes:

  • Quite nicer “Scanline Spike Removal”, shows best of all implementations up today.
  • Smart Edge Interpolation overhaul, a bit more simple but nicer.
  • Fast version preset shader order changed, allowing absolute scaling for bloom passes, which grants a nice speedup for high resolution content.
  • Fastest version balanced a bit, small speedup.

Download link:

https://mega.nz/file/4xxnjSAI#m2G4E_NRyib9lWmPgTR9slRPG39reBDbiooKQH2jedo

Feedback is welcome. :smiley:

12 Likes

Did you forget the NTSC folder in the zip file or is it moved?

1 Like

The shader package is designed to “copy/paste” into the crt folder, having also an easy repository update in mind. The core gdv ntsc shader got an update, but the main preset and base ntsc shaders have different locations, hence the appropriate file selection.

2 Likes

Hey Guest , thank you for all the hard work. Would it be possible to add a scale for how much “Prescale-x factor” variant is applied ? Any variant of the 4 , is too much “effect” even when both horizontal/subtractive sharpness are maximized.

2 Likes

The Prescale-X factor is a simple feature, which allows more dense texture lookups. For example, if the source image is 320px wide and a scaler with 3x scaling is used, then the main pass gets a 960px source to read from, but without ‘prescale factor’ it ignores every 2 of 3 pixel and reads from a 320px grid. Unfortunately the main pass lookup density is obligatory original source size based, so the prescale-x is here to fix this. It shouldn’t be used without a reason though (more with scalers like xBR…). It’s a simple tweak, but does what’s needed to display the added shape/definition.

With your proposal i’m not sure with which circumstances the feature is used and how it should work instead. If the image gets too sharp downsampling can be used to smooth things a bit out.

3 Likes