Koko-aio shader discussions and updates

If it’s too much on the code side then understandable.

But know that this is not an easy copy-paste job on the setup side, because if I want a specific backdrop image to look consistent across the many presets and packs available now or in the future, then I have to edit those entire packs. And since some packs are not my work (or any regular user’s) then I can’t fix the backdrop shift / zoom and forget it. The packs will get updated and whatnot. So I usually resort to making semi-custom versions of presets I modified, for example in Duimon’s pack there’s “Presets” and my “Presets_custom” etc…

With Arcade backdrops this is not a big issue, a few custom arcade specific fixes or presets is fine, but with something like a global reflection or diffuse or scratches, it sounds like a nightmare unless I make a compromise on the image file side so it looks neutral or good enough with any shift/zoom.

In my opinion, the backdrop did not need a dedicated shift zoom to begin with, since we can (and should) design the original backdrop image to fit a specific aspect ratio beforehand, like 4:3 for arcade games.

I used to play with those dedicated shift zoom params but I found it better to setup things in Photoshop before hand to keep them consistent across koko-aio and Mega Bezel too.

Btw, if someone is converting mame lay artworks to shader presets I have a Photoshop script that can assemble the lay for you like it would appear in mame. So you can easily know what goes where.

If I understood well, you asked for a flag to use some parameters values in place of others -> copying values from a parameter to another is what you’d need to do for each the preset, so something that translates:

PAR1 = VAL1
PAR2 = VAL2
PAR3 = VAL3

To

PAR1 = VAL1
PAR2 = VAL2
PAR3 = VAL3

PAR4 = VAL1
PAR5 = VAL2
PAR6 = VAL3

How many presets are we talking about?

While it still doesn’t look like a shader task, a python script would do the trick nicely; would be ok?

1 Like

Oky, before I start to dig into this, could you please check the very latest development version?

https://github.com/kokoko3k/koko-aio-slang/archive/refs/heads/main.zip

-edit-

I tried with the latest dev version and with the one shipped by the latest retroarch, but I couldn’t reproduce the issue.

Tried on Linux with: intel igp, nvidia 4060, vulkan, GLCore but never been able to reproduce.

What’s your gpu? What Retroarch video driver? Vulkan? GLCore? Please avoid D3D10,11,12.

No problem koko, I’m figuring this out right now and making workarounds. I also discovered that for the backdrop Y & X I need a mirrored value of the global Y & X.

For example if the global y = 0.5 Then the backdrop y must be set to = -0.5

Also, the backdrop does not tilt, it seems.

Oh, I forgot that rotated games will need a swap between x /y, instead of mirroring the global x/y. So we take the global x as it is, and give it to backdrop y, and vice versa.

That image is aimed to reflections or cabs with mirrored trick, so rotations, tilts won’t apply.

the documentation is indeed misleading, i’ll need to correct that.

1 Like

@Starman99x @kokoko3k This is the sort of thing I made presetgen for:

It lets you decouple parameters from shader chains and also split up chains into different ‘pipelines’. This makes updating presets much easier because I don’t have to copy and paste a value on like forty presets just because I want to change one thing around.

It is in need of some updates (like being able to override a parameter directly in an input file as a one-off) but it works well enough for me. If you have any questions you can feel free to ask in that thread.

3 Likes

I finally got it to work! I ended up using Retroarch standalone and updating from within there. Any manual attempts to update the shaders did not work.

For recordkeeping I’m on W11, AMD Ryzen 7 5700X3d, nvidia 4070, vulkan. For me, GLcore is completely unstable and flickering mess. Can’t even navigate the home retroarch menu with nothing loaded. The latest dev version you linked always showed a black screen, even if I reloaded the shader. I tried putting koko in its own folder in the slang shader directory separate from the bezel folder. I also tried using Retroarch standalone and manually copying and pasting the latest shaders. Only the online updater from standalone worked. One thing I noticed is the older working shader bundled with retroarch did not have red or green decay multiplier options under the persistence of phosphors. Not sure if that might be relevant. Anyways thank you for your time and effort.

1 Like

That’s problematic, because it will be released at one point and it works fine here.

I’ll need to try with a windows machine and nvidia.

The updated version from standalone has the rgb separate decay times btw, do you confirm?

The updated version from standalone has the rgb separate decay times btw, do you confirm?

Yep, confirmed. I even tried different values on them to check that I wasn’t going crazy or getting things mixed up. Indeed they worked, and no black screen when the scene changed.

I tried with the very latest dev version on a Win10 machine running the latest retroarch, ninja-gaiden and Mesen core, with Vulkan and GLCore output drivers on an nvidia-1660 and everything worked flawlessly, so I’m officially out of ideas.

It was definitely something on my end. I tried one last thing on the steam version, which was resetting retroarches configuration files to default. Viola, the lastest shaders worked. Some games still initialized with a blank screen, but after reloading, everything ran without a hitch for the rest of the time. Multiple scene and level changes with no problems.

What I can’t figure out is what setting caused this single shader option to crap the bed. I toggled vsync settings, run ahead, etc. One thing I noted is there might have been a descrepancy with my refresh rate. For some reason I remember retroarch reporting 59hz a few weeks back but now its at 60hz, but my memory is fuzzy. Maybe its something to do with steam and windows. I’m still new to retroarch so I can’t be certain to all the ins and outs.

I decided to stick to the standalone so there’s less fuss. Either way, thanks for your patience and help. The effort you put into these shaders really means a lot to this old and jaded gamer. A lot of us have been going through rough times, so being able to recreate and revisit these long lost feelings from a more innocent age has been very therapeutic and grounding.

2 Likes

I think it was hasty of me to open this issue on the frontend’s repo because upon more testing it seems to be specific to koko-aio.

If you follow the steps provided there to reproduce the bug, you’ll notice that it only affects presets that use the “Transparent_Logo” graphics as bg_under.

These used to work fine before. But now they’re all blacked out. Example presets to test:

Arcade_D1_Ambilight.slangp (Arcade_D1_Transparent_Logo.png).

I reproduced it, but just once in 10 minutes of trying.

Unfortunately I’ve no idea what could cause this, it is not even sure it depends on the shader, which may just trigger an underlying problem with Retroarch.

Under those conditions, it is really hard for me to debug, so if this issue is important enough ® for you, since you are able to reproduce it more than me, and it appears that it worked fine in the past, I ask you to try to bisect the issue and find the shader commit when it first started to happen.

I always make a commit for every single bit I change in the shader, so if you find the moment it broke (assuming the culprit is the shader), I will know what to change.

Bisection works like this:

  1. Find a commit ( good ) in the past where it worked.
  2. Find a recent commit ( bad ) where it doesnt.
  3. Test a commit ( test ) in the middle between the good and bad

  4. If it works => Repeat 1,2,3 but with good = test
    It it does not => Repeat 1,2,3 but with bad = test
  5. Stop repeating when there is no more to test.

At that point you can tell me the commit hash (that alphanumeric string near the <> symbol) that broke things.

Since it halves the commits to test in each step, usually it resolves pretty quicly, 10 tests at most, I’d say.

On github commit list is here

To download a commit snapshot from the past, click on the “<>” simbol to the right of the commit description as you see in the following shot:

…then hit green “<> code ∨”, and then “Download ZIP”

If you are comfortable with the command line, the process is far more quick than dealing with the github gui manually:

koko@thinkbook# git clone https://github.com/kokoko3k/slang-shaders

koko@thinkbook# git bisect start
status: waiting for both good and bad commits

koko@thinkbook# git bisect bad main
status: waiting for good commit(s), bad commit known

koko@thinkbook# git bisect good 64e9449
Bisecting: 130 revisions left to test after this (roughly 7 steps)
[2ad165e6bad70badbcdcbdd2d1ad84cb880126e2] Bloom limiter was using the wrong parameter

Test the shader, and tell git if the test has been good or bad, it will pick new commits for you to try each step, and in the end it will tell you where the problem lies, this is just an example:


[11:41:05]  cd ~/koko-aio-slang
koko@thinkbook# git bisect bad
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[99d1f7262d712cc8be58ad5e22201f3e5e70bdeb] Better explain what tate mode related parameter does.

[11:41:10]  cd ~/koko-aio-slang
koko@thinkbook# git bisect good
Bisecting: 1 revision left to test after this (roughly 1 step)
[97c01cb249fc4db9f58f9236b71540d6438a3570] Halation: Always apply to the whole image Dont modulate its strength on bright, since it doesn't look good under some circumstances (eg: big white text on black background)

[11:41:14]  cd ~/koko-aio-slang
koko@thinkbook# git bisect bad
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[9931ad5ee768048dfdd7f5145b2abf6fda60b8c1] Implemented halation effect

[11:41:17]  cd ~/koko-aio-slang
koko@thinkbook# git bisect bad
9931ad5ee768048dfdd7f5145b2abf6fda60b8c1 is the first bad commit
commit 9931ad5ee768048dfdd7f5145b2abf6fda60b8c1 (HEAD)
Author: Antonio Orefice <[email protected]>
Date:   Wed Sep 24 12:34:21 2025 +0200

    Implemented halation effect

 config/config-user-optional-template.txt |  1 +
 docs-ng.md                               | 16 +++++++++-------
 shaders-ng/bloom_pass_4.slang            | 32 +++++++++++++++++++++++++-------
 shaders-ng/config.globals.inc            |  4 ++++
 shaders-ng/config.inc                    | 16 +++++++++-------
 5 files changed, 48 insertions(+), 21 deletions(-)

1 Like

I tried to “sandwich” the bad commit, but that only led me to more problems, because even “good” commits either suffer from flickering or bad colorization of the bg image with varied degrees. The ambilight might also stop showing at all beneath the logo.

bad: 22c81fc2ae417315b62bf56179a6520e5aecdbd2
good: d12b37e28ed60738e39c70ef8c099f2d975faafd
bad: cc40629e1d6fbe005772aa482c5ae8120ce663ec
good: 20c5193c4262646a1b560e085575a7d235848cc5
good: 1c67c8531984c4e5e2640f1a5dd5545dc2d76fd4

I will try to dig into the image files themselves since this issue is specific to the transparent logo variants only.

1 Like

You said it worked fine in the past or am i missing something? Lets’ start from a good one and find the very first that gives problem please. If the code in the commit has something to do with it, i’ll fix it, hopefully; if not, then it is not the shader.

There you go:

Anything from 22c81fc2ae417315b62bf56179a6520e5aecdbd2 and below is good.

Anything from c429d046f2a5d90e097937a995b3b705bc5fadba and above is bad.

1 Like

Great work! Definitely related.

I think we are in the Retroarch bug field, rather than the shader, however if a workaround is free, why not.

A “logically not useful” previous frame check was indeed went away by that commit and now it’s back, could you check?

1 Like

Great! That fixed it (partially).

The only problem left is the flickering in dim scenes, which seems to be the textures blacking out between frames instead of continuously:

Pause, then press K (advance one frame):

Never faced that either.

How do you trigger ?

Is it a consequence of the very latest fix?

The exact same trigger as the previous bug. But this time it won’t be obvious until you reach a dim scene like in the screenshot. Then the screen starts flickering (textures going on/off).

Yes this happened after the latest fix. You could say the same bug was “evolved” in a way.