Yet, another CRT Shader

Love this shader… Switched to it for my main go-to shader… Works good at non-integer 1080p

Thanks, Hyllian

Well, I just tested the suggestions, but couldn’t get the expected results.

Your color manipulation code produces a bluish so strong that I almost can’t see the game running. Are you sure that is the code?

Turning off the color code and keeping the phosphor code I managed to get output, though I think it doesn’t resemble your results. Here’s a comparison of current crt-hyllian and the modified with PHOSPHOR_STRENGTH=0.8:

http://screenshotcomparison.com/comparison/163477

Could you paste your complete shader? (so I can analyse if there are more differences. I’ve seen that you use the #ifdef PHOSPHOR, and it’s already deprecated on current version. Maybe you are using an old version.)

[QUOTE=Rick74;34922]Love this shader… Switched to it for my main go-to shader… Works good at non-integer 1080p

Thanks, Hyllian[/QUOTE] You’re welcome!

Indeed I’m using an old version (I had no time this year to follow the latest modifications) :

http://pastebin.com/Y8NyJVgQ The modification starts at line 209. Notice I’ve set SCANLINES_STRENGTH to 1.0 and BEAM_MIN_WIDTH to 0.1 which I think looks quite good with the phosphor effect. The blue tint on dark pixels is not necessary but I like it.

Here’s donkey kong country with the version I’m using :

I’m testing several games with it, and I’m quite satisfied with what I’ve got. But I’ll be testing the latest version for sure !

Yes, that’s a very old version. Even the gamma code was wrongly used there (I fixed it some months ago). The new version I think is much better. If you have time to try to get these changes to the new version, I’d like to know. For now, I’ll let the current code as-is.

Here is a simple way of implementing phosphor brightness and contrast to the latest version : pastebin : crt-hyllian-phosphor-test

I’ve added 2 parameters :


#pragma parameter [b]PHOSPHOR_BRIGHTNESS[/b] "CRT - Phosphor Brightness" 0.7 0.0 1.0 0.02
#pragma parameter [b]PHOSPHOR_CONTRAST[/b] "CRT - Phosphor Contrast" 0.0 0.0 1.0 0.02

The default Brightness is set to 0.7 and Contrast to 0.0 which gives you exactly the default Phosphor effect found in your shader.

I modified line 200 :


    float col_factor = PHOSPHOR_BRIGHTNESS * (1 - PHOSPHOR_CONTRAST + PHOSPHOR_CONTRAST * (color.r + color.g + color.b)/3);
 
    float3 dotMaskWeights = lerp(
                                 float3(1.0, col_factor, 1.0),
                                 float3(col_factor, 1.0, col_factor),
                                 floor(fmod(mod_factor, 2.0))
                                  );

Thanks for the new code. I’ll play with it a bit.

In your old code, the mask and the contrast code were applied in encoded gamma. Now it’s applied in linear gamma. I’m not sure where is the best place to put the code. I’ll play a bit with it.

The contrast doesn’t seem to make a big effect on contrast, though. Maybe it needs a new name.

I played a bit with it, but couldn’t find a good configuration. I prefer the default. When I increase contrast, it turn the colors a bit dark.

BTW, I’ve succesfully separated the current shader in two passes, keeping the IQ and making it much faster! It’s already uploded to the common-shaders repo. The preset is called crt-hyllian-multipass.cgp.

A glsl ported is waiting to be approved here: https://github.com/hizzlekizzle/glsl-shaders/pulls

Hyllian, any chance of adding a curved screen option ? I would love to test this shader on my own overlays, but the flat look on a curved-screen type overlay doesn’t look right.

[QUOTE=John.Merrit;34999]Hyllian, any chance of adding a curved screen option ? I would love to test this shader on my own overlays, but the flat look on a curved-screen type overlay doesn’t look right.[/QUOTE]

Only if I borrow from another crt shader. I don’t have the will to reinvent the wheel.

I’ll look the available ones and see if I can borrow.

[QUOTE=John.Merrit;34999]Hyllian, any chance of adding a curved screen option ? I would love to test this shader on my own overlays, but the flat look on a curved-screen type overlay doesn’t look right.[/QUOTE]

It’s very easy to reuse the barrel code from lottes. Here it’s --> http://pastebin.com/Kpsywazw There you can tweak at will.

I won’t use it on the main source, though.

Hyllian, many thanks.

Edit: Worked a treat, thanks.

hi hyllian! i was just about to test your multipass shader from IRC - i’m afraid it didn’t work for me, if i loaded the preset or i loaded the individual shaders. checked the paths and they seem correct compared to other shaders that work (eg crt-hyllian-fast.glslp). i guess maybe some features that the pi doesn’t like? not sure of the best ways to debug shaders, but happy to help if you have any ideas.

Thanks for the tests. I don’t know why they don’t work on Rpi. They work flawlessly on PC. Unfortunately I can’t debug it for Rpi.

I just updated the shader with a param that allow to toggle between horizontal and vertical scanlines. It’s useful for some shmup games.

Nice!!! Thanks!

I added a new crt combination called crt-super-xbr, that combines crt-hyllian with super-xbr shaders.

Other than that, I lowered the scanlines strength in crt-hyllian from 0.72 to 0.50, because it was too strong (I think I didn’t realized it when I had added the phosphors by default).

The crt-super-xbr is very similar to the standard crt-hyllian, except it slightly round some jaggies, though the effect is so subtle you may not notice at first.

Thanks for the vertical option ! Does it rotate the horizontal filter also ? It seems not. :confused:

Yes, it rotates. Which game are you running?

Sorry for the late reply In fact the problem is elsewhere :stuck_out_tongue: I use to combine xbr and crt. I have pretty good results with horizontal scanlines so i changed the scale factor to use it vertically but that doesn’t work properly.

shaders = "2"
shader0 = "xbr/legacy/2xbr-v3.8b.cg"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "2.000000"
shader1 = "(custom)/crt-hyllian-vert.cg"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = ""
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"