Welcome, Guest.
Username: Password: Remember me

TOPIC: Eye Adaption

Eye Adaption 1 year 2 months ago #1

Description:
This shader lightens or darkens the image depending on the average screen brightness, thus mimicking exposure adaption from cameras/eyes (hence the name).

Example Video

This shader is part of the offical reshade shaders repository.
For the latest updates visit my repository github.com/brussell1/Shaders

Changelog:
Warning: Spoiler! [ Click to expand ]
Last Edit: 2 weeks 20 hours ago by brussell.
The administrator has disabled public write access.
The following user(s) said Thank You: Marty McFly, Insomnia, Martigen, DeMondo, luluco250, Qsimil, andrew, MakeNX, Ryukou36, GP-Unity and this user have 7 others thankyou

brussells humble shaders: Adaption 1 year 1 month ago #2

Interesting. To simulate adaptation before tonemapping (instead of untonemapping and retonemapping, try to protect white tones by reducing the darkening for those pixels. That'll retain most of the image fidelity.
The administrator has disabled public write access.
The following user(s) said Thank You: brussell

brussells humble shaders: Adaption 1 year 1 month ago #3

wow thats somthing..perfect
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 1 month ago #4

Changelog 30.01.2018:
-added parameters for black and white protection
-fixed dynamic adaption calculations
-adaption speed now (almost) fps independent
-some code optimisations
The administrator has disabled public write access.
The following user(s) said Thank You: Qsimil

brussells humble shaders: Adaption 1 year 1 month ago #5

I have to say I really, really like this shader. :) Thanks for sharing!
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 1 month ago #6

Changelog 08.02.2018:
-simplified adaption calculation
-added saturation parameters
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 1 month ago #7

brussell wrote:
Changelog 08.02.2018:
-simplified adaption calculation
-added saturation parameters
Thank you brussel. Just one suggestion: please stop adding a default key and setting it enabled, this screws up profiles, and perhaps call it something more informative :) So for eg:
technique LightAdaptionRussel

Thanks :)
Last Edit: 1 year 1 month ago by Martigen.
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 1 month ago #8

Thanks a lot. It's a really useful shader. One question, any chances for version with UI ?
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 1 month ago #9

Rudy102 wrote:
Thanks a lot. It's a really useful shader. One question, any chances for version with UI ?
Yes. Soon. :)

btw:
Changelog 14.02.2018:
-simpler, more efficient code, less parameters
-better saturation calculation
-toggable brightening and darkening
The administrator has disabled public write access.
The following user(s) said Thank You: Rudy102

brussells humble shaders: Adaption 1 year 1 month ago #10

What a nice update, thank you kindly :)
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 3 weeks ago #11

I've added the GUI-version to the initial post. I will also try to add it to the official shader repository soon.
Last Edit: 1 year 3 weeks ago by brussell.
The administrator has disabled public write access.
The following user(s) said Thank You: GP-Unity

brussells humble shaders: Adaption 1 year 3 weeks ago #12

one quick thing:

your luma averaging function isn't actually giving you an average - it is merely reporting the last luma value that the shader happens to sample. every time you reload the shader, it will give you a different luma value, even if the scene does not change in any way.
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 3 weeks ago #13

Nope. It's correct. It works by using ReShade's mipmap generation to do the averaging and then simply samples the result from the lowest mipmap.
Cheers, crosire =)
The administrator has disabled public write access.
The following user(s) said Thank You: brussell

brussells humble shaders: Adaption 1 year 3 weeks ago #14

if that's the case, shouldn't the calculated luma value be the same every time you hit reload? with my test scene (which is a completely static scene), this luma value fluctuates every time i reload.
Last Edit: 1 year 3 weeks ago by moriz1.
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 3 weeks ago #15

I can't reproduce this behavior. And even if the first frame after a reload somehow has a luma of 0 or 1, it should settle after a few seconds (depending on AdaptionSpeed).
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 3 weeks ago #16

my mistake. apparently i didn't set the mipmap level correctly (i was trying out the sampling algorithm in a different shader), so it must be sampling that isn't actually a 1x1 texture.

i did however, notice that the luma value changes if i alt-tab in and out of the game window. doing this will cause the calculated luma to rise by about 0.05 in my test scene. not sure what that was about.

btw, this is the code i'm using to display the luma on screen:
float res = -0.1;

int line0[14] = { __L, __u, __m, __a, __Space, __C, __u, __r, __r, __e, __n, __t, __Colon, __Space };	//Luma Current: %d

DrawText_String(float2(100.0, 132.0), 32, 1, texcoord, line0, 14, res);
DrawText_Digit(DrawText_Shift(float2(100.0, 132.0), int2(14, 0), 32, 1), 32, 1, texcoord, 3, avglum, res);
if ( res != -0.1)
	return res;

you need to include "DrawText.fxh" for this to work. this code snippet will print "Luma Current: ####" on the top left corner of the screen.

EDIT: is it a good idea to use gamma correction? i've been using:
float CalcLuma(float3 color) {
	if (GammaCorrectionEnable) {
    	return pow((color.r*2 + color.b + color.g*3) / 6, 1/2.2);
	}
	
	return (color.r*2 + color.b + color.g*3) / 6;
}
Last Edit: 1 year 3 weeks ago by moriz1.
The administrator has disabled public write access.

brussells humble shaders: Adaption 1 year 3 weeks ago #17

moriz1 wrote:
i did however, notice that the luma value changes if i alt-tab in and out of the game window. doing this will cause the calculated luma to rise by about 0.05 in my test scene. not sure what that was about.

btw, this is the code i'm using to display the luma on screen:
float res = -0.1;

int line0[14] = { __L, __u, __m, __a, __Space, __C, __u, __r, __r, __e, __n, __t, __Colon, __Space };	//Luma Current: %d

DrawText_String(float2(100.0, 132.0), 32, 1, texcoord, line0, 14, res);
DrawText_Digit(DrawText_Shift(float2(100.0, 132.0), int2(14, 0), 32, 1), 32, 1, texcoord, 3, avglum, res);
if ( res != -0.1)
	return res;

you need to include "DrawText.fxh" for this to work. this code snippet will print "Luma Current: ####" on the top left corner of the screen.

There seems to be a bug(?) in the DrawTextDigit function. Even if you choose a fixed value like this
DrawText_Digit(DrawText_Shift(float2(100.0, 132.0), int2(14, 0), 32, 1), 32, 1, texcoord, 3, 1, res);
,something like 1.09 gets displayed.

EDIT: is it a good idea to use gamma correction? i've been using:
float CalcLuma(float3 color) {
	if (GammaCorrectionEnable) {
    	return pow((color.r*2 + color.b + color.g*3) / 6, 1/2.2);
	}
	
	return (color.r*2 + color.b + color.g*3) / 6;
}

No, not necessary.
Last Edit: 1 year 3 weeks ago by brussell.
The administrator has disabled public write access.

Eye Adaption 9 months 3 weeks ago #18

can this effect combined with vignette ? so if you face bright light you simulate human eyes that half closed to reduce light.
The administrator has disabled public write access.

Eye Adaption 9 months 3 weeks ago #19

PureEvilWindom wrote:
can this effect combined with vignette ? so if you face bright light you simulate human eyes that half closed to reduce light.

Sure. How about that: i.imgur.com/fJsqNji.gifv
I've also tried to mimic some glare-through-eye lids-effect recently: i.imgur.com/ROF4BEW.gifv
If there's more resonance I will add it.
The administrator has disabled public write access.
The following user(s) said Thank You: PureEvilWindom, Meddy

Eye Adaption 9 months 3 weeks ago #20

OMG, it is vey nice =)

post this fast
The administrator has disabled public write access.
  • Page:
  • 1
  • 2