Would it be possible to create an adaptive brightness shader?

The man himself is giving it some thought!

When @kokoko3k said that it would be too computationally intensive (which seems to be the ugly truth), I too thought about dividing the scene in segments larger than a pixel. Sort of what local dimming does on displays. And thinking about it more, if the system is associated with a crt filter, perhaps everything that will be blocked by a scanline could be “discarded” from the calculation, essentially halving the number of pixels whose values need to be taken into account. Well maybe not halving, but reducing it at least by a fair amount :thinking:

I like strange!

1 Like

I completely agree. The solution already exists. Not everything needs to magically set itself up for every usage scenario. For those who are either too inexperienced or too lazy, there already exists CRT-Shader Preset packs which already provide all of this and more.

So what really is the problem or issue here?

1 Like

Read the thread if you want to understand what the goals are, I won’t repeat myself. And I don’t understand why some of you are so hostile towards this idea. It’s just a question born out of curiosity and a proposal for people who might be interested. If that’s not you, go ahead and ignore the thread, and save your uncalled for insults for whoever cares about them.

No it doesn’t, but for the fourth or whatever time, it’s not about satisfying “needs”, or solving “problems” or just automagically setting everything up. Read the posts.

It’s hard to judge an idea as realistic when it isn’t clear what the idea is in the first place. There isn’t enough technical information to define a shader to do what you want because you haven’t articulated what it is you want in a way that’s clear enough for us. We are essentially guessing for you. I have some ideas about what you might want and have commented about that. I will continue to weigh in on the technical details as needed, but I can’t come up with the subjective criteria that will satisfy what’s in your head. That is why I call it a dream and not a hypothetical shader.

The mechanism you described in your OP will not give you the result you want. Please don’t ask me ‘how do you know?’ because I know from my experience. While I don’t know what exactly it is that you want, I do have a good enough feel to know that that method will not work for you and I gave an example of a method that may help you do what you want to do. However, there are some complications beyond just making the histogram and redistributing it, some of which I asked about. Your response was ‘you tell me’. That’s not helpful. If someone makes assumptions about what you mean and develops and a shader for you and you’re not happy with it, how is that going to make you feel?

I have volunteered myself many times to make things for people only to have them say ‘Oh, this isn’t really what I wanted …’ because they didn’t clarify what they wanted in a clear enough way. I am trying to prevent that from happening. It’s not aggression. It’s qualification.

You’re the one using language like ‘mess’, ‘best experience’, ‘better’, etc. and then posting before and after screenshots with no context about what you did to achieve them and saying one is better than the other, etc. Of course I’m going to push back on that kind of language for a technical development. You yourself said there is no problem to solve here, so don’t present these things as problems in the first place. Either there is a problem and you need to articulate why it’s a problem, or you need to keep your subjective qualifiers to yourself.

To do it without losing temporal resolution would require mipmaps I believe. But if were to divide the screen into N subframes and process the total in N frames, we would limited to updating the average brightness F / N where F is the framerate. So for 60 FPS, if we divide the input into 8 zones, we would have a lag of 7.5 frames. That’s a delay of roughly 100 ms. This isn’t precise enough for fast content.

I think you would need to have an adaptive method that holds the current equalization when the derivative of the average is large. That would allow for fast content to maintain a equalization. However, that wouldn’t solve the problem of a dark tunnel in a racing game where the rest of the stage, (actually the starting grid, since that will be the only portion), will have more brightness.

With mipmaps this becomes a lot easier because we can employ an adaptive temporality to perform a fast equalization in fast frames.

1 Like

@anikom15 Your post is half interesting and productive and half ego-driven and vitriolic. I will respectfully pay no heed to the latter half because again I don’t see why we should be arguing in those terms.

Instead, I’m going to try and explain again what I’m asking about, and try to be as specific and accurate as I possibly can. I hope you will understand that I’m not a programmer or a 3D artist, that I’m not an english native speaker and that for these reasons my language may not be as precise and technically sound as is required. And this is also for you, @Cyber

I would like to know whether or not it would be possible to develop an image altering filter, commonly known as ‘shaders’, which brings the desirable effects that HDRR bestows on modern videogames to the realm of older ones, such as the content that can be emulated within the framework of the frontend RetroArch. And if it is indeed possible, whether or not any of the brilliant developers present in this community would be interested in writing it.

This shader would provide users with expanded headroom to increase the perceived brightness and particularly contrast of the scenes that these older games present to them, by mapping and then processing the signals used to construct said scenes, dynamically and in real time.

The proposed method is the following: as contrast is augmented by way of the addition of other image enhancement shaders, such as CRT-display simulators, the luminance values of the pixels that make up the darker regions of the image may be increased, in the circumstance that they fall under a specified threshold, so as to preserve details in these regions. Similarly, and with the same detail preservation goal in mind, the luminance values of the pixels that make up the brightest areas of the scene may be decreased should they rise higher than the threshold specified for highlights. The areas around the middle of the histogram are not affected to the same extent but can still benefit from brightness increments while staying relatively faithful to the artistic intention of the creators and the characteristics of the displays used at the time.

This systems, if implemented correctly, could result in an overall brighter, more vivid, and more saturated image, devoid of detail loss on both extremes of its histogram.

Therefore, the use of this technology would help users maximize the potential capabilities of their displays, and ameliorate the reduction of brightness traditionally associated with the CRT simulations mentioned earlier.

An added beneficial side effect would be the creation of shader chains that could be applied to a wide variety of content, avoiding the need to configure and manage large numbers of game-specific presets, which can be a laborious and time-consuming process, since the standards for brightness and colour were not as clearly defined and normalized at the time of the creation of that content as they are today.

The presentation of games that were released with abnormal gamma and brightness characteristics, either globally or in specific levels or areas, could also be greatly improved in a convenient, automated manner.

As this technology progresses and people gain acces to it, it has the potential to be employed in other creative and interesting ways down the line, such as on the fly colour calibration.

I have written it with a lot of actual care, and a pinch of good-wiIled irony too :wink:

In any case I hope my idea/plan/proposal/request or however you want to call it is more clear now. And let’s bury that silly hatchet, man. I’m not your enemy. I was away for a long time, but like always I’m here to help and learn and enjoy conversing and discussing, not to take advantage of anyone’s time and skills for personal gain, or ego-argue over menial things. I’m 45 years old, and well past that point.

This type of language isn’t becoming of any constructive discussion. Have you seen or tried CyberLab Death To Pixels Shader Preset Packs?

They include all that you’re talking about aready hand crafted by myself. So a user who wants Arcade presets for dark arcade games can select a preset for that. If they’re paying brighter arcade games, they can select a preset for that.

Don’t have to be so thin skinned because I used the term “lazy”. It is not meant as an insult and I’m not being hostile or against any idea. Do think through what you’re asking for and contemplate different ways in which it can be done using the existing framework before anything else needs to be developed.

All I did in my comment was agree with @Guest.r in that this can already be handled by Game Specific Presets.

What you’ve described is akin to a video compressor/expander i.e. decreasing high, bright signals and increasing low, dark signals.

Just as with audio compression. There are undesirable artifacts. A similar thing might happen with a real-time video compression shader.

So the question is? Is this even necessary at this time? I’m not against it, that’s just one of the thoughts that came to mind probably because colour correction and thus balancing brightness, gamma and shadow detail is an integral part of creating a preset in the first place so if I’m creating a preset it shouldn’t need anything like you described because I would have done that and taken all of that into consideration already.

So you might have to ask yourself who is your audience? Depending on the answer to that, you might get different types of responses to your initial question.

1 Like

Have you seen screenshots of my presets? They look nothing like they look in person. So what is the point? If the particular game is too dark for you or lacks contrast for you that is a phenomenon that you’re experiencing in your setup.

Read any display review worth it’s salt and you’ll see that different displays perform differently when it comes to contrast, black levels, shadow detail, highlight detail, tonemapping e.t.c.

How could one program something that would be suitable for all display situations?

It’s like with Sony Megatron Colour Video Monitor and HDR in RetroArch in general, I could have the best preset for me in person but anyone else who is using that preset has to configure it to suit the capabilities of their own display and setup. So it’s not going to look the same to them.

1 Like

I’m attempting to mock up what you mean. I need to test my new bezel anyway. I decided to add a mask as well. I know the mask geometry isn’t right. Sorry about that.

Original

I split the histogram into three regions: shadows, midtones, and highlights. I did this by estimating where most of the information is and defining that as the midtone area. I reduced the luminance of the highlights and increased the luminance of the dark areas.

After that, I attempt to equalize the new histogram.

2 Likes

Yes and yes, although I have not yet submerged myself deeply into them because I haven’t yet connected my new computer to the only screen that I have that can display them properly, a C1 OLED. But I will, and I’m pretty sure I will be astonished. And I think you did an incredible job! However, it’s static, and what I’m asking about here is a dynamic solution that could very well synergize with your popular and extremely cool creations. Worst case scenario, peacefully coexist with them.

I have and not only in the context of RA. Otherwise we wouldn’t be talking about it. I’m not a child, I would not request a silly thing just for the sake of what. Getting attention? I just haven’t been able to find anything that does what I’m proposing here. Not outside the realm of game engines. Not dynamically and in real time.

As I did right before you wrote your answer. But that comment was related to a relatively digressive discussion with anikom on whether or not game settings should be configured individually, not the OP topic itself, towards which guest has shown an encouraging amount of interest, by the way.

How many times am I going to have to answer to this? I hope this can be the last one. I don’t know if it’s necessary at present, or will ever be in the future. That’s for you devs, the people in charge of the project and the community as a whole to decide. I’m just asking about and proposing an idea I have had, for God’s sake. If it’s impossible or nobody else wants it, so be it. But maybe it isn’t. And maybe someone else finds it cool too. Whatever the case, I don’t think there’s anything wrong about putting it out :frowning:

And I’m not thin-skinned, that’s the third time you insult me. Do you really need to keep doing that? What’s the point of this ad-hominem crap? I just don’t see the need to call me ignorant and lazy for pitching an idea that I believe has potential and makes sense but which I don’t have the technical ability to develop on my own.

Well the third one is certainly the punchiest of the bunch, and to my eyes there’s no perceivable loss of detail, so yeah, I guess the method in principle is sound :slight_smile:

1 Like

There is loss of detail in both the low and high end. The most obvious area is in the smaller yellow dots near the title. And keep in mind this is tuned by hand. I can see exactly where the histogram rolls off to set the points. In a shader you wouldn’t have that benefit.

1 Like

My question was a rhetorical question. I was just trying to illustrate why you might have received the type of response you got so I was demonstrating my thought process. When you take one sentence out of context then quote it, you misrepresent the entire point.

I haven’t insulted you in any way. It seems as if it’s difficult to communicate with you because one has to walk on eggshells. It is you who are projecting and implying things which were neither said nor felt. All this does is create an air when people don’t feel free to disagree, discuss or debate because you seem to think that because someone has a different opinion or questions something, then it means they are against you or your opinion.

So there was no personal attack in my statement. It was very general but there is a saying that if something falls in your garden…

So what I would now say is don’t take things soo personally, lighten up a bit and be a bit more tolerant. It means the same as don’t be so thin skinned but hopefully you’ll try to understand without feeling upset and taking it the wrong way.

Now onto the topic at hand.

Whatever you did, it looks nice.

Alas concerning the loss of detail but do you think something like this can be made in a shader in an efficient and useful way?

Without the benefit of hand tuning and a histogram graph for feedback, maybe if you had a range that was relatively conservative at least users could adjust using WYSIWYG to easily add a little vibrance or “normalize colours”.

1 Like

I’m not the one who needs to lighten up. You come in all guns blazing implying the idea is irrelevant and that I’m lazy and inexperienced for pitching it and when I call that out as unnecessary and unproductive you try to turn it around by stating that I’m thin-skinned and intolerant… it doesn’t offend me man, very few things do. I’m just saying there’s no need for that :slight_smile:

With that hopefully out of the way. Let’s talk about more useful things shall we?

We could begin with something simple, in line with @anikom15 's latest post. I suggest a little shader that could be named Contrast Expander, Luminance Compressor, Gamma Equalizer (I vote for this one), or something of the sort. It would actually be useful by itself. It’s pretty basic, static, divides the histogram into 5 main regions and has the following parameters:

    • Black gain: threshold/clipping zone for darkest shadows.
    • White gain: threshold/clipping zone for brightest highlights.
    • Low frequency gain: deals with the left side of the histogram.
    • Mid frequency gain: deals with the central region of the histogram.
    • High frequency gain: deals with the right side of the histogram.
    • Contrast: could be cranked all the way up and nothing will ever clip, since thresholds are in place.

We could subdivide these regions and make a 10 band or whatever equalizer. 5 would be the bare minimum degree of granurality imo.

And once we have that foundation, then we can attack the issue of how to map the scene in real time and make it work dynamically, which is by far the more dfficult problem to solve, it seems.

Going back to the Wipeout2097 captures I posted earlier, this equalizer would allow us to lift those excessively black shadows, keep the midtones as they are in the raw image (or lift/darken them to taste), and prevent those bright elements in the HUD from clipping.

Makes sense?

1 Like

If you mean start coding that “multiband expander” (here’s another one used in sound processing), it sounds like buying an F1 Car without prior thinking where you could ever drive it!

Mapping the scene in real-time is a prerequisite as well, so better thinking if it could ever be done, and how. <=> Find a way to tell the shader that it is dealing with a particular wipeout scene or the likes, instead of something else.

Huh? I would drive that car in dark games such as Wipeout2097 and bright ones such as Street Fighter 2 Hyper Fighting, that should be pretty clear by now.

And I think it makes more sense to begin with the gamma equalizer because, again, it would be useful on its own and also because it’s much easier to build.

The car was just an analogy like “mettere il carro davanti ai buoi”.

I understand the analogy. Do you need more examples of games that would benefit from the equalizer? If so, how many?

Regarding the real time mapping feature, it would be awesome to gain access to how HDDR is implemented on modern game engines, and/or simulated on 6th generation consoles, so we don’t waste time and resources trying to reinvent the wheel :slight_smile:

Wiki’s article on tonemapping is a start. But for the time being, I suggest we focus on the equalizer.

If you are fine with a tool that you need to tune to your personal likings for every game that would benefit from it and someone is willing to code it, then yes, it’s totally ok!

But If you are still hoping for something that would automagically guess the right settings, then it’s a totally different story, and I’d go back to find the road to drive my F1 car, prior to buying it.

Please let me refer you to reply number 28. And the article linked within. The goals (or circuits in your F1 analogy) have been stated and explained very clearly already, there’s no need to do it again.

I did play with it a bit

with adaptive black 0.02 and brightness -0.02 (OFC with co=1)

yes, this seems how the game devs/artiest want us to see (they put that crt “crushed blacks” in their mind when they made old games)

I really want to use that in my preset, but koko-aio seems has tons of things I don’t need or that are duplicated in the guest shader, also koko-aio is kinda slow to load in the first time

it will be nice if that “feature” become a standalone shader

and since you got “crt breathing” in koko-aio (which I didnt know about and I thought the only one that did it was guest [as raster-bloom]), so the best will be if you make all-in-one shader for flyback adaptive voltage (or whatever) that do effects 03-05 from Crt effects list :slight_smile: