NTSC Shaders for SEGA Mega Drive / Genesis

I wasn’t sure whether to post this on the current NTSC shaders thread but I thought it probably warranted its own discussion. Sorry if I’m wrong.

Until recently, I’ve been using blargg’s NTSC filters when playing retro games but I’ve become increasingly frustrated by the video filter being reliant on which emulator core I’m using. Lots of cores are missing them entirely and some, such as snes9x, currently have a broken implementation, as far as I can tell. I’ve come to the conclusion that I’d really rather have a shader implementation that’s separate from the emulator core.

As such, I’ve been experimenting with themaister’s NTSC shaders. I’m quite happy with the results on NES but things get more complicated when we go over the 16-bit consoles.

Below are some images to illustrate my problem:

Raw pixels:

blargg’s NTSC composite filter, built into emulator:

themaister’s NTSC 2-phase composite shader:

themaister’s NTSC 3-phase composite shader:

themaister’s (?) NTSC xot shader:

As I hope you can all see, there is quite a lot of variation here. As I understand it, themaister’s 2-phase shader should be the best fit for the mega drive. However, it looks awful here and 3-phase isn’t a lot better. Xot gets close to blargg but still isn’t quite as good.

There are also problems on the SNES side.

Raw pixels:

themaister’s NTSC 3-phase composite shader:

themaister’s 3-phase shader should be a good fit for this console, I believe. However, we get the same pattern issue as on the mega drive. Ironically, the 2-phase shader handles SNES transparency better but leaves other areas more artifact-y than I would prefer, compared to the 3-phase shader and the real console.

Does anyone have any thoughts here? I don’t have any experience writing shaders, myself, but, in an ideal world, I would love either for blargg’s filters to be ported over as a slang shader or for someone to tell me how I can adjust themaister’s NTSC shaders to get better results.

Thanks for reading! :slight_smile:

3 Likes

The rainbow and diagonal line artifacting are accurate (scroll down to the sonic waterfall comparison): https://www.chrismcovell.com/gotRGB/screenshots.html

also: How crappy of a TV do you need for composite video artifacts?

These are photos of real consoles hooked up to real TVs.

However, the artifacts and quality of composite video varies quite a bit across consoles and even console revisions (for example, IIRC, the rainbowing on Genesis Model 2 is very strong vs other revisions).

The reason there are so many variants of blargg’s filter is because it’s very dependent on resolution, so each implementation has to be hardcoded to match the core it’s applying to. The SNES variant has to handle switching between normal 256-width mode and hires 512-width mode, and if you apply this one to the Genesis/MD, it cuts the screen in half because it doesn’t deal with 320-width properly, etc.

Also, FWIW, themaister only wrote the NTSC shaders with no other names on them (e.g., ntsc-320px, ntsc-256px), while ntsc-xot, ntsc-mame, etc. all come from different authors.

So, just pick whatever looks best to you, but as with most analog stuff, it’s difficult/impossible to pin down a single “best” on an objective basis.

4 Likes

The thing is that Megadrive games don’t all run at the same horizontal resolution. Some are 256 and some are 320. With SNES it can vary between 256 and 512 (it even changes mid-game like in a lot of Squaresoft titles). Some of those NTSC shaders expect a specific resolution - So you have to select the correct shader per game which takes a bit of investigating. That’s why you’ll get varying effects and artefacts.

Hmmm…

Thanks for the info, guys. Sonic looks good with themaister’s 3-phase shader, as is. Perhaps streets of rage 2 runs at a different resolution, then?

This composite footage, on real hardware, looks most like blargg’s filter, to me.

Do you think there’s any way of replicating that with themaister’s shaders?

To clarify, my goal here is not so much to make things look good but to make them look authentic.

I suppose the real genius of blargg’s filters is that they seem to change to match the given resolution at any one time… Can anyone confirm or deny that for me? If that is the case, is that even possible with a shader?

1 Like

I imagine it’s possible with a shader, you’d just have add an if or something that would cause it to behave differently when the vertical resolution hit a certain height.

I can’t do this personally as ntsc shader code hurts my head.

But it should technically be possible I’d assume.

Kirby Dream Land looks good on ntsc-320px-composite or ntsc-256px-svideo. And majority of SNES games look decent with ntsc-256-composite, so you can set shader game override for Kirby. SNES uses dithering less often than SMD.

1 Like

Thanks to both of you for that information. I suppose it shouldn’t be too hard to write a shader preset that switches to svideo, or a higher resolution, for games/scenes that run in a higher resolution. Upon further reading and experimentation, I think that might be what ntsc-adaptive is for? I’m not sure. People are talking about it in the other ntsc shader thread but it’s all over my head…

For now, I think I’ll just set the svideo shader as the default for games that look better with it.

Thank you, everyone! :slight_smile:

2 Likes

In simple terms ntsc-adaptive is a shader the can switch between composite and svideo (via shader settings, so no switching shaders to change video modes) using the same resolution for both. (At least this is my understanding, lol. So grain of salt, it does change between composite and svideo easily though.)

To me the luma plane of blaarg’s filter looks a lot like a convolution shader, while it’s not the same it conveys a similar feeling. Don’t ask me how to code this because I’m not even being able to code a median filter.

3 Likes

I see. It would be lovely if there was a shader preset that could switch between the two, depending on resolution. It would be even better if it could actually adjust to the resolution properly, of course. I think themaister’s ntsc shader might actually produce more accurate-to-life results than blargg’s, in the case of sonic. I’m assuming sor2 has an oddball resolution. Is there a way to check, in retroarch?

2 Likes

You know, that doesn’t actually look too far off the composite capture in the video…

2 Likes

Which shader are you referring to, here?

1 Like

Pretty sure he’s referring to ntsc-adaptive, if I’m not mistaken.

As he made that fairly recently.

1 Like

yeah, i was referring to ntsc-adaptive, and it indeed has a parameter to switch between svideo and composite (that is, it just toggles the composite artifacting) but it also switches between the 256 and 320 width settings based on the size of the image.

4 Likes

That’s great to hear! It’s sounds like you’re already working on the kind of shader I’d like to have access to. Thank you for your work! Also, sorry for making a separate thread. I didn’t understand the previous thread well enough to know if what I wanted to ask was relevant or not… :sweat:

1 Like