Request: add Blargg’s RGB preset to NTSC shader(s)

Blargg’s RGB preset has become an essential component of my entire setup, but some cores lack Blargg’s filter. NTSC shaders replicate composite or S-video very well, but none of them have the RGB preset. Perhaps one of our talented shader authors can tackle this? :smile:

7 Likes

tvout-tweaks replicates it. Just maximise the horizontal bandwidth and enable “tv color levels”. That’s it.

4 Likes

Very nice, thanks! :grin:

1 Like

Are you sure?

Blargg’s RGB filter

TVouttweaks

#reference "shaders_slang/crt/tvout-tweaks.slangp"
TVOUT_RESOLUTION = "1024.000000"
TVOUT_TV_COLOR_LEVELS = "1.000000"
1 Like

Yeah you’re right, blargg looks blurrier and the gamma is different. Originally I got that info from the “NTSC Filters” page on the emugen wiki that said they’re the same. Bunch of frauds :upside_down_face:

I reckon you could get 99.9% of the way there by just lowering that horizontal resolution in tv-out tweaks a little and then combining it with the “image adjustment” shader and raising the target gamma parameter. It’s inelegant but it should do the job.

edit i tried it out and the colours themselves look different in blargg, not just the gamma. I wonder what it’s actually doing to the colour levels…

1 Like

We really just need to figure out what kind of sharpening filter it’s using, I’m not smart enough though. :slightly_frowning_face:

I can’t play anything without this filter, it just looks objectively worse without it.

Does anyone know what kind of scaling Blargg’s RGB filter is doing? Is it Lanczos?

@guest.r

@hunterk

pretty sure it’s not doing any (net) scaling at all, since you can put CRT shaders on top of it, etc.

1 Like

Any idea what kind of blur/interpolation it’s doing, then? Doesn’t look like gaussian. High-contrast edges are sharp/bold, and there’s some (natural looking) ringing artifacts, which is why I thought Lanczos.

@hunterk

What do you mean?

It’s doing something I suppose as the black pixels are getting wider then, which I’m trying to fight as I really dislike that. :persevere:

602 pixels in Nestopia.
Linear rescaling in Blargg filter.

edit: Ah, you’re talking about RGB.
I’m using fast-sharpen in my ntsc presets, that worked fine.

1 Like

Ok so what does this mean? :sweat_smile:

I’ve noticed on my CRT that blargg’s RGB in snes9x changes the horizontal scaling/aspect ratio ever so slightly, which causes horizontal scrolling artefacts when the screen pans (basically every game). It’s a complete deal breaker on my setup.

Shouldn’t that be completely solved with a slight gaussian blur?

I don’t notice such artifacts when using the RGB filter with guest dr venom…

In my setup, I don’t see any such artifacts. Do you see any in the video below? Need to download and view at original size.

https://www.dropbox.com/s/wyroowukoo47y0w/Super%20Mario%20World%20(U)%20[!]-210527-174342.mkv?dl=0

Blargg to me looked like an horizontal convolution. I don’t know how he did it since I haven’t seen the code but look here where I showed an example. The real shader would be to modulate the signal, demodulate it with a FIR or decomb filter, there are some examples in the PAL folder.

1 Like
#define TAPS 8
const float luma_filter[TAPS + 1] = float[TAPS + 1](
   0.0019, 
   0.0052, 
   0.0035, 
   -0.0163, 
   -0.0407,
   -0.0118, 
   0.1111, 
   0.2729, 
   0.3489);

const float chroma_filter[TAPS + 1] = float[TAPS + 1](
   0.0025, 
   0.0057, 
   0.0147, 
   0.0315, 
   0.0555,
   0.0834, 
   0.1099, 
   0.1289, 
   0.1358);

Replace everything in ntsc-decode-filter-3phase.inc (slang/ntsc/shaders folder) or you can create a new .inc file and rename all #include files

Or this to keep color intact:

#define TAPS 8
const float luma_filter[TAPS + 1] = float[TAPS + 1](
   0.0019, 
   0.0052, 
   0.0035, 
   -0.0163, 
   -0.0407,
   -0.0118, 
   0.1111, 
   0.2729, 
   0.3489);

const float chroma_filter[TAPS + 1] = float[TAPS + 1](
   0.0019, 
   0.0052, 
   0.0035, 
   -0.0163, 
   -0.0407,
   -0.0118, 
   0.1111, 
   0.2729, 
   0.3489);

Edit: Sony CXA2025AS (ntsc-rgbyuv.inc)

const mat3 yiq2rgb_mat = mat3(
   1.0, 1.630, 0.317,
   1.0, -0.378, -0.466,
   1.0, -1.089, 1.677);

vec3 yiq2rgb(vec3 yiq)
{
   return yiq * yiq2rgb_mat;
}

const mat3 yiq_mat = mat3(
      0.299, 0.587, 0.114,
      0.595716, -0.274453, -0.321263,
      0.211456, -0.522591, 0.311135
);

vec3 rgb2yiq(vec3 col)
{
   return col * yiq_mat;
}
2 Likes

I have questions, what is this doing exactly?

Like ye, I get that ntsc-rgb stuff and Sony stuff at the end are happening, but like some more context would be absolutely lovely.

@ProfessorBraun

2 Likes

It allows you to control the sharpness (among other effects with other settings) ,here are some examples with screenshots.

#define CHROMA_MOD_FREQ (PI / 2.0) in ntsc-param.inc and scale_type_x = “source” scale_x = “4.0” for ntsc-pass1-svideo-2phase.slang or ntsc-pass1-svideo-3phase.slang

-With 33 taps or (32+1)

1.https://ibb.co/D861RRf

2.https://ibb.co/pPFfj2K

-25

1.https://ibb.co/gwyrNxw

2.https://ibb.co/YWMF6WK

-9

1.https://ibb.co/M6d73kj

2.https://ibb.co/R3DYG7G

Tested with crt-royale default settings except for mask and curvature. If it’s not displayed correctly,try to download them maybe.

Edit: In-game

2 Likes

-19 taps would probably be around what I’d use, if I’m to use those screenshots as a gauge.

I personally don’t understand how to adjust the tap amount myself, any pointers or anything would lovely.

Will definitely look into adapting this tho.

1 Like

Maybe someone knows the right values for 19 taps,also you can change values in guest/advanced/ntsc folder , it will work too.

2 Likes

Looks very good. So, is this it? Is this what Blargg is doing?

2 Likes