Koko-aio shader discussions and updates

All of this is why we need to embrace the hybrid approach of leveraging the brightness advances that have been made in TVs in recent times.

So how long do we have to wait until approaches that don’t wash out the phosphor become more of the norm, rather than the exception?

What would it look like if it took a very much blurred version of the original image after it has been represented by an RGB phosphor mask and applying the brighter tones of the glow to the outsides of each phosphor creating a halo around each phosphor that is in the same colour of each phosphor?

Assuming the rgb mask represents the original image with accuracy, its blurred version will be the same as the blurred original image without the mask.

I don’t think that the halation effect is something one would like as is.

I’m picturing something different in my mind. I’m visualizing soft red, blue and green halos around each phosphor, with no white anywhere, except if viewed from an appropriate distance. In other words each phosphor being blurred individally.

I think it would only look the same if the blurring is at an extreme level but it has the potential to provide an individual glow effect to each phosphor without the washing out effect because the glow would be the same colour as the phosphor it surrounds.

The 2 looking the same might depend on other factors such as display resolution and TVL of the emulated phosphor mask. i.e. it might work better if we have higher display resolution and lower TVL CRT resolution.

Yes, I was talking about halation, which is big.

Blurring as you say is computational expansive; emulating the phosphor glowing is not, or at least there are shortcuts:

https://forums.libretro.com/uploads/default/original/3X/7/4/740148afa097d09b7ea6dac399ffa6d0ce816f49.jpeg

Maybe haloing every single phosphor could be achived with no much load, but imho would be really important only if you stay with your nose into the screen; also you would nead a bunch of free display pixels per triad to show it properly; maybe not even a 4K would be enough.

Edit:

With 2 lines of code and a resolution of 9600*5400 something like that is doable right now to emulate a TVL of 500; it is a steep phosphor with a slight glow:

:

At 5760*3240 you would have this (moirè present already)

At 4k: a disaster:

But really, even if it is fashinating, today it is not yet feasible, so you HAVE to join pixels and averaging them before presenting the final picture to the screen.

PS: Curvature produces moire, but disabling curvature turns moire into a weavy effect, so not much to gain there.

3 Likes

Yes, it does look pretty but the colour mean is exactly what I was referring to in the first case but with some code to exclude it from showing white or any colour that starts washing out the phosphor primaries too much.

So maybe some sort of curve could be implemented where the glow effect tapers as things get closer to white and is more weighted towards the midtones.

How does that sound? I hope you understand what I’m trying to explain.

I think this approach has the potential to take things one step further than what the current Sony Megatron Colour Video Monitor does.

The moire is very heavy even in screenshots. It seems like it’s baked into the Scanline/phosphor calculations rather than an optical illusion created by the way the patterns intersect/interact.

It definitely needs extra brightness to look right. HDR would definitely help and if it’s possible, to get the shapes of the phosphors to make more sense/be more realistic overall.

Thanks for taking the time and making the effort to oblige me. The ability to write code is definitely a gift I admire.

What do you think? @guest.r, @Nesguy, @DariusG, @hunterk, @beans Is any of this useful in the context of improving the accuracy of CRT emulation?

2 Likes

But this means to sacrifice accuracy, right? Take an extra bright display and let him do it with no efforts like Megatron does; just wait for the hardware or accept something that looks convincing from a proper distance; that’s what I think.

2 Likes

What I’m talking about is a better, more accurate bloom/halation that doesn’t wash out/desaturate the phosphor colours especially in the white areas/highlights.

A hybrid approach is plausible where HDR makes it possible to use less effects which sacrifice accuracy for brightness.

I understand what you’re saying but my approach to these things is to build out from the phosphors and scanlines so it scales from the screen to whatever distance you’re sitting at. There are infinite levels and opinions as to which approach is acceptable or not.

I think if you get things right, down to the phosphors and scanlines level, there are tangible benefits which can be obtained.

In terms of the hardware advances contributing to the work, we’re in a time when bright HDR capable displays are more affordable than ever and lower brightness HDR displays can take advantage of thy hybrid approach, which has been available for a while now in RetroArch but I think has been underutilized.

For the rest, continuing to experiment with an test more accurate or efficient ways of doing things keeps things evolving and improving in interesting ways.

Magic Glow is an example of this. Who knows what will be the next big thing in CRT emulation or maybe it could be something small that keeps things moving in the right direction?

It is, indeed; since there are not enough pixels to draw things to, some fall across 2 of them in a repeated/periodic pattern which is easilly spotted by the brain. It is very similar, and I’d say the same principle, as the optical moirè effect.

My only complain with how shaders look even today is the motion induced blur; but for the rest I’m already satisfied when I compare them with my real CRT in the cabinet.

2 Likes

I could test it out and see what it looks like at 1000 nits, I think it could be useful

2 Likes

That would be great. I would love to test shaders based on both ideas as well.

What would happen if you tried something like rendering at a higher resolution then downsampling to get rid of the moire @kokoko3k?

Artifacts gone, probably, but mask too.

I’ll make a test pack with the modified shader and a test preset, but consider that I’m an lcd@1080p user :sweat_smile:

1 Like

…And this couldn’t be done on the blurred Mask/Glow effect alone with the real Mask remaining unfiltered/not resampled?

Don’t worry man, we’ve got your back. Just remember less is more. Even if there’s only a slight improvement to the phosphor shape/appearance, I’ll gladly take and appreciate that as it means everything that is built using those phosphors has the potential to be improved.

Yes, but it would be ineffective, since it is the detail in the mask itself to produce the artifacts. Lower the target TVL would help, but numbers suggest that you’ve to go much lower than 500 to hope for a good picture even on 4k.

When I’ll post the test shader, the target TVL will still be configurable; it is still koko-aio with a slight modification to halo the phosphors.

1 Like

First time messing with Kok-aio. Really nice! Question: Is there a way to import MegaBezel presets into this, or can I just copy/paste settings? I love the bezel/background glow, but want my own pixel presets for the actual CRT itself.

1 Like

Nope, they are totally different projects with different parameters.

To match it, you can either take a look to the koko-aio docs and/or post a screen of the preset you want to replicate to get help.

1 Like

One example of where I’m at with my customization in MBZ:

Not very easy to replicate. Each have around 46 shader passes. You’ll probably have to open in a separate window to remove artifacts, see at full 1440 resolution.

I’ve also got shadowmask presets, some for various monitors, such as 1980s RGB, VGA and Commodore 1084s.

Your 1084s preset is pretty nice, btw.

1 Like

Please check this, I think bloom may still need a bit of tweaking (mine and yours are a bit too much for my taste anyway :slight_smile: ) @MrBlastman

Preset
IN_GLOW_GAMMA = "2.200000"
GAMMA_OUT = "0.440000"
DO_CCORRECTION = "1.000000"
IN_GLOW_POWER = "2.000000"
CONTRAST = "0.050000"
VIBRANCE = "0.100000"
DO_SHIFT_RGB = "1.000000"
OFFSET_STRENGTH = "0.250000"
DO_IN_GLOW = "1.000000"
IN_GLOW_SPREAD = "1.700000"
IN_GLOW_W = "3.000000"
IN_GLOW_H = "7.000000"
DO_PIXELGRID = "1.000000"
PIXELGRID_MAX_H = "0.750000"
PIXELGRID_GAMMA_H = "3.599999"
PIXELGRID_MUL_X = "2.000000"
PIXELGRID_H_PRST = "0.000000"
PIXELGRID_H_COUNT = "2.000000"
PIXELGRID_R_SHIFT = "0.300000"
PIXELGRID_G_SHIFT = "0.500000"
PIXELGRID_B_SHIFT = "0.700000"
PIXELGRID_MIN_W = "0.500000"
PIXELGRID_MAX_W = "0.500000"
PIXELGRID_GAMMA_W = "6.199998"
PIXELGRID_BASAL_GRID = "0.020000"
PIXELGRID_Y_MASK = "0.000000"
PIXELGRID_Y_MASK_HEIGHT = "-2.000000"
PIXELGRID_Y_MASK_OFFSET_DEHIVE = "0.230000"
PIXELGRID_Y_MASK_ON_WHITE = "0.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "1.000000"
HALO_SHARPNESS = "7.000000"
HALO_GAMMA = "1.000000"
HALO_GAMMA_OUT = "2.350000"
HALO_VS_SCAN = "0.260000"
DO_BLOOM = "1.000000"
BLOOM_MIX = "1.000000"
BLOOM_SIZE = "1.000000"
BLOOM_GAMMA = "2.000000"
BLOOM_GAMMA_OUT = "3.000000"
BLOOM_POWER = "2.000000"
BLOOM_EYE_ADPT_SRT = "0.000000"
BLOOM_EYE_INERTIA = "10.000000"
BLOOM_OVER_WHITE = "1.000000"
BLOOM_HALATION_MIX = "0.700000"
DO_CURVATURE = "1.000000"
DO_BEZEL = "1.000000"
BEZEL_FRAME_ZOOM = "0.183000"
BEZEL_REFL_STRENGTH = "2.000000"
BEZEL_CORNER_DARK = "0.700000"
BEZEL_RFL_BLR_SHD = "-0.540000"
BEZEL_ROUGHNESS = "1.500000"
BEZEL_DIFFUSION_STR = "1.000000"
DO_GLOBAL_SHZO = "1.000000"
GLOBAL_ZOOM = "0.928497"
DO_VIGNETTE = "1.000000"
V_SIZE = "1.200000"
V_SHAPE = "0.800000"
DO_SPOT = "1.000000"
S_POWER = "0.067000"

-EDIT-

Since I was there, i made a variant for 1080p, but less bloomy and a with a bit more relaxed colors.

Preset
IN_GLOW_GAMMA = "2.200000"
GAMMA_OUT = "0.350000"
DO_CCORRECTION = "1.000000"
IN_GLOW_POWER = "2.000000"
TEMPERATURE = "7000.000000"
VIBRANCE = "0.100000"
DO_SHIFT_RGB = "1.000000"
OFFSET_STRENGTH = "0.250000"
DO_IN_GLOW = "1.000000"
IN_GLOW_SPREAD = "1.700000"
IN_GLOW_W = "6.000000"
IN_GLOW_H = "7.000000"
DO_PIXELGRID = "1.000000"
PIXELGRID_MAX_H = "0.750000"
PIXELGRID_GAMMA_H = "3.599999"
PIXELGRID_MUL_X = "1.500000"
PIXELGRID_H_PRST = "0.000000"
PIXELGRID_H_COUNT = "2.000000"
PIXELGRID_R_SHIFT = "0.300000"
PIXELGRID_G_SHIFT = "0.500000"
PIXELGRID_B_SHIFT = "0.700000"
PIXELGRID_MIN_W = "0.500000"
PIXELGRID_MAX_W = "0.500000"
PIXELGRID_GAMMA_W = "6.199998"
PIXELGRID_BASAL_GRID = "0.020000"
PIXELGRID_Y_MASK = "0.000000"
PIXELGRID_Y_MASK_HEIGHT = "-2.000000"
PIXELGRID_Y_MASK_OFFSET_DEHIVE = "0.230000"
PIXELGRID_Y_MASK_ON_WHITE = "0.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "1.000000"
HALO_SHARPNESS = "7.000000"
HALO_GAMMA = "1.000000"
HALO_GAMMA_OUT = "2.350000"
HALO_VS_SCAN = "0.260000"
DO_BLOOM = "1.000000"
BLOOM_MIX = "0.650000"
BLOOM_SIZE = "1.000000"
BLOOM_GAMMA = "2.000000"
BLOOM_GAMMA_OUT = "3.000000"
BLOOM_POWER = "2.000000"
BLOOM_EYE_ADPT_SRT = "0.000000"
BLOOM_EYE_INERTIA = "10.000000"
BLOOM_OVER_WHITE = "1.000000"
BLOOM_HALATION_MIX = "0.700000"
DO_CURVATURE = "1.000000"
DO_BEZEL = "1.000000"
BEZEL_FRAME_ZOOM = "0.183000"
BEZEL_REFL_STRENGTH = "2.000000"
BEZEL_CORNER_DARK = "0.700000"
BEZEL_RFL_BLR_SHD = "-0.540000"
BEZEL_ROUGHNESS = "1.500000"
BEZEL_DIFFUSION_STR = "1.000000"
DO_GLOBAL_SHZO = "1.000000"
GLOBAL_ZOOM = "1.000000"
DO_VIGNETTE = "1.000000"
V_SIZE = "1.200000"
V_SHAPE = "0.800000"
DO_SPOT = "1.000000"
S_POWER = "0.067000"
2 Likes

That’s really good! Thank you!

Yeah, they are very powerful, as I’m trying to emulate the actual devices, 1:1, and for Samurai Showdown/Arcade, trying to grab the feel of early 90s RGB Cabinet CRTs–which did make my head spin when I was standing up close to them, back in the day. They were intense!

So with Koko, do I then use the overlay function in Retroarch to add backdrops/TV Sets, or do I imbed them such as in MegaBezel, within the actual preset?

In MBZ we have multiple independent layers. I’ll have to read your documentation.