Based on article of Rim van Wersch: http://www.xnainfo.com/content.php?content=28
I found this adaptation to give good results with ENB adaptation method. I take little credit for this as it's basically a direct port but it works very well, so I thought I'd share because setting up proper adaptation is a major pain with setting up ENB code part.
GUI Elements
CONTROL Description
Adaptation: Min - controls how much to brighten the screen when average screen luminance is low. 0.0 brightens to max
Adaptation: Max - controls how much to darken the screen when average screen luminance is high. 100.0 darkens to max
Adaptation Min should be lower than Max, obviously.
Middle Grey - controls if the image is high or low key
Max Luminosity - controls blowing out highlights due to HDR. Lowering this will allow more pixels to blow out when intensity is too high
Code: Select all
bool Section_Adapt <
string UIName = "------Eye Adaptation--------";
> = {false};
float minAdaptE <
string UIName="Exterior Adaptation: Min";
string UIWidget="Spinner";
float UIMin=0.0;
float UIMax=10.0;
float UIStep=0.001;
> = {0.025};
float maxAdaptE <
string UIName="Exterior Adaptation: Max";
string UIWidget="Spinner";
float UIMin=0.0;
float UIMax=10.0;
float UIStep=0.001;
> = {0.11};
float minAdaptI <
string UIName="Interior Adaptation: Min";
string UIWidget="Spinner";
float UIMin=0.0;
float UIMax=10.0;
float UIStep=0.001;
> = {0.025};
float maxAdaptI <
string UIName="Interior Adaptation: Max";
string UIWidget="Spinner";
float UIMin=0.0;
float UIMax=10.0;
float UIStep=0.001;
> = {0.11};
float middleGrayE <
string UIName="Exterior Adaptation: Middle Grey";
string UIWidget="Spinner";
float UIMin=0.0;
float UIMax=2.0;
float UIStep=0.001;
> = {0.6};
float middleGrayI <
string UIName="Interior Adaptation: Middle Grey";
string UIWidget="Spinner";
float UIMin=0.0;
float UIMax=2.0;
float UIStep=0.001;
> = {0.6};
float maxLumaE <
string UIName="Max Exterior Luminosity";
string UIWidget="Spinner";
float UIMin=0.0;
float UIMax=16.0;
float UIStep=0.001;
> = {16.0};
float maxLumaI <
string UIName="Max Interior Luminosity";
string UIWidget="Spinner";
float UIMin=0.0;
float UIMax=16.0;
float UIStep=0.001;
> = {16.0};
Simply returns weighted average of luminosity coefficient for HD monitors.
Code: Select all
float grayValue(float3 gv)
{
return dot( gv, float3(0.2125, 0.7154, 0.0721) );
}
Code: Select all
////////////////////////////////////
// Eye Adaptation //
////////////////////////////////////
//Based on work by Rim van Wersch, sorta
float minAdapt = lerp( minAdaptE, minAdaptI, EInteriorFactor );
float maxAdapt = lerp( maxAdaptE, maxAdaptI, EInteriorFactor );
float middleGray = lerp( middleGrayE, middleGrayI, EInteriorFactor );
float maxLuma = lerp( maxLumaE, maxLumaI, EInteriorFactor );
float EyeAdapt = grayValue( tex2D( _s4, 0.5 ).xyz );
float pixelLuma = grayValue( color.xyz );
EyeAdapt = clamp( EyeAdapt, minAdapt, maxAdapt );
float scaledLuma = ( pixelLuma * middleGray ) / EyeAdapt;
float compLuma = ( scaledLuma * ( 1.0f + ( scaledLuma / ( maxLuma * maxLuma )))) / ( 1.0f + scaledLuma );
color.xyz *= compLuma;
Adaptation time should be set to whatever time you prefer (low or high)
Adaptation sensitivity is up to you, but should be somewhat around middle (0.5). I prefer a value of 0.67 which seems to give quite reliable results.
Force min/max values should be set to TRUE
Cheers.