Koko-aio shader discussions and updates

Just pushed a bunch of changes/fixes, including the new scanline function.

If you want to test, this is the new parameter, inflation strength, under scanline section:

Screenshot_20240510_154614

It has been set to 0.5 for all of the presets, but the handhelds ones, so every preset should look a bit better now.

0.5 is a bit conservative, you may want to try higher values, by keeping in mind that going over 1.0 is only adviced when you set “Phosphors height MAX” to a low value; very particular cases i’ve yet to experiment with.

8 Likes

I cried, so beautiful

1 Like

Works great - well done.

4 Likes

Still tweaking…or should I say playing…

2 Likes

By combining scanline inflation with a lower glow light sharpness, the picture rounds more and seems to mantain an acceptable sharpness:

Params
DO_CCORRECTION = "1.000000"
IN_GLOW_POWER = "1.600000"
TEMPERATURE = "7200.000000"
IN_GLOW_GAMMA = "2.000000"
GAMMA_OUT = "0.500000"
DO_SHIFT_RGB = "1.000000"
OFFSET_STRENGTH = "0.250000"
SHIFT_R = "-20.000000"
SHIFT_G = "1.000000"
SHIFT_B = "20.000000"
DO_IN_GLOW = "1.000000"
IN_GLOW_BIAS = "0.000000"
IN_GLOW_SPREAD = "1.999999"
IN_GLOW_SPREAD_SHARPNESS = "1.149999"
IN_GLOW_W = "1.999999"
IN_GLOW_H = "2.999998"
RESSWITCH_GLITCH_SIZE = "0.000000"
DO_PIXELGRID = "1.000000"
PIXELGRID_MIN_H = "0.300000"
PIXELGRID_MAX_H = "0.700000"
PIXELGRID_INFLATION = "1.500000"
PIXELGRID_GAMMA_H = "5.199998"
PIXELGRID_DECON_R_H = "-0.600000"
PIXELGRID_DECON_B_H = "0.600000"
PIXELGRID_H_PRST = "5.000000"
PIXELGRID_MAX_W = "0.400000"
PIXELGRID_GAMMA_W = "1.500000"
PIXELGRID_BASAL_GRID = "0.020000"
PIXELGRID_Y_MASK = "0.300000"
PIXELGRID_Y_MASK_HEIGHT = "-2.000000"
PIXELGRID_Y_MASK_STEEP = "4.000000"
DO_HALO = "1.000000"
HALO_NO_PREGAIN = "1.000000"
HALO_POWER = "0.600000"
HALO_SHARPNESS = "7.000000"
HALO_GAMMA = "1.000000"
HALO_GAMMA_OUT = "1.300000"
HALO_VS_SCAN = "1.000000"
DO_BLOOM = "1.000000"
BLOOM_MIX = "0.300001"
BLOOM_GAMMA = "3.000000"
BLOOM_GAMMA_OUT = "2.200000"
BLOOM_POWER = "3.899997"
BLOOM_EYE_ADPT_SRT = "0.600000"
BLOOM_EYE_INERTIA = "10.000000"
BLOOM_OVER_WHITE = "0.000000"
DO_CURVATURE = "1.000000"
GEOM_CORNER_SMOOTH = "150.000000"
DO_BEZEL = "1.000000"
BEZEL_INNER_ZOOM = "-0.011000"
BEZEL_FRAME_ZOOM = "0.170000"
DO_VIGNETTE = "1.000000"
V_SIZE = "1.080000"
DO_SPOT = "1.000000"
S_POWER = "0.060000"
DO_DYNZOOM = "0.000000"
7 Likes

NG-1.9.20 Is up on Github and should be available via online update soon.

NEWS:

  • Allow to set glow light sharpness.
  • Allow to modulate reflected and diffused light fadeout.
  • New Monitor-Screen_Hmask-Screen_SlotMask-Chameleon preset.
  • New Monitor-Screen_Hmask-Screen_SlotMask_Taller_Brighter preset.
  • Real-time autocrop.
  • Add Gameboy Color Presets.
  • Scanlines inflation (rounder image)

FIXES:

  • Tate: Fake scanline size compuration was using the wrong dimension.
  • Little border between the bezel and the content will be visible even when using geometry overrides or luminosity tied zoom.
  • Keep ambient leds in place when using bezel and geometry override zoom.
  • Adapt ambientlight sampling point to geometry override zoom/aspect.
  • Fixed Deltarender (not sure when it broke).

CHANGES:

  • Better bezel reflections.
  • Tuned ambientlight stretching for vertical games.
  • Auto fake integer scanlines will kick in with lower screen resolutions.

MISC:

  • Code cleanup.
  • Several performance improvements, we’re almost back to 4.1 levels.
  • Several presets updates.
16 Likes

Fantastic work - thank you so much!

7 Likes

Yep, looking good.

5 Likes

So many shaders, so little time…

Greetings @kokoko3k, I’m not sure if this has been asked already but seeing that this is such an efficient shader when it comes to quality/performance cost, is it possible to further push the efficiency envelope by doing away with the Bezel and ambient lighting if a user wanted to do so?

2 Likes

I’m not that awake rn, but have you looked through the documentation, iirc there’s something about commenting out parameters to hardcode the values for a performance boost (I’m unsure how relavent it is to this tho, I do understand this is different from outright removing the code completely, but speed boost is speed boost)

2 Likes

It would surely go up, but not that much.

By pure gut feeling, it would go from about 100fps on my haswell at 1080p and 240p content to 110-120.

This is because I’ve put to about 100fps the target speed and a certain set of features while developing, so the shader has the maximum performance/cost with those features enabled.

If you disable everything, it will not fly, but will reveal a quite high basal consumption.

To simplify, setting the params to statics will lower it because the shader have not to check for every single pixel if it has or not to do that or the other feature, but the basal cost due to the multiple passes (which in turn are good when they work in sinergy to provide all the features) will stay still.

However It is possible to reuse the existing code to create a new shader without all the bells and whistles (just mask,glow,bloom) and there it would be much faster.

Can I ask you why you’re asking?

3 Likes

Just wondering how fast it can go because not everyone needs the Bezel, reflections and lighting effects.

The faster it can go, the lower the performance requirements and the wider the range of hardware it can run on.

2 Likes

Wondering if anyone has realistic FPS targets for content greater then 240p on Haswell? I’m running an i5-4200m in Windows, so using GLCore, at 1080p. I’ve been testing against Championship Sprint, which is 512x384 @60.09Hz, using the Mame core. I’m having a hard time maintaining 60FPS using the Monitor-Balanced preset and also taking advantage of config-user.txt. Seemed like using config-user.txt only gave me a few FPS boost.

Considering that final fight (384x224) reaches about 100fps with that preset here (i5-4590), yeah, it seems we are 20% under for championship sprint, at least on paper. Roughly.

However I think i tried to play hires games that don’t use hardware renderers (so mame) and they were ok; I’ll tryn) asap.

Btw, you’ve several options you can mix and I’ve read tou already tried config-user.txt, but still:

  1. config-user.txt turn parameters static, used fully, gave me 25% boost, it should suffice, but not that handy.

  2. again, config.txt, have you already used:
    #define HALVE_BORDER_UPDATE 1.0
    #define SKIP_RANDOM 1.0

  3. still config.txt:
    #define DELTA_RENDER 1.0
    then tune the relative parameters: (I use the following on my s10 to save battery, limit throttling and gain fps):
    #define DELTA_RENDER_FORCE_REFRESH 7.0 #define DELTA_RENDER_CHECK_AREA 3.0

Delta render works very well for static content like Championship Sprint.

  1. This would easilly double ypur fps allowing me to play Flycast 640x480 (which taxes the gpu by its own (being hardware redndered) at 1080p with shader on:
    In shader menu, turn the pass named flick_and_noise from 2x to 1x scaling and apply the changes.

After that some effects will cease to work like fxaa, other will behave different (glow blur pass may need sharpness adjust), but that is not that important for hires content.

This is what Batpcera uses for hires content. maybe I should release some 1x presets.

I’ll update this post as soon as I’ll test CS on my intel rig.

EDIT- Just checked, and without any mod on my side, I can reach 70+ fps without any special setting.
Don’t pay attention to the scanline size, it is so because the shader is interlacing it:

This is on Archlinux with GLCore, with an Intel® Core™ i5-4590 CPU @ 3.30GHz

3 Likes

Hmm, thank you for the ideas and for testing! I am pretty new to going any deeper with shaders than switching presets, so will try your ideas out. I’ve got another machine running Batocera on an i5-4670s, and I see the same low FPS there. I’m using Vulkan on the Batocera machine, though, and was trying the various Duimon presets it includes. I see the FPS drop for other games with the same res like Super Sprint and APB. I don’t know what the right term is, but the screen shakes and hops on those games, too. Arch Rivals is another game that shakes and hops really bad, but it’s at a different res and runs at 30hz. Seems likes maybe there are some RA settings I need to tweak rather than tweaking the shader settings.

Your cpu seems slightly faster than mine.

It has to be something specific with your system (to start with, i never tried running koko-aio on windows on my Haswell).

But the fact that you are testing Batocera too, which is Linux, puts the blame to something different than the operating system.
Batocera uses Vulkan (which is not well supported on Haswell and for me it gives lower performances), so I’d try to switch to GLCore there (remember to restart retroarch after the change).

As per the “shake”, if you mean continuous line flickering up and down, then it is because the shader is emulating the interlacing seen in old CRTs.

The effect does not appear to be good when the core refresh is just 30fps, and maybe you would not like it on 60fps games (supersprint).

You can turn it off; set flicker power to 0.0.

Optionally, you can set Hi-res scanlines type to 2.0 to clear the rest of the flickering.

You could seek help with Batocera on Discord; there is a thread specific to koko-aio, User Duglim adapted some “tweaked for speed” shader-sets based on koko-aio.

1 Like

Thanks again, I will start trying some of this stuff out later today. All of my issues seem to be tied to any game with a res higher than about 240p or so. It’s those higher res games that have the really annoying super flicker in addition to poor FPS while the 240p and under games look fine.

1 Like

Starting from yesterday, the development repo (and next official release) requires Retroarch to be at least at version 1.16, because koko-aio is using some features not available before.

Older retroarch versions will simply refuse to load the shader.

1 Like

To overcome slowness when applying the shader to hires content like flycast core that outputs at 640x480, I made a copy of the presets that works with halved internal resolution.
(unfortunately retroarch won’t allow to do that runtime, hence the need of duping)

For my simpler managment, the new directory structure will be:

koko-aio
       L Presets_Handhelds-ng
                            L [..]
       L Presets-4.1
                   L [..]*1
       L Presets-ng
                   L [..]*2
       L Presets_Halfres
                       L Presets-4.1
                                   L [..]*1
                       L Presets-ng
                                   L [..]*2

So, Presets_Halfres is the new folder and will contain Presets-4.1 and Presets-ng which, in turn will contain exactly the same presets found in the other Presets-4.1 and Presets-ng folders.

This would allow to run Hires 60hz games at the same speed (IGPs) of lowres one and with the same quality.

I’m here for an advice for a descriptive name for the new folder.
I don’t think Presets_Halfres is enough to describe the intent of running hires games at the same gpu use/speed of low resolution one.

So, do you have any advice? i’m considering:

  • Presets_HiresCore_HalfResGPU
  • Presets_HiresCoresOptimized
  • Presets_OptimizedForHiresCores
  • Presets_HiResOptimized
  • Presets_HiRes_Perf
  • Presets_FastHiRes
  • Presets_HiResPerformance
  • Presets_HiResLowGPU
  • Presets_HiResSpeed
  • Presets_HiResAccel
  • Presets_HiresCores_Fast
  • Anything else!

Thanks :slight_smile:

2 Likes

I think this is the most accurately descriptive of the bunch.

2 Likes