Added RGB Mask to CRT Shader

I decided to try replacing the green & magenta mask in crt-easymode with a basic, configurable RGB mask. By default, it’s an aperture grille pattern:

Setting subpixel_width 2, subpixel_height 1, stagger 3, results in Lottes’ shadowmask pattern:

Here’s a link to the updated shader:

http://pastebin.com/NezuKeEi

Here’s some screenshots with the new default parameter settings (you may need to open in a new tab):

2 Likes

Looks great, man :slight_smile:

I’ll get it pushed up to the repo tomorrow morning.

Cool stuff!

Alright, got it pushed up to the repo.

So, Easymode, could you explain conceptually what you’re doing to keep the scanlines from getting funky at non-integer scales? It’s a thing I’d like to achieve with a number of scanline-related shaders but I haven’t seen anyone talking about the problem in the usual places.

Thanks guys.

Before I started writing the shader, I compared each of the shaders in the repo to find out which ones handled non-integer scanlines best. I narrowed it down to crt-geom (with USEGAUSSIAN defined) and scanline.cg. The former method flew over my head, so I settled on the latter’s sine wave method as a basis, but simplifying it further for my sake.

I switched to cosine because I wanted to darken the top and bottom of each scanline. Multiplying the wave by 0.5 and adding 0.5 keeps it in the 0.0-1.0 range, ensuring that it influences every pixel. Wrapping all of this in pow() to a power greater than 1.0 widens the peak of the wave (well it becomes the peak after I invert it). Graphing f(x) = 1.0-pow(cos(xPI2.0)*0.5+0.5,1.5) shows the basic shape of the wave, which just seems to work well for non-integer scanlines. At least that’s the case for scaling factors >= 4.0. You need enough resolution to draw the subtle transitions. Clipping too hard will lose these transitions. If you raise the Brightness Boost parameter too high you’ll see how clipping messes up non-integer scanlines.

lol know that feel.

Thanks for the info :slight_smile:

Nice update!

And man, if your technique for even scanlines at non-integer could be applied to Royale… <3

Hmmm, im unable to get this shader to work, i have even tried a fresh install of retroarch, but the shader just doesnt seem to apply despite me…

SelectingShader passes 1 select crt-easymode.cg

  • filter: Nearest
  • scale: ‘Don’t Care’ (not 1x, 2x, etc)
  • apply

but there’s no shadering being applied

Oh yeah, doing the same thing here. The error is: (128) : error C5043: profile requires index expression to be compile-time constant.

I’m guessing you have an Nvidia GPU, easymode? What about you BlockABoots? I’m on an AMD GPU, and I believe Cg gets compiled down to a lower profile on AMD GPUs.

Doh! Yeah, Nvidia here.

So I can’t calculate the array index on AMD GPUs? Any ideas for a work around (other than an if statement)?

Yeah AMD here (7970)

Can you guys let me know if this works on your AMD cards:

http://pastebin.com/aG3ugcUM

It should work. I settled on using an if statement for the time being.

works for me in linux. good work :slight_smile:

I’ll wait for BlockABoots to verify and then push it up to the repo.

Yeah works here now!, thanks.

Am i right in thinking that changing the following settings…

Scanline Brightness Min…35 Scanline Brightness Max…65

to

Scanline Brightness Min…15 Scanline Brightness Max…35

will make the scanlines more pronounced?

This there anyway what so ever to make the scanlines not almost disappear on white text, like the example below?..

Good to hear it’s working, thanks for your help guys.

That’s correct. Scanline Brightness Min effects dark areas and Max effects bright/white areas.

F-Zero? :slight_smile:

The 15/35 settings you posted above seems to fit that no?

Actually I think 25/50 is closer to the image:

You could also try setting both Min/Max to 0 while scanline strength is at 1.0, and then raising them slowly until they reach the point you want.

Would this shader work with one of the curved-screen shaders ? Looks great, anyway.

Thanks. Although I’m afraid it can’t be paired with another crt shader that has curvature, I would have to add the feature to this one.

F-Zero? :slight_smile:

The 15/35 settings you posted above seems to fit that no?

Actually I think 25/50 is closer to the image:

You could also try setting both Min/Max to 0 while scanline strength is at 1.0, and then raising them slowly until they reach the point you want.[/quote]

Yup F-Zero, well im using a 1440p display so i guess i might get difference results to you if your on a 1080p screen?.

These are settings ive found please @ 1440p (only listed settings ive changed from default)…

Sharpness Horizontal…0.50 Sharpness Vertical…0.75 Scanline Brightness Min…0.20 Scanline Brightness Max…0.40 Brightness Boost…1.60

That may be the case. I only have 1080p displays to test on.