CRT Scanline shader for SNES Classic Mini?

So if you want even scanlines across light and dark colours what does the difference need to be between the 2 values, say for example I had the scanline amount (low) set to 4.0 what would the high setting need to be?

There are two ways:

If you want even scanlines AND the mask effect to be applied equally to bright and dark sections of the image, then you can set the Mask/Scanline Fade to 0.0. Then the scanlines and mask will both be applied as if all pixels were dark.

Or, if you still want the mask to fade out, but the scanlines to be equal darkness everywhere, then you would set the “Scaline Multiplier (Low)” to 1.0. Then the “Scanline Amount (High)” will control the scanline darkness for all pixels.


Do you mind if i let people know about your shader on the NeoGaf Mini SNES Hacking thread or are you still going to tweak it some more before proper release?

I don’t mind if you tell them. But I’m still going to fix up the LCD style shader with the proper retroarch syntax/parameter stuff and see if I can actually figure out how to center the games properly. I think it may be retroarch overscan options that are the issue…

So anyone that grabs the shader now won’t get the “Final” version. Not that the shaders I’ll post later tonight will actually be final and bug free.

But on a happy note, I actually just bought an SNES Classic edition. My Target had five or so out and said that they put them out less than an hour before I got there. So I can try out my shaders in real time instead of making you do it! At least, once I hack it and figure out where the shaders go…

Awesome stuff, its super simple to hack the thing so you should have any issues


I’ll be at work for the next several hours after this post, but before I go here is the current (beta!) iteration of my shader along with at retroarch.cfg.

Here you go:

I haven’t tested this much, but I’m posting it now anyway…

The “retroarch.cfg” files goes on the snes classic in “/etc/libretro/” The “ZFAST_CRT_SHADER_SCALING.glslp” files goes on the snes classic in “/etc/libretro/shaders” The “ZFAST_CRT_SHADER_SCALING.glsl” files goes on the snes classic in “/etc/libretro/shaders”

The reason I’m posting the retroarch.cfg is because the built-in retroarch shader had an scanline overlay and was set to integer scaling with custom viewport/aspect ratio settings. My shader wasn’t made with this in mind, so I’m just attaching my config so that the settings should be correct. Keep in mind though that this is still pretty much untested for now since I’ve only had my snes classic for a couple of hours…

Ok have just tried your latest beta but have noticed there appears to be a faint line running down the screen on the right hand side about 2 inches in from the edge of the game screen

Yes. That line appears to be from the limited precision of the mali gpu that davej mentioned. That’s what I’m trying to get rid of now. It wasn’t visible the way the shader was before because the location of the line was to the right of the game screen before I tried to center it. For the moment all you can do is set “Mask Effect Amount” to 0.0. I tried a bunch of things after work last night to try to work around the issue but so far I haven’t been able to. But I’m still working on it. :slight_smile:

EDIT: I fudged the mask calculation so that the default mask works. The coarser 3 pixel mask still has issues. But here is the version I have now:

Ok ill do that for the time being.

Quick question about RetroArchs key combinations, im wanting to set a key config for exiting Retroarch, so when i press L+R+Select+Start it quits back to the SNES Classic menu. I know the button numbers for these buttons in RA is 4+5+8+9 but im not sure how i enter these in the Retroarch.cfg file. Do i need to just add them to the line for Exiting RA with a space between each number as im guessing i cant add a ‘+’ between each number??

If it’s through RetroArch and not the SNES Classic’s menu, you can’t enter arbitrary combos into the cfg, you have to select them from the hardcoded options in settings > input > menu toggle gamepad combo

Thats just for bring up the RA GUI in game though isnt it, is there a combo you can set for actually exiting RA completely?

Yeah, that’s just for the menu. Unless they’re doing something special with the mini builds, the only combos you can use to exit the program are by assigning a ‘hotkey enable’ and then using that button plus something else to exit.

Guess its not a massive hardship of calling up the RA GUI and selecting exit but would of been nice to hide RA altogether

Well I’ve been super busy at work but I figured I should post something.

Once I have time to make everything work better/nicer I’ll make a new thread to put everything in. But for now I’ll just post this in here…

I started to learn how hakchi mods work though. I still have a lot of work to do and the install script is dumb because files weren’t copying properly for me. But here is a test hmod file for hakchi with the shader + a some configs for some cores. Note that there will be issues with sizing and possibly centering right now. It looks like overlay/aspect ratio configs will need to be done on core by core basis (game by game for arcade!). It’s also hard to know exactly what overrides will be needed. So if you’ve been messing with retroarch for some time, then it might be best to nuke the /etc/libretro folder and install the retroarch module from scratch.

But if you start from a stock hakchi and install the 1.0 “retroarch_with_cores” with some cores and then install my hmod by dragging it onto hakchi… or install it by putting my hmod in the user_mods subfolder and then using the “Modules” menu to select “zfast_shaders_test_version”… then you’ll get this out of the box without configuring anything:

which is pretty good for the moment I think. Even though it still needs work for it to be any kind of final. There isn’t even an uninstall script at the moment after all. But this is a start I guess…

The hakchi hmod is here:

There are basic versions (not all of them are “correct”) of the core override config files for the following cores in the hmod:

-FB Alpha -FCEUmm -Genesis Plus GX -Mednafen PCE Fast -mGBA -Snes9x

Not that anything is stopping you from configuring everything yourself.

The shader files haven’t changed much. Except for the filenames. but they’re here: if anyone wants just those.

The current versions can’t be used without an overlay without uncommenting the line:


in the files. The SNES classic literally can’t afford the few extra instructions when drawing a fullscreen overlay. It’s just too slow! So since the overlay will cover it, I let the garbage stay by default right now.

Now that this is an HMOD, let me know how it messes up your retroarch install. I won’t be able to fix it for you, but I’d still like to know about it :wink:


So for disabling overlay is it better to uncomment //#define BLACK_OUT_BORDER rather than removing the input_overlay line in the cfg files, right? Or maybe do both?

I’m just basically waiting for hakchi and this shader to mature to go and install it, props to you. Basically until hakchi allows to bulk edit game command lines for adding -retroarch, and not needing to go game by game adding it, which is dumb IMO.

Well if you disable the overlay then you’ll uncover part of the image where there will be rendering errors. So you should then uncomment //#define BLACK_OUT_BORDER to fix the bad rendering. So you would do both if you don’t want an overlay: uncomment the border option and disable the overlay.

Really, the shader should always black out the rendering errors but right now it just can’t run fast enough to. In the next version of the shader, I’ll be making changes for better quality but you’ll have to set the shader to integer scaling probably. I still need to do more work on it before it’s ready. I’m just trying to get it to run fast enough with parameters for the options. Right now it’s okay with the parameters hardcoded but slightly too slow with retroarch parameters. The full-screen overlay really cuts into the limited performance we have available.

Nice progress, ill just take the files and use them for the time being until the final version is released

Are you planning on adding a curvature setting in the CRT shader? Your shader works amazingly on Android!

1 Like

Second this. Curvate would be sweet.

Any progress on this shader?