New CRT shader from Guest + CRT Guest Advanced updates

@guest.r

I was wondering if it would be possible to integrate any of this into the shader- specifically, the part about how the pixel brightness depends on the preceding pixels in the raster scan. It would be awesome if we could vary the spot shape/size based on actual CRT behavior. I love how the current shader looks, but for the sake of accuracy it would be nice if the spot shape variation was based on something empirical. This might require an entirely new shader; I don’t know.

Looks like there’s a lot of good info here:

2 Likes

You should increase “brightboost - dark” parameter much over 1.5, and help with gamma. I posted a version above with scanline cutoff ability which should compensate for increased scanline brightness and reshape it back to a thinner form. Otherwise you should be ok by using some scanline shaping parameters and again use cutoff to a degree.

I was wondering if it would be possible to integrate any of this into the shader- specifically, the part about how the pixel brightness depends on the preceding pixels in the raster scan. It would be awesome if we could vary the spot shape/size based on actual CRT behavior. I love how the current shader looks, but for the sake of accuracy it would be nice if the spot shape variation was based on something empirical. This might require an entirely new shader; I don’t know.

Something like this is already in use by various crt shaders by using horizontal intepolation (in linear space) and edge coloring effects, where pixel brightness depends on it’s neighbour pixels. To be more specific, it needs to be a visual noticable effect to be able to reproduce it, again only visually. :grin:

2 Likes

Recently i’ve been working on a new official release candidate for the crt-guest-sm shader. It’s got a lot of new options, suggestions have been considered. Nothing that worked nice was changed. The performance is now similar to crt-guest-dr-venom. No GLSL release though…i’m also very pleased with the fast option there.

I’m also very fond about that vertical games can look nicer with new ‘native’ TATE mode which rotates the image before processing. Core auto rotation must be turned off in core options though. Now for example fb-neo can be used for vertical games without issues. I don’t want to go into details, but the built-in after rotaion smears masks and scanlines with crt shaders, otherwise it’s very ok.

As i mentioned, lot’s of features added, don’t wan’t to spoil though. :grinning: As it turned out before my drivers are quite ressilient regarding some tricks i used and maybe other setups might have issues. It would be cool if these are reported if you try the shader.

Shader can be downloaded by the link below: https://mega.nz/#!wwwgiaza!373j0iOL_R7kCcdrtmJqh2sRjsUk5KKegLHHK9AE7V4

3 Likes

Meh, not much you can do with the crappy display I’m using. :stuck_out_tongue: It’ll be time to upgrade sometime within the next year. I’ve been holding off because I’ve got my eye on one of the Samsung QLED TVs, which would replace my current Panasonic Plasma. It’s just really hard to let the Panny go because of how fantastic it looks for movies and modern games. It’s only 7 years old, and they don’t make Plasma TVs anymore… almost seems like a crime to get rid of it.

I’ve found that I’m getting the best results possible by disabling the bright boost altogether, and then lowering the mask strength until the brightness is acceptable. As you can see below, the mask strength has to come down quite a bit! Current method:

  1. disable bright boost
  2. adjust scanline center and scanline edges to max
  3. adjust backlight to maximum
  4. adjust gamma until inner bars of PLUGE are barely visible
  5. set beam min to 1.3 and beam max to 1.0 (brightens it up a bit while maintaining beam variation)
  6. set mask bright AND mask dark to a reasonable level that results in an adequately bright image. A light meter and/or some simple math helps, here.

Here’s where I landed (again, this is on a display with ~350 nits with the backlight maxed out).

shaders = "2"
shader0 = "shaders_glsl/crt/shaders/guest/d65-d50.glsl"
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 = "1.000000"
shader1 = "shaders_glsl/crt/shaders/guest/crt-guest-sm.glsl"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = ""
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"
parameters = "WP;wp_saturation;smart;brightboost1;brightboost2;stype;scanline1;scanline2;beam_min;beam_max;cutoff;s_beam;cubic;h_sharp;mask;maskmode;maskdark;maskbright;masksize;gamma_out"
WP = "0.000000"
wp_saturation = "1.000000"
smart = "0.000000"
brightboost1 = "1.000000"
brightboost2 = "1.000000"
stype = "0.000000"
scanline1 = "14.000000"
scanline2 = "16.000000"
beam_min = "1.400000"
beam_max = "1.100000"
cutoff = "0.000000"
s_beam = "0.000000"
cubic = "0.000000"
h_sharp = "4.599999"
mask = "0.000000"
maskmode = "0.000000"
maskdark = "0.500000"
maskbright = "0.500000"
masksize = "1.000000"
gamma_out = "2.800000"
2 Likes

This looks great, no issues on my AMD GPU in Win10. I’ll try linux+Intel later. Tons of cool features :slight_smile:

2 Likes

Thanks @hunterk for testing. :upside_down_face: I’d also like to mention that scanline smoothing slows the shader down like 30% and it should run faster with this off, if running on an Intel igpu.

Edit:

I corrected some stuff in the shader, think this should be the final release as it seems to be working.

First viewport-y scale can be changed for speedup to 1.0, scanline smoothing won’t activate, but integer scaling should do nice.

Bloom effect was brought into proportions and better shaped. It works nice in scenarios where the overall image is darker since this shader applies stronger scanlines and masks in this situation with some/defaul settings. Glow works better with other types of graphics, like low color arcade etc.

Download link: https://mega.nz/#!QpQVjAQT!3wlnWgB-73T27qfynjGUh03fFljuf3witRLq7tuvr1c

5 Likes

Looks good :handshake:

https://pasteboard.co/IQzsFVgS.png

2 Likes

Hey! These scanlines look really like i imagined they could. :grin:

Showing off a bit of new features:

Bloom:

TATE:

8 Likes

Scanlines and bloom are amazing!

Really impressed by that bloom, my god.

2 Likes

@guest.r The bloom is really good ! We can get really good brightness and visible mask with your shader while keeping good saturation.

Screenshots without glow,to see how much the bloom is good.

1.https://pasteboard.co/IQBfYli.png

2.https://pasteboard.co/IQBfCDj.png

2 Likes

Hey thanks, my first thought was to combine it with glow if needed. I’ll leave this ‘bloom mode’ in the shader as it’s really usable for focused bloom. But nevertheless i decided to add dispersed bloom option too as it can look quite nice with some games.

The shader also has saturation and contrast adjustments built in so it should work out.

Most recent build is here. Even nitpicky remarks are welcome. :slight_smile:

https://mega.nz/#!w15G3K6Y!8-EwJ-cGC_l07WWGSoKvha-KhklkWmW9mm2Rz-64ggg

4 Likes

I’m gonna try this now. :male_detective:

I have an idea,but I don’t know if it’s a good one haha. It’s to add convergence on bright scanlines with bloom only (like an R.G.B. diffusion) without actually touching the scanline.

Edit: I like this new effect,everything is colorful. :+1:

  1. https://pasteboard.co/IQCFQgh.png
  2. https://pasteboard.co/IQCGaMc.png
  3. https://pasteboard.co/IQCGshY.png
  4. https://pasteboard.co/IQCGKa6.png
1 Like

@guest.r

I think you may have overlooked something in the code.

Bloom1= (blmode < 1.5) ? clamp( Bloom1, vec3(0.0), (1.0-color)) : clamp( Bloom1, vec3(0.0), mix(min(Bloom1, color*mix(2.0,1.0,pixbr)), max(Bloom1,color), orig));

The last part of that line uses orig shouldn’t it be using orig1, that you introduced here. (You create orig1 and don’t use it.

	vec3 cmask = clamp(mix( mix(one, scan3, maskdark), mix(one, scan3, maskbright), mixmask), 0.0, 1.0);
	vec3 orig1 = color;
1 Like

Thanks both for the reply. And good eye @Syh, was a temporary variable which i forgot to delete.

I guess this is the last release candidate version now. :wink:

Both bloom modes work better and can be combined now.

https://mega.nz/#!9hpVgIpS!p0Z7LFkx8hcTE0B2l7EUkBFnfs21D3uUWIWYwluyDNw

Edit: Important update.

2 Likes

@guest.r

No problem, I love looking over your code when you introduce new things, lol.

About to test the new version now!

EDIT: Noticed an interesting bug with the TATE mode. Don’t know if it does it with everything but try and run a game like Cadillacs and Dinosaurs (a game that integer scales the entire h and v resolutions) then apply TATE via shader settings, set to 1 then set it back to zero and look at the bottom of the screen. There’s some black horizontal lines… But you reapply the shader(apply changes) or reset integer scaling and they go away.

1 Like

Yeah it’s normal. The x and y resolutions are shifted with TATE mode so previous x-resolution must contend with the 1080p resolution for example. You got an underscan effect i guess.

1 Like

Alright, cool lol.

Just something I noticed wasn’t sure if it was known or an actual issue. (I mean it’s really easy to resolve the issue without really doing much.)

1 Like

Until I get a much brighter display, I’m sticking with just scanlines + gamma correction. Your standard LED-lit LCD just doesn’t have the brightness to do phosphor/mask emulation without A LOT of compromises. Anything you do to make up for the lost brightness via software just winds up making the image quality worse in other ways. I wind up tweaking settings for hours and am never quite satisfied with the result.

It’s worth pointing out that black frame insertion is essential if you want to preserve mask detail whenever there’s any horizontal motion. Without it, the mask just disappears whenever an object scrolls horizontally. On top of this, the mask actually exacerbates the motion blur on an LCD if you’re not using BFI (at least in my experiments).

That said, the scanline-mask shader still looks damn good sans mask, so I’ll still be using this shader for the foreseeable future.

Should be viewed @ 1080p and with display backlight set to 100%:

Color saturation seems off and the phosphors aren’t displaying anything close to accurate intensity values- remember, 100% white should be 100% red, blue and green (or 100% magenta/green if using the magenta/green mask). This goes back to my point that there’s no way to get adequate brightness when using the mask other than cranking up the backlight. Anything else you do is compromising the objective picture quality or compromising the accuracy of the CRT emulation. Of course, it’s up to individual preference whether these compromises are acceptable, but I’m a bit of a perfectionist when it comes to these things (in case you couldn’t tell).

This may be of interest. Regarding bloom, I think I found an objective reason why it’s undesirable - it negatively affects the ability of the screen to deliver contrast. You’re increasing brightness at the expense of contrast (and saturation). You’re already dealing with a pretty severe lack of contrast and saturation when trying to emulate a CRT on an LCD; adding bloom just makes the problem worse.

When a single pixel is displayed on the screen of a CRT it has a spatial profile that extends beyond the borders of thecell in which it is conceptually localized. This ‘leakage’ turns out to be the limiting factor in the ability of the CRTto deliver contrast on its screen.

shaders = "2"
shader0 = "shaders_glsl/crt/shaders/guest/d65-d50.glsl"
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 = "1.000000"
shader1 = "shaders_glsl/crt/shaders/guest/crt-guest-sm.glsl"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = ""
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"
parameters = "WP;wp_saturation;smart;brightboost1;brightboost2;stype;scanline1;scanline2;beam_min;beam_max;cutoff;s_beam;cubic;h_sharp;mask;maskmode;maskdark;maskbright;masksize;gamma_out"
WP = "0.000000"
wp_saturation = "1.000000"
smart = "0.000000"
brightboost1 = "1.000000"
brightboost2 = "1.000000"
stype = "0.000000"
scanline1 = "14.000000"
scanline2 = "16.000000"
beam_min = "1.300000"
beam_max = "1.000000"
cutoff = "0.000000"
s_beam = "0.000000"
cubic = "0.000000"
h_sharp = "4.599999"
mask = "0.000000"
maskmode = "0.000000"
maskdark = "0.000000"
maskbright = "-0.000000"
masksize = "1.000000"
gamma_out = "2.600000"

This may be of interest. Regarding bloom, I think I found an objective reason why it’s undesirable - it negatively affects the ability of the screen to deliver contrast . You’re increasing brightness at the expense of contrast (and saturation). You’re already dealing with a pretty severe lack of contrast and saturation when trying to emulate a CRT on an LCD; adding bloom just makes the problem worse.

My version improves contrast as well as increases saturation a bit (focused or dispersed version can be used), but as it’s obvious some games like a touch of brightness. It could happen naturaly with a proper display, viewed from a proper distance using only maxed out masks i think. I find it cool to take the human factor into account, like the resolution of sight, viewing distance, eye sights which aren’t 20-20, budgets for a display etc. :grin:

In theory bloom isn’t that bad. By tricking the human eye very bright small dots can be ‘emulated’ by increasing the surface of the ‘light emmiter’, which can compensate by it’s surface.

6 Likes

Until 99% of libretro users have a good screen, we need to use compromises even if it is not accurate. Shaders that aren’t accurate or totally different from crt rendering don’t mean you can’t enjoy playing with them. And don’t forget that not everyone plays with nose sticking on the screen :lying_face:, a mask will not necessarily be visible from a certain distance because of selected size in runtime, so some will deactivate mask to have a pure white because they won’t see it anyway from their sofa and screen size. Let’s not be in a hurry to make a precise crt shader right away, we have time, there is no harm in experimenting with other effects like for my fake royal crt mask for example and other stuffs. 8k gaming with 120 fps black frame insertion +1000 nits means a lot of money necessary for screen but also pc with good specs (well not 100% true for pc with upscaling technology etc). :stuck_out_tongue:

4 Likes