Experimentation with a glowing CRT shader

A big problem of scanline-based shaders is that it can only take away brightness (scanlines), and it’s very hard to actually add back brightness since there is a fixed range available.

With the new mipmapping support, I’ve tried to implement a simple CRT shader which can go beyond the [0.0, 1.0] range. When samples start to go above 1.0, the pixels begin to “glow”, bleeding into neighboring pixels, which should in theory allow very bright pixels to appear even brighter because they can cover a larger screen area.

The glow is implemented as two big blurs done at quite low resolutions (hence need for mipmapping to avoid gigantic filter kernels or tons of extra shader passes).

It’s pretty finicky to tune because what looks good on some games looks kinda weird on others.

You need a recent build with sRGB and mipmapping support. https://github.com/libretro/common-shad … r/crt/glow

Some screens: http://imgur.com/1AyHM5Q,C2wxg1H,cf976H … RO,agf6l90

Really like this shader, but is there a way to make the picture sharper, its a bit too ‘blurry’ for my taste??

Here a snap if the shader with Shatterhand on the NES…

https://www.dropbox.com/s/ifi3c39pfaj15 … 143128.png

Also any chance of a 8th pass to add slightly curved edge to the screen with rounded corners, kind of like the crt-curved-geom.cg shader but not so server?

You can probably play around with gauss_horiz.cg. A HORIZ_ROLLOFF factor in the ballpark of 0.35 - 0.45 makes the image sharper.

That’s really nice, great work!

That’s really bright with a good TV like picture (black details aren’t too large, like Mario eyes, letters edges…). My main complain is the moire or uneven scanlines (which one is it?) quite apparent in super mario world intro background. Integer scale isn’t helping here.

I still have to play with the settings… :slight_smile:

edit: Yes that’s moire, the boost values in the gauss_*.cg do this.

The shots are great!

It’s good that it’s separated from the crt shader.

which line is this? i can see an option for this??

what line do you change and to what value?

That’s in gauss_horiz.cg:

#define HORIZ_GAUSS_WIDTH 0.5 —> change this to 0.4

then

#define BOOST 0.25 this is for the brightness boost: high value makes moire, lower value is similar to other crt shaders (darker).

Hmm im not sure thats actual sharpening the overall image it just seem to make the pixels more pronounced, i mean change HORIZ_GAUSS_WIDTH to something like 0.30 and the pixel almost look like a dot matrix display, its not actually taking away the slight de-focus thats being applied when the HORIZ_GAUSS_WIDTH value is at the default 0.5

To actually make it sharper, you’d probably need a different kind of filter horizontally. Gaussian is still gaussian :stuck_out_tongue:

So you can reduce the guassian then? :lol:

Shame i like the shader apart from the lack of sharpness

Added crtglow_lanczos.cgp to the repo. Renamed the old to crtglow_gauss.cgp. The BOOST value doesn’t really match up though. Would have to take into account the integral of the filter kernels or something. It might be necessary to lower the BOOST in horiz and bump up the scale in vert scaling instead to avoid lots of saturation. … Oh, the joys of a [0, 1] range.

That’s nice! sharp and bright.

I see a neogeo game in Mame (maglord) can be clean with integer scale while a snes game (mario world) always displays uneven scanlines.

This looks really good! The brightness makes it very enjoyable; other crt or scanline filters were always too dark for my taste. Thanks Maister!

Ok, do you what i think it is, is slightly too much bloom, the below pic is with the crtglow_lanczos.cgp look at the white create next to the main character its over saturated and the bleed over (bloom) is too much and makes its look ‘defocused’…

https://www.dropbox.com/s/k6u6luv47x1h2 … 224728.png

But im guessing theres not a way to keep that intensity to the ‘glow’ of the display and also keep things more defined without so much bleed over on lightly coloured objects, such as that white create!??

Here’s an animated gif showing the comparisons between the gauss and lanczos shader…

http://gifmaker.me/PlayGIFAnimation.php … c5DM4d.gif

Ye, the Lanczos one is way oversaturated there, indeed.

It does make the screen ‘pop’ more though, I prefer it to the gauss one though i think. Its defiantly a more sharper image than the gauss, i would go so far as to say make a sharper version still and call it ‘crtglow_ lanczos_sharper.cgp’

That’s not a scanlines problem for Mario World intro. I tried using your bloom_only setting in resolve.cg and it shows those lines right on the bloom layer.

That’s strange as an almost white screen on the SNK Logo in Mame doesn’t do this (with integer on, with it off it does something similar).

That’s not a scanlines problem for Mario World intro. I tried using your bloom_only setting in resolve.cg and it shows those lines right on the bloom layer.

That’s strange as an almost white screen on the SNK Logo in Mame doesn’t do this (with integer on, with it off it does something similar).[/quote]

What is your screen resolution ? I use a 1920x1200 res so my scale factor is x5 and i have irregular scanlines whatever core I use. Integer scale should avoid that but seems not here…

btw why the “bloom only” effect has disappeared ? I 'd like to use it with other shaders ;(

I’m on a 1080p 32" TV. I use fullscreen most of the time, integer scale just for testing. But most other shaders have good scanlines with integer on. Some like CGWG-geom-flat are really good at doing their non integer upscaling (with “gaussian beam profile” selected in the shader, not “oversample”), wish all others could act this way.