gamma-utils icon indicating copy to clipboard operation
gamma-utils copied to clipboard

[Suggestion] - Adaptative gamma

Open John-Development opened this issue 1 year ago • 5 comments

I love playing in 30% gamma, but for creating cool effects in caves is too dark so I rise it up to 150%. Just as the eye adapts naturally with time to catch more light in darker places and the opposite in brighter ones, it would be cool if there was a way to gradually change gamma depending on something like the average light in the player field of view, configurable between a max and a min values.

I dont really know how easy to implement this idea is (or if it is even possible) but I thought could be a cool addition to this mod!

John-Development avatar Jul 17 '24 15:07 John-Development

Hi, thank you for your suggestion. I like the idea, I'll see if I can implement something like that soon. It however probably has to use the light level of the block you're standing on, averaging all light within the field of view doesn't sound like a feasible solution.

Sjouwer avatar Aug 08 '24 20:08 Sjouwer

averaging all light within the field of view doesn't sound like a feasible solution.

Yeah, that could be thousands of blocks. Maybe you could make a configurable additional radius, 0 = only current block, positive = additional rings.

mk-pmb avatar Aug 14 '24 19:08 mk-pmb

What about some pixel average brightness?

Instead of ingame light positions you could use the raw rendered image and the current gamma to calculate every few ticks the new gamma value (is this even possible? 🤔)

Maybe thats even more complicated i dont know... 😅

John-Development avatar Aug 14 '24 19:08 John-Development

@John-Development Which pixels should it be based on? All on screen? That, again, would require a huge amount of calculations, which I assume is exactly what we're trying to avoid. (Because that would be bad for performance.)

mk-pmb avatar Aug 14 '24 21:08 mk-pmb

I guess a sphere centered in the screen should be enough, but could also be one every N pixels for all the screen. Is not the perfect solution, and could still be a bit hard on resources, but that could be a decent aproximation... 🤔

Still, dount these every few seconds instead of every tick should be enough not to overload the cpu with calculations... And could also be dependant on the previous calculations to even make it faster, witch actually would lead to what happens to the human eye, that it needs a bit of time to fully adapt to the environment

John-Development avatar Aug 14 '24 21:08 John-Development

Using the rendered image wouldn't work. Doing that could cause the gamma to change dependend on if you're looking at a build made out of deepslate vs quartz, regardless of the light level. Which wouldn't make much sense.

I'll just start with taking the light level of the block you're standing on and will look at how feasible it is to grab an avarage light level of more blocks around you.

Sjouwer avatar Aug 19 '24 23:08 Sjouwer

It's been added to the latest release, see: https://modrinth.com/mod/gamma-utils/version/2.1.0

Sjouwer avatar Aug 24 '24 14:08 Sjouwer

Loving this new feature, but would it be possible to have sky light play into the dynamic brightness change as well as block light? I like having 500 gamma in caves where both block and sky light is 0, but on the surface at night where block light is 0 and sky light is 15, I prefer around 250.

blockerlocker avatar Sep 23 '24 14:09 blockerlocker

Loving this new feature, but would it be possible to have sky light play into the dynamic brightness change as well as block light? I like having 500 gamma in caves where both block and sky light is 0, but on the surface at night where block light is 0 and sky light is 15, I prefer around 250.

Thank you for the suggestion, though next time please make sure to create a new issue. That way it's easier for me to keep track of it. Coincidentally someone already made one recently that's related to your suggestion. I'll add a solution to the mod soon, see this issue for more info: https://github.com/Sjouwer/gamma-utils/issues/46

Sjouwer avatar Oct 22 '24 21:10 Sjouwer