New simple scanline shader submission

Hello,

I created a scanline shader as i wasn’t really satisfied with the default one and wanted something lighter to use than a full featured crt filters. I’m quite pleased with the results so i decided to share it. The shader shouldn’t be very expensive in term of gpu requirements and is intended to be used with linear texture filtering. Technically it is based on sine function to generate the scanlines, taking color luminance into account to have some variations. I also added some parameters to tweak the scanlines to your taste.

I’m using a 4K screen at non-integer scale ; haven’t tested it on a 1080p display but i think it should work fine, just with less nuances.

You can see some capture with default parameters here : https://imgur.com/a/aRkvmCK And the shader code is available here : https://pastebin.com/USyjt6XA

Also i’m pretty new to shader programming (currently learning by myself) so any feedback and criticism is welcome.

Thanks for reading

6 Likes

hey, looks great. thanks for sharing it! I put in a pull request to add it to the main repo: https://github.com/libretro/slang-shaders/pull/202

3 Likes

It looks good and performance is equal to fakelottes and CRT-Pi. I would add a filter like the sharp one from CRT-Pi so that it doesn’t look so blurry with linear filter.

And a quick GLSL version here

https://mega.nz/file/SqhVkQhS#f2xfOaX7O3L3E14ft9iAe0cANleohgtF5h_5NYnd__c

1 Like

Thanks guys,

Regarding bilinear filtering the smoothness helps in making the illusion that scanlines have variable thickness depending on luminance of color (because color is smoothed). I didn’t try any sharper interpolation method, i’ll give it a try but i’m afraid it’ll make the shader too artifical.

I’m not sure but is it possible to simply make a 2 shader chain? First shader any interpolation shader you like then 2nd shader this one?