[Sammelthread] Skyrim - Mods und Technik

Das geht, allerdings würde ich FXAA vorziehen, da es ne bessere Quali hat ;) Nen DL für ne ordentliche Version (Ohne Blur, gute Kantenglättung) gibts in meiner Sig :)

in der ENB müsste das dann so aussehen:
EnableProxyLibrary=true
InitProxyFunctions=true
ProxyLibrary=d3d9_fxaa.dll

in der effect.txt müsste noch was für Skyrim geändert werden:

float SamplingRange=0.1; //sharpening or blurring range
float SharpeningAmount=0.1;
 
Zuletzt bearbeitet:
Wenn Du diese Anzeige nicht sehen willst, registriere Dich und/oder logge Dich ein.
Ich nutze aktuell gar keine ENB, das FXAA geht aber dennoch, oder?

Bzgl der Installation: Die ganzen Dateien kommen einfach ins Skyrim Haupverzeichnnis, wo sich auch die TESV.exe befindet und ansonsten muss man nichts einstellen, oder?

-

Ein ENB würde ich prinzipiell auch mal versuchen, allerdings kenne ich mich damit überhaupt nicht aus und ich hab das auch schon 1-2x getestet, nur irgendwie sieht das ganze bei mir nie so aus wie auf den Beispiel-screens. :fresse:
 
Zuletzt bearbeitet:
Die kommen in das Verzeichnis, genau :)

Das geht auch ohne ENB ;) Dann musst du nur die .dll in "d3d9.dll" umbenennen. Die effect.txt hat auch noch mal FXAA drin, das hilf auch noch. Nur die SChärfe muss wie gesagt noch angepasst werden, sonst siehts schlimm aus :fresse:
 
Ok, danke werde ich mal austesten.

Bzgl ENB eine Empfehlung, die mit dem "Climates Of Tamriel"-Mod harmoniert, bzw. generell gut aussieht?

*edit*

So, hab das mal so gemacht wie du gesagt hast. Aber ich weiß nicht. Finde, dass das teils immernoch ziemlich kantig aussieht.
 
Zuletzt bearbeitet:
ehm ... cot geht mit einer enb sehr gut ... ich überleg gerade ... paar seiten vorher haben ich VOR der opeth noch ne andere empfohlen ...

prOPAs ENB ist hammer mit climates of tamriel, aber saugt derb an der gpu :P
 
Zuletzt bearbeitet:
ja leider =(

ich mach jetzt mal paar screenshots von meinem skyrim :P
 
ich habe noch ne kopie der propas enb glaube ich




enbseries
[PROXY]
EnableProxyLibrary=false
InitProxyFunctions=true
ProxyLibrary=SMAAd3d9.dll

[GLOBAL]
AdditionalConfigFile=
UseEffect=true

[FIX]
ForceSingleCoreCPU=false
IgnoreThreadManagement=false
IgnoreThreadPriority=false
AntiBSOD=true
FixGameBugs=true
FixParallaxBugs=true
ForceFakeVideocard=false

[GAME]
SpeedHack=true

[MULTIHEAD]
ForceVideoAdapterIndex=false
VideoAdapterIndex=0

[LIMITER]
WaitBusyRenderer=false
EnableFPSLimit=false
FPSLimit=32.0

[INPUT]
//back
KeyReadConfig=8

//shift
KeyCombination=16

//f12
KeyUseEffect=123

//home
KeyFPSLimit=36

//num *
KeyShowFPS=106

//insert: 45
//print screen: 44
KeyScreenshot=44


[ENGINE]
ForceAnisotropicFiltering=false
MaxAnisotropy=16
SkipShaderOptimization=false


[EFFECT]
UseOriginalPostProcessing=false
EnableBloom=true
EnableAdaptation=false
EnableAmbientOcclusion=true
EnableDepthOfField=true
UseOriginalObjectsProcessing=false
EnableDetailedShadow=true
EnableSunRays=true
EnableSkyLighting=true

[BLOOM]
Quality=1
AmountDay=0.85
AmountNight=1.1
BlueShiftAmountDay=1.0
BlueShiftAmountNight=1.0
ContrastDay=0.55
ContrastNight=0.55

[CAMERAFX]
LenzReflectionIntensityDay=0.0
LenzReflectionIntensityNight=0.0
LenzReflectionPowerDay=1.0
LenzReflectionPowerNight=1.0

[SSAO_SSIL]
UseIndirectLighting=false
UseComplexIndirectLighting=false
SamplingQuality=1
SamplingRange=0.35
FadeFogRangeDay=16.0
FadeFogRangeNight=16.0
SizeScale=0.5
SourceTexturesScale=0.4
FilterQuality=2
AOAmount=0.5
ILAmount=0.5

[NIGHTDAY]
DetectorDefaultDay=false
DetectorLevelDay=0.75
DetectorLevelNight=0.15
DetectorLevelCurve=1.0

[ADAPTATION]
ForceMinMaxValues=false
AdaptationSensitivity=0.15
AdaptationTime=0.0015
AdaptationMin=0.25
AdaptationMax=0.15

[ENVIRONMENT]
DirectLightingIntensityDay=1.05
DirectLightingIntensityNight=1.15
DirectLightingCurveDay=0.15
DirectLightingCurveNight=0.65
DirectLightingDesaturationDay=0.155
DirectLightingDesaturationNight=0.1

SpecularAmountMultiplierDay=1.75
SpecularAmountMultiplierNight=1.25
SpecularPowerMultiplierDay=1.0
SpecularPowerMultiplierNight=0.95
SpecularFromLightDay=0.1
SpecularFromLightNight=0.1

AmbientLightingIntensityDay=2.45
AmbientLightingIntensityNight=0.75
AmbientLightingCurveDay=0.25
AmbientLightingCurveNight=0.35
AmbientLightingDesaturationDay=0.35
AmbientLightingDesaturationNight=0.35

PointLightingIntensityDay=1.35
PointLightingIntensityNight=0.95
PointLightingCurveDay=1.05
PointLightingCurveNight=0.45
PointLightingDesaturationDay=0.35
PointLightingDesaturationNight=0.65

FogColorMultiplierDay=0.65
FogColorMultiplierNight=0.65
FogColorCurveDay=0.85
FogColorCurveNight=1.0

ColorPowDay=1.0
ColorPowNight=1.0

[SKY]
Enable=true

StarsIntensity=1.65
StarsCurve=0.95

AuroraBorealisIntensity=0.95
AuroraBorealisCurve=1.0

CloudsIntensityDay=1.25
CloudsIntensityNight=0.85
CloudsCurveDay=2.15
CloudsCurveNight=1.0
CloudsDesaturationDay=0.15
CloudsDesaturationNight=0.15

GradientIntensityDay=1.15
GradientIntensityNight=0.65
GradientDesaturationDay=0.35
GradientDesaturationNight=0.25

GradientTopIntensityDay=2.45
GradientTopIntensityNight=1.8
GradientTopCurveDay=1.55
GradientTopCurveNight=1.0

GradientMiddleIntensityDay=1.55
GradientMiddleIntensityNight=1.55
GradientMiddleCurveDay=1.0
GradientMiddleCurveNight=1.0

GradientHorizonIntensityDay=1.25
GradientHorizonIntensityNight=1.35
GradientHorizonCurveDay=1.0
GradientHorizonCurveNight=1.0

SunIntensity=1.25
SunDesaturation=0.25

SunCoronaIntensity=1.45
SunCoronaCurve=1.0
SunCoronaDesaturation=0.25

MoonIntensity=3.0
MoonCurve=1.55
MoonDesaturation=0.25

CloudsEdgeClamp=1.55
CloudsEdgeIntensity=8.0
GradientIntensity=1.0
GradientDesaturation=0.0

[OBJECT]
SubSurfaceScatteringMultiplierDay=0.45
SubSurfaceScatteringMultiplierNight=0.45
SubSurfaceScatteringPowerDay=15.0
SubSurfaceScatteringPowerNight=15.0

[LIGHTSPRITE]
IntensityDay=0.85
IntensityNight=0.85
CurveDay=0.95
CurveNight=0.75

[WINDOWLIGHT]
Intensity=6.0
Curve=0.6

[VOLUMETRICFOG]
IntensityDay=1.25
IntensityNight=0.65
CurveDay=1.0
CurveNight=0.65

[FIRE]
IntensityDay=1.35
IntensityNight=1.55
CurveDay=2.75
CurveNight=1.25

[COLORCORRECTION]
UsePaletteTexture=true
Brightness=1.225
GammaCurve=1.175

[SHADOW]
ShadowCastersFix=true
UseBilateralShadowFilter=true
ShadowQualityFix=true
DetailedShadowQuality=2
ShadowObjectsFix=true

[DEPTHOFFIELD]
FadeTime=0.2

[RAYS]
SunRaysMultiplier=1.85

[SKYLIGHTING]
Quality=1
FilterQuality=2
AmbientMinLevel=0.45

enbbloom.fx
//++++++++++++++++++++++++++++++++++++++++++++
// ENBSeries effect file
// visit http://enbdev.com for updates
// Copyright (c) 2007-2011 Boris Vorontsov
//++++++++++++++++++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++
//internal parameters, can be modified
//+++++++++++++++++++++++++++++

#define USE_TINTING 1
#define TINT_COLOR float3(0.6, 0.4, 1.0)
#define TINT_TEXTURE tex2D(SamplerBloom6, In.txcoord0.xy).rgb
#define TINT_LEVEL 0.5
// #define USE_ANAMFLARE 1 // comment it to disable anamorphic lens flare

#if USE_TINTING == 1
#define TINT TINT_COLOR
#elif USE_TINTING == 2
#define TINT TINT_TEXTURE
#endif

//+++++++++++++++++++++++++++++
//external parameters, do not modify
//+++++++++++++++++++++++++++++
//keyboard controlled temporary variables (in some versions exists in the config file). Press and hold key 1,2,3...8 together with PageUp or PageDown to modify. By default all set to 1.0
float4 tempF1; //0,1,2,3
float4 tempF2; //5,6,7,8
float4 tempF3; //9,0
//x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
float4 ScreenSize;
//x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
float4 Timer;
//additional info for computations
float4 TempParameters;
//Lenz reflection intensity, lenz reflection power
float4 LenzParameters;
//BloomRadius1, BloomRadius2, BloomBlueShiftAmount, BloomContrast
float4 BloomParameters;

// Anamorphic flare parameters
#define fFlareLuminance 2.0 // bright pass luminance value
#define fFlareBlur 200.0 // manages the size of the flare
#define fFlareIntensity 0.07 // effect intensity

texture2D texBloom1;
texture2D texBloom2;
texture2D texBloom3;
texture2D texBloom4;
texture2D texBloom5;
texture2D texBloom6;
texture2D texBloom7;//additional bloom tex
texture2D texBloom8;//additional bloom tex

sampler2D SamplerBloom1 = sampler_state
{
Texture = <texBloom1>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;//NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D SamplerBloom2 = sampler_state
{
Texture = <texBloom2>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;//NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D SamplerBloom3 = sampler_state
{
Texture = <texBloom3>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;//NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D SamplerBloom4 = sampler_state
{
Texture = <texBloom4>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;//NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D SamplerBloom5 = sampler_state
{
Texture = <texBloom5>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;//NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D SamplerBloom6 = sampler_state
{
Texture = <texBloom6>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;//NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D SamplerBloom7 = sampler_state
{
Texture = <texBloom7>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;//NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D SamplerBloom8 = sampler_state
{
Texture = <texBloom8>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;//NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

struct VS_OUTPUT_POST
{
float4 vpos : POSITION;
float2 txcoord0 : TEXCOORD0;
};
struct VS_INPUT_POST
{
float3 pos : POSITION;
float2 txcoord0 : TEXCOORD0;
};

VS_OUTPUT_POST VS_Bloom(VS_INPUT_POST IN)
{
VS_OUTPUT_POST OUT;
OUT.vpos = float4(IN.pos.x, IN.pos.y, IN.pos.z, 1.0);
OUT.txcoord0.xy = IN.txcoord0.xy + TempParameters.xy;

return OUT;
}

/**
* Bright pass - rescales sampled pixel to emboss bright enough value.
*/
float3 BrightPass(float2 tex)
{
float3 c = tex2D(SamplerBloom2, tex).rgb;
float3 bC = max(c - float3(fFlareLuminance, fFlareLuminance, fFlareLuminance), 0.0);
float bright = dot(bC, 1.0);
bright = smoothstep(0.0f, 0.5, bright);
return lerp(0.0, c, bright);
}

/**
* Anamorphic sampling function - scales pixel coordinate
* to stratch the image along one of the axels.
* (http://en.wikipedia.org/wiki/Anamorphosis)
*/
float3 AnamorphicSample(int axis, float2 tex, float blur)
{
tex = 2.0 * tex - 1.0;
if (!axis) tex.x /= -blur;
else tex.y /= -blur;
tex = 0.5 * tex + 0.5;
return BrightPass(tex);
}

/**
* Converts pixel color to gray-scale.
*/
float GrayScale(float3 sample)
{
return dot(sample, float3(0.3, 0.59, 0.11));
}

// Constants ///////////////////////////////////////////////////////////////
const float2 bloomOffset[8]=
{
float2(0.707, 0.707),
float2(0.707, -0.707),
float2(-0.707, 0.707),
float2(-0.707, -0.707),
float2(0.0, 1.0),
float2(0.0, -1.0),
float2(1.0, 0.0),
float2(-1.0, 0.0)
};

// deepness, curvature, inverse size
const float3 offset[4]=
{
float3(1.6, 4.0, 1.0),
float3(0.7, 0.25, 2.0),
float3(0.3, 1.5, 0.5),
float3(-0.5, 1.0, 1.0)
};

// color filter per reflection
const float3 factors[4]=
{
float3(0.3, 0.4, 0.4),
float3(0.2, 0.4, 0.5),
float3(0.5, 0.3, 0.7),
float3(0.1, 0.2, 0.7)
};
////////////////////////////////////////////////////////////////////////////

// Anamorphic lens flare pixel shader (Matso code)
float4 PS_ProcessPass_Anamorphic(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{
float4 res;
float2 coord = IN.txcoord0.xy;
float3 anamFlare = AnamorphicSample(0, coord.xy, fFlareBlur) * float3(0.0, 0.0, 1.0);

res.rgb = anamFlare * fFlareIntensity;
res.a = 1.0;

return res;
}

//zero pass HQ, input texture is fullscreen
//SamplerBloom1 - fullscreen texture
float4 PS_BloomPrePass(VS_OUTPUT_POST In) : COLOR
{
float4 bloomuv;
float4 bloom = 0.0;
float2 screenfact = TempParameters.z;
float4 srcbloom = bloom;

screenfact.y *= ScreenSize.z;

for (int i = 0; i < 4; i++)
{
bloomuv.xy = bloomOffset * 0.524;
bloomuv.xy = (bloomuv.xy * screenfact.xy) + In.txcoord0.xy;
bloom.xyz += tex2D(SamplerBloom1, bloomuv.xy).xyz * 1.524;// try bokeh weights here...
}
bloom.xyz *= 0.164041994;

bloom.xyz = min(bloom.xyz, 32768.0);
bloom.xyz = max(bloom.xyz, 0.0);
return bloom;
}

//first and second passes draw to every texture
//twice, after computations of these two passes,
//result is set as input to next cycle

//first pass
//SamplerBloom1 is result of prepass or second pass from cycle
float4 PS_BloomTexture1(VS_OUTPUT_POST In) : COLOR
{
float4 bloomuv;
float4 bloom = tex2D(SamplerBloom1, In.txcoord0);
float2 screenfact = TempParameters.z;
float4 srcbloom = bloom;
float4 bloomadd = bloom;
float step = BloomParameters.x;

screenfact.y *= ScreenSize.z;
screenfact.xy *= step;

for (int i = 0; i < 8; i++)
{
bloomuv.xy = bloomOffset;
bloomuv.xy = (bloomuv.xy * screenfact.xy) + In.txcoord0.xy;
bloom += tex2D(SamplerBloom1, bloomuv.xy) * 1.524;
}
bloom *= 0.082020997;
//////////////////////////////////////////////////////////////////////////////////
#ifdef USE_TINTING
float3 tint = TINT * TINT_LEVEL;
float ttt = max(dot(bloom.xyz, 0.333) - dot(srcbloom.xyz, 0.333), 0.0);
float gray = BloomParameters.z * ttt * 10.0;
float mixfact = (gray / (1.0 + gray));

mixfact *= 1.0 - saturate((TempParameters.w - 1.0) * 0.2);
tint.xy += saturate((TempParameters.w - 1.0) * 0.3);
tint.xy = saturate(tint.xy);

bloom.xyz *= lerp(1.0, tint.xyz, mixfact);
#endif
//////////////////////////////////////////////////////////////////////////////////
bloom.w = 1.0;

return bloom;
}

//second pass
//SamplerBloom1 is result of first pass
float4 PS_BloomTexture2(VS_OUTPUT_POST In) : COLOR
{
float4 bloomuv;
float4 bloom = tex2D(SamplerBloom1, In.txcoord0);
float2 screenfact = TempParameters.z;
float4 srcbloom = bloom;
float step = BloomParameters.y;
float4 rotvec = 0.0;

screenfact.y *= ScreenSize.z;
screenfact.xy *= step;
sincos(0.3927, rotvec.x, rotvec.y);

for (int i = 0; i < 8; i++)
{
bloomuv.xy = bloomOffset;
bloomuv.xy = reflect(bloomuv.xy, rotvec.xy);///????????
bloomuv.xy = (bloomuv.xy * screenfact.xy) + In.txcoord0.xy;
bloom += tex2D(SamplerBloom1, bloomuv.xy) * 1.524;
}
bloom *= 0.082020997;

bloom.w = 1.0;
return bloom;
}

//last pass, mix several bloom textures
//SamplerBloom5 is the result of prepass
//float4 PS_BloomPostPass(float2 vPos : VPOS ) : COLOR
float4 PS_BloomPostPass(VS_OUTPUT_POST In) : COLOR
{
float4 bloom;
//v1
bloom = tex2D(SamplerBloom1, In.txcoord0);
bloom += tex2D(SamplerBloom2, In.txcoord0);
bloom += tex2D(SamplerBloom3, In.txcoord0);
bloom += tex2D(SamplerBloom4, In.txcoord0);
bloom += tex2D(SamplerBloom7, In.txcoord0);
bloom += tex2D(SamplerBloom8, In.txcoord0);
bloom += tex2D(SamplerBloom5, In.txcoord0);
bloom *= 0.142857142;

float3 lenz = 0;
float2 lenzuv = 0.0;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (LenzParameters.x > 0.00001)
{
for (int i = 0; i < 4; i++)
{
float2 distfact = (In.txcoord0.xy - 0.5);
lenzuv.xy = offset.x * distfact;
lenzuv.xy *= pow(2.0 * length(float2(distfact.x * ScreenSize.z, distfact.y)), offset.y);
lenzuv.xy *= offset.z;
lenzuv.xy = 0.5 - lenzuv.xy;

float3 templenz = tex2D(SamplerBloom2, lenzuv.xy);
templenz = templenz * factors;
distfact = (lenzuv.xy-0.5);
distfact *= 2.0;
templenz *= saturate(1.0 - dot(distfact, distfact));//limit by uv 0..1

float maxlenz = max(templenz.x, max(templenz.y, templenz.z));
float tempnor = (maxlenz / (1.0 + maxlenz));
tempnor = pow(tempnor, LenzParameters.y);
templenz.xyz *= tempnor;

lenz += templenz;
}
lenz.xyz *= 0.25 * LenzParameters.x;

bloom.xyz += lenz.xyz;
bloom.w = max(lenz.xyz, max(lenz.y, lenz.z));
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
return bloom;
}

//---------------------------------------------------------------------------------

technique BloomPrePass
{
pass p0
{
VertexShader = compile vs_3_0 VS_Bloom();
PixelShader = compile ps_3_0 PS_BloomPrePass();

ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
CullMode = NONE;
AlphaBlendEnable = FALSE;
AlphaTestEnable = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}

technique BloomTexture1
{
pass p0
{
VertexShader = compile vs_3_0 VS_Bloom();
PixelShader = compile ps_3_0 PS_BloomTexture1();

ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
CullMode = NONE;
AlphaBlendEnable = FALSE;
AlphaTestEnable = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}


technique BloomTexture2
{
pass p0
{
VertexShader = compile vs_3_0 VS_Bloom();
PixelShader = compile ps_3_0 PS_BloomTexture2();

ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
CullMode = NONE;
AlphaBlendEnable = FALSE;
AlphaTestEnable = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}

technique BloomPostPass
{
pass p0
{
VertexShader = compile vs_3_0 VS_Bloom();
PixelShader = compile ps_3_0 PS_BloomPostPass();

ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
CullMode = NONE;
AlphaBlendEnable = FALSE;
AlphaTestEnable = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}

#ifdef USE_ANAMFLARE
pass p1
{
AlphaBlendEnable = true;
SrcBlend = One;
DestBlend = One;

PixelShader = compile ps_3_0 PS_ProcessPass_Anamorphic();
}
#endif
}


enbeffects.fx
//++++++++++++++++++++++++++++++++++++++++++++
// ENBSeries effect file
// visit http://enbdev.com for updates
// Copyright (c) 2007-2011 Boris Vorontsov
//
// Using decompiled shader of TES Skyrim
//++++++++++++++++++++++++++++++++++++++++++++

//++++++++++++++++++++++++++++++++++++++++++++
// Additions and Tweaking by HD6 (HeliosDoubleSix)
// MOD by HD6: http://www.skyrimnexus.com/downloads/file.php?id=4142
// MOD by ENB: http://www.skyrimnexus.com/downloads/file.php?id=2971
// these are typically denoted by 'HD6'
// given I have no shader writing experience,
// will undoubtedly be retarded to a seasoned professional, I welcome any advice!
// thanks Boris!
//++++++++++++++++++++++++++++++++++++++++++++

// Remove or add '//' infront of '#define' below to disable / enable the various options

////

// ENB - values could be 1, 2, 3 or 4. v4 gives unrealistic, kind of artwork style, v5 is added by HD6
#define POSTPROCESS 5
//

// ENB - use original game processing first, then mine
#define APPLYGAMECOLORCORRECTION
//

// ENB - use original game processing only, with vanilla bloom (basically turns everything off)
//#define ENB_FLIPTECHNIQUE
//

////

// HD6 - Color Balance and Brightness, Contrast adjustment
//
#define HD6_COLOR_TWEAKS
#define HD6_DARKER_NIGHTS
//
// Put // or remove the // infront of "#define HD6_DARKER_NIGHTS" above, to darken the nights or not.. // will put nights back to normal
//
// This is by default and for examples sake set to make the nights even darker
// When you decrease brightness you will need to increase contrast or it will look washed out
// and if you increrase contrast that naturally increases saturation so you need to reduce saturation
// this is just the nature of color correction :-)
//
// Note nights and days are being desaturated per channel(RGB) using: HD6_COLORSAT_DAYNIGHT elsewhere
// Note Bloom is not affected by this and gets its own color/contrast adjustment in HD6_BLOOM_CRISP and HD6_BLOOM_DEBLUEIFY if used
//
// If the 3 numbers in rgb below do not add up to 3 it will either be darker or lighter than before
float3 rgbd = float3( 1.04, 0.95, 1.03 ); // RGB balance day
float3 rgbn = float3( 1.04, 0.95, 1.03 ); // RGB balance night
//
// First column of the 3 here is for key control only during night
// ie you can press number '1' with pageup or pagedown to alter the brightness while playing
// As you press pagedown it moves further towards the values in this first column.
// As a helpful indicator you can see if you have moved away from default values by
// noticing a very small white dot in top left corner of screen.
// Adjust with keys till this dot vanishes, then it is back to default
// The Keycontrol ONLY affects the night right now. So dont try using it during the day it wont do anything.

#ifdef HD6_DARKER_NIGHTS
// Darker Nights ( Night Keypress 1+Pageup/down, Night, Day )
// Only uses these values if "#define HD6_DARKER_NIGHTS" does not have '//' infront
float3 uctbrt1 = float3( 0.22, 0.80, 1.00 ); // Brightness Night, Day (Alters before contrast adjustment)
float3 uctbrt2 = float3( 0.22, 1.00, 1.00 ); // Brightness Night, Day (Alters after contrast adjustment)
float3 uctcon = float3( 1.00, 0.97, 0.85 ); // Contrast Night, Day
float3 uctsat = float3( 0.00, 1.00, 1.00 ); // Saturation Night, Day (Remember if using HD6_COLORSAT_DAYNIGHT that will also be desaturating the night)
#else
// Normal Nights ( Night Keypress 1+Pageup/down, Night, Day )
// Only uses these values if "#define HD6_DARKER_NIGHTS" has '//' infront disabling it
float3 uctbrt1 = float3( 0.30, 1.00, 1.00 );
float3 uctbrt2 = float3( 0.30, 1.00, 1.00 );
float3 uctcon = float3( 1.00, 0.97, 0.85 );
float3 uctsat = float3( 0.00, 1.00, 1.00 );
#endif

//
// I have stopped relying on the palette map to darken nights, now I do all darkening here
// When reducing brightness it seems increasing saturation is needed to restore color, anda slight increase in contrast to maintain bright spots/flames etc
// Remember this is not darkening the bloom, which in itself has as impact on the overall brightness and hazyness of the scene
//
// Palette map right now is increasing contrast so I have compensated by reducing contrast here (lazy)
//

// HD6 - Enable Vignette - darkens and blurs edges of the screen which increasesfocus on center, film/camera type effect/look
// didnt bother adding blur, could do without muddying and fuzzing things really
// and the effect is only meant to be super subtle not a pin hole camera -_-
//
// #define HD6_VIGNETTE
//
// Defaults below, I darken the corners and the bottom only, leaving the top light
// darkening all sides feels ike you are trapping/closing in the view too much, so it is not a normal vignette
// And it is subtle, till you turn it off I doubt you would ever even notice it
// Also is turned off at night
//
float rovigpwr = 360.0; // For Round vignette // 0.2
float2 sqvigpwr = float2( 1.5, 1.5 ); // For square vignette: (top, bottom)
//
float vsatstrength = 0; // How saturated vignette is
float vignettepow = 0; // For Round vignette, higher pushes it to the corners and increases contrast/sharpness
//
float vstrengthatnight = 360.0; // How strong vignette is as night, 0-1

// HD6 - Desaturate Nights, can alter saturation seperately from day and night, will affect caves and indoors also for now
//
#define HD6_COLORSAT_DAYNIGHT
//
// Nighttime Saturation, Red, Green, Blue
float3 dnsatn = float3( 1.0, 0.97, 0.95 );
//
// Daytime Saturation, Red, Green, Blue
float3 dnsatd = float3( 1.0, 0.97, 0.95 );
//

// HD6 - removes blue tint from bloom, most apparent in distant fog
//
#define HD6_BLOOM_DEBLUEIFY
//
// HeliosDoubleSix cobbled code to deblueify bloom without loosing brightness huzah! - First time writing shader code so be gentle
// desaturates bloom, to do this you cant just remove a color or tone it down you need to redistribute it evenly across all channels to make it grey
// well evenly would make sense but the eye has different sensetivities to color so its actually RGB (0.3, 0.59, 0.11) to achieve greyscale
// Careful as removing too muchblue can send snow and early morning pink
//
float3 nsat = float3( 0.90, 0.95, 0.98 );
//

// HD6 - Enable Bloom - disable bloom with this if you turn it off in enbseries, compensates for darkening
#define USEBLOOM
//

// Pick one or none:
// HD6 - BLOOM 1 - alternate crisp bloom, no hazey mud (hopefully)
#define HD6_BLOOM_CRISP
// HD6 - BLOOM 2 - alternate bloom (using screen mode) I have abadoned this code
//#define HD6_BLOOM_SCREEN
//

// HD6 - old weird serendipitous code to defuzz bloom
//#define HD6_BLOOM_DEFUZZ
//

// HD6 - remove black from bloom, not working very well
//#define HD6_BLOOM_NOBLACK
//

// Keyboard controlled temporary variables (in some versions exists in the config file).
// Press and hold key 1,2,3...8 together with PageUp or PageDown to modify. By default all set to 1.0
float4 tempF1; // 0,1,2,3
float4 tempF2; // 5,6,7,8
float4 tempF3; // 9,0

// x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
float4 Timer;
// x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
float4 ScreenSize;
// changes in range 0..1, 0 means that night time, 1 - day time
float ENightDayFactor;

// enb version of bloom applied, ignored if original post processing used
float EBloomAmount;

//+++++++++++++++++++++++++++++
//POSTPROCESS 1
float EAdaptationMinV1 = 0.05;
float EAdaptationMaxV1 = 0.125;
float EContrastV1 = 1.0;
float EColorSaturationV1 = 1.3;
float EToneMappingCurveV1 = 3.0;
//+++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++
//POSTPROCESS 2
#if (POSTPROCESS==2)
float EAdaptationMinV2=0.05;
float EAdaptationMaxV2=0.125;
float EToneMappingCurveV2=8.0;
float EIntensityContrastV2=1.475;
float EColorSaturationV2=1.6;
float EToneMappingOversaturationV2=160.0;
#endif
//+++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++
//POSTPROCESS 5 by HD6
#if (POSTPROCESS==5)
float EAdaptationMinV2 = 0.12; // 0.28 // lower gets brighter

// Increase this to darken days, but darkening them will kill the sky a bit unless you enable the SKY overirde in enberies.ini
float EAdaptationMaxV2 = 0.255; // 0.30 // 0.65 // 0.35 // 0.29

// Set ridiculously high, was 8, was in attempt to keep hair colour intact
float EToneMappingCurveV2 = 8.0; // 130

// Adjusting this will throw out all the other values, icreased to high levels to combat how high I increased ToneMappingCurve to bring some contrast back in to daytime
float EIntensityContrastV2 = 3.25; // 3.375 // 4.75 // 3.975

// try and put some color in Lydias cheeks -_- with 2.0 instead of 1.65
// high saturation also helps pop the pink/orange sunsets/mornings at 6.30pm and 7.30am, but also nights then get very blue
float EColorSaturationV2 =2.25; // 1.65;

// Not using this
float EToneMappingOversaturationV2 = 1850.0;
#endif
//+++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++
//POSTPROCESS 3
float EAdaptationMinV3 = 0.001; // Higher Gets Darker
float EAdaptationMaxV3 = 0.025;
float EToneMappingCurveV3 = 30.0; // Higher gets darker
float EToneMappingOversaturationV3 = 111160.0;
//+++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++
//POSTPROCESS 4
float EAdaptationMinV4 = 0.2;
float EAdaptationMaxV4 = 0.125;
float EBrightnessCurveV4 = 0.7;
float EBrightnessMultiplierV4 = 0.45;
float EBrightnessToneMappingCurveV4 = 0.3;
//+++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++
//external parameters, do not modify
//+++++++++++++++++++++++++++++
texture2D texs0; // color
texture2D texs1; // bloom skyrim
texture2D texs2; // adaptation skyrim
texture2D texs3; // bloom enb
texture2D texs4; // adaptation enb
texture2D texs7; // palette enb

sampler2D _s0 = sampler_state {
Texture = <texs0>;
MinFilter = POINT;
MagFilter = POINT;
MipFilter = NONE; // LINEAR;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D _s1 = sampler_state {
Texture = <texs1>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE; // LINEAR;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D _s2 = sampler_state {
Texture = <texs2>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE; // LINEAR;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D _s3 = sampler_state {
Texture = <texs3>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE; // LINEAR;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D _s4 = sampler_state {
Texture = <texs4>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE; // LINEAR;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

sampler2D _s7 = sampler_state {
Texture = <texs7>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture=FALSE;
MaxMipLevel=0;
MipMapLodBias=0;
};

struct VS_OUTPUT_POST {
float4 vpos : POSITION;
float2 txcoord0 : TEXCOORD0;
};

struct VS_INPUT_POST {
float3 pos : POSITION;
float2 txcoord0 : TEXCOORD0;
};

VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN){
VS_OUTPUT_POST OUT;
OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
OUT.txcoord0.xy=IN.txcoord0.xy;
return OUT;
};

//skyrim shader specific externals, do not modify
float4 _c1 : register(c1); float4 _c2 : register(c2); float4 _c3 : register(c3);
float4 _c4 : register(c4); float4 _c5 : register(c5);

float4 PS_D6EC7DD1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR {
float4 _oC0 = 0.0; // output
float4 _c6 = float4(0, 0, 0, 0);
float4 _c7 = float4(0.212500006, 0.715399981, 0.0720999986, 1.0);
float4 r0; float4 r1; float4 r2; float4 r3; float4 r4; float4 r5; float4 r6;
float4 r7; float4 r8; float4 r9; float4 r10; float4 r11; float4 _v0=0.0;
_v0.xy = IN.txcoord0.xy;
r1=tex2D(_s0, _v0.xy); // color
r11=r1; // my bypass
_oC0.xyz=r1.xyz; // for future use without game color corrections

// HD6 - You can play with the night/day value here, not that its advisable to :-D
// Visualize this with 'debug triangle' further down
float hnd = ENightDayFactor;
//hnd-=0.4;
//hnd = hnd - (0.5-hnd);
//hnd = max(hnd,0);
//hnd = min(hnd,1);
//hnd=1;


// HD6 - Alter Brightness using keyboard during gameplay

float3 tuctbrt1 = uctbrt1;
float3 tuctbrt2 = uctbrt2;
float3 tuctcon = uctcon;
float3 tuctsat = uctsat;

float h1 = lerp(-1,1,tempF1.x); // Increases speed it changes by when pressing key
h1 = lerp( h1, 1, hnd ); // Removes affect during day
h1 = h1 - (h1 % 0.1); // Changes it so incriments are in steps, remove this if you want smooth changes when pressing keys
//float hbs = EBloomAmount;
float hbs = lerp( EBloomAmount/2, EBloomAmount, h1); // Reduce bloom as it gets darker, otherwise it just gets hazier, higher number reduces bloom more as it gets darker
#ifdef HD6_COLOR_TWEAKS
float2 uctbrt1t = float2( lerp( tuctbrt1.x, tuctbrt1.y, h1), tuctbrt1.z );
float2 uctbrt2t = float2( lerp( tuctbrt2.x, tuctbrt2.y, h1), tuctbrt2.y );
float2 uctcont = float2( lerp( tuctcon.x, tuctcon.y, h1), tuctcon.z );
float2 uctsatt = float2( lerp( tuctsat.x, tuctsat.y, h1), tuctsat.z );
#endif

////



#ifdef APPLYGAMECOLORCORRECTION
//apply original
r0.x=1.0/_c2.y;
r1=tex2D(_s2, _v0);

//r1.xyz = lerp( 0.28, 0.5, hnd ); // HD6 - disable vanilla adapation... because it drives me CRAAAZY!!!!! >_<
//r1.xyz+=1.0;
r1.xyz = lerp( min( 0.28, r1.xyz ), 0.5, hnd ); // Ligthen if dark, but do not darken if too light, we do this elsewhere for extreme bright situations
// No seriously it screws up when looking at bright lights at night and the sky during day



r0.yz=r1.xy * _c1.y;
r0.w=1.0/r0.y;
r0.z=r0.w * r0.z;
r1=tex2D(_s0, _v0);
r1.xyz=r1 * _c1.y;
r0.w=dot(_c7.xyz, r1.xyz);
r1.w=r0.w * r0.z;
r0.z=r0.z * r0.w + _c7.w;
r0.z=1.0/r0.z;
r0.x=r1.w * r0.x + _c7.w;
r0.x=r0.x * r1.w;
r0.x=r0.z * r0.x;
if (r0.w<0) r0.x=_c6.x;
r0.z=1.0/r0.w;
r0.z=r0.z * r0.x;
r0.x=saturate(-r0.x + _c2.x);

//r2=tex2D(_s3, _v0); // enb bloom
r2=tex2D(_s1, _v0);//skyrim bloom

#ifdef USEBLOOM
//r2.xyz=min(r2,0.5); // HD6 code to stop bloom causing glitches, inverting
//r2.xyz=max(r2,0.1);
#else
//r2.xyz=0.2; // compensate for lack of bloom
#endif
r2.xyz=0.0; // Screw it bloom should not happen here at all so just set to 0
r2+=0.1; // HD6 - I add 0.1 to lighten it a bit, probably not great place to do it now

//r2=tex2D(_s1, _v0); // skyrim bloom
r2.xyz=r2 * _c1.y;
r2.xyz=r0.x * r2;

r1.xyz=r1 * r0.z + r2;
r0.x=dot(r1.xyz, _c7.xyz);
r1.w=_c7.w;

r2=lerp(r0.x, r1, _c3.x);

r1=r0.x * _c4 - r2;
r1=_c4.w * r1 + r2;
r1=_c3.w * r1 - r0.y; // khajiit night vision _c3.w
r0=_c3.z * r1 + r0.y;
r1=-r0 + _c5;

_oC0=_c5.w * r1 + r0;
//_oC0=r0;
#endif // APPLYGAMECOLORCORRECTION

float4 color=_oC0;

//HD6 brighten when not using original gamma, so they are at least similiar
// Bloom is diminshed for some reason, oh well, i dont use this
#ifndef APPLYGAMECOLORCORRECTION
color*=1.2;
color+=0.1;
#endif

#ifdef HD6_COLORSAT_DAYNIGHT
// HeliosDoubleSix code to Desaturate at night
// What channels to desaturate by how much, so you could just reduce blue at night and nothing else
// doesnt seem quite right will tinge things green if you just remove blue :-/ thought perhaps that makes perfect sense :-) *brain hurts*
// Remember this affects caves, so might be best to remove saturation from nighttime direct and ambient light
float3 nsatn=lerp(dnsatd,dnsatn,1-hnd); // So it has less to different/no effect during day
//nsatn*=(1-hnd); // affect by night time value:
float3 oldcoln = color.xyz; // store old values
color.xyz *= nsatn; // adjust saturation

// spread lost luminace over everything
//float3 greycn = float3(0.299, 0.587, 0.114); // perception of color luminace
float3 greycn = float3(0.333,0.333,0.333); // screw perception
//greycn = float3(0.811,0.523,0.996);
color.xyz += (oldcoln.x-(oldcoln.x*nsatn.x)) * greycn.x;
color.xyz += (oldcoln.y-(oldcoln.y*nsatn.y)) * greycn.y;
color.xyz += (oldcoln.z-(oldcoln.z*nsatn.z)) * greycn.z;
#endif

/*
#ifndef APPLYGAMECOLORCORRECTION
//temporary fix for khajiit night vision, but it also degrade colors.
// r1=tex2D(_s2, _v0);
// r0.y=r1.xy * _c1.y;
r1=_oC0;
r1.xyz=r1 * _c1.y;
r0.x=dot(r1.xyz, _c7.xyz);
r2=lerp(r0.x, r1, _c3.x);
r1=r0.x * _c4 - r2;
r1=_c4.w * r1 + r2;
r1=_c3.w * r1;// - r0.y;
r0=_c3.z * r1;// + r0.y;
r1=-r0 + _c5;
_oC0=_c5.w * r1 + r0;
#endif //!APPLYGAMECOLORCORRECTION
*/

//adaptation in time
float4 Adaptation=tex2D(_s4, 0.5);
float grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
//grayadaptation=1.0/grayadaptation;


float4 xcolorbloom=tex2D(_s3, _v0.xy); //bloom

#ifdef HD6_BLOOM_NOBLACK
// Helios code to remove dark/black from bloom, stopping it making dark shapes on light background bleed and smudge black into them like a black glow yuck
// not really very good, looks like black glow is actually coming from original vanilla game or something, so its toned down for now to 0.05
// really should make bloom only contain and affect light areas of scene, but this is ok for now.
//This also has the side effect of lightening those darkest areas
float lowestvalue=min(min(xcolorbloom.x,xcolorbloom.y),xcolorbloom.z);
// work out lowest possible value to set RGB without going below 0 and without changing the RGB relative values ie shifting the color in the process
float3 lowestpossible=xcolorbloom.xyz-lowestvalue;
xcolorbloom.xyz=max(xcolorbloom.xyz,lowestpossible+(0.12*(1-hnd))); // adds 0.1 during night only
#endif

//xcolorbloom.xyz=0.2; //HDebug
//float maxb=max(xcolorbloom.x, max(xcolorbloom.y, xcolorbloom.z));
//float violetamount=maxb/(maxb+EVioletShiftAmountInv);
//xcolorbloom.xyz=lerp(xcolorbloom.xyz, xcolorbloom.xyz*EVioletShiftColor, violetamount*violetamount);

#ifdef HD6_BLOOM_DEBLUEIFY

//New saturation to be // 0 being no color
//float3 nsat=float3(1,0.74,0.64); // perfect-ish - removes blue and green from fog and outdoors, makes dwarven ruins very white though
//float3 nsat=float3(1,0.80,0.74); // Touch greener
//float3 nsat=float3(1,0.70,0.65); // Grey, very grey ice gaves almost white, but... foggy days go pink
//nsat=float3(0.85,0.75,0.7); // More reasnioable, still pink sky and snow in places
//nsat=float3(0.80,0.75,0.73);
//float3 nsat=float3(1,0.64,0.58);
//float3 nsat=float3(1,0.74,0.90);
//float3 nsat=float3(0.8,0.56,0.46);
//float3 nsat=float3(0.7,0.6,0.4); // desatures everything a bit
//float3 nsat=float3(0,0,0); // no color in bloom, makes everything very desaturated, fire looks white almost

// store old values
float3 oldcol=xcolorbloom.xyz;

// adjust saturation
xcolorbloom.xyz *= nsat;

// spread lost luminace over everything
//float3 greyc = float3(0.299, 0.587, 0.114); // perception of color luminace
float3 greyc = float3(0.333,0.333,0.333); // screw perception
xcolorbloom.xyz += (oldcol.x-(oldcol.x*nsat.x)) * greyc.x;
xcolorbloom.xyz += (oldcol.y-(oldcol.y*nsat.y)) * greyc.y;
xcolorbloom.xyz += (oldcol.z-(oldcol.z*nsat.z)) * greyc.z;

// equiv to bloom off without destroyng scene luminance-ish
//xcolorbloom.x=0.3;
//xcolorbloom.y=0.3;
//xcolorbloom.z=0.3;

//xcolorbloom.xyz=min(xcolorbloom.xyz,1.2);
#endif

#ifdef HD6_BLOOM_DEFUZZ
// Heliosdouble cobbled together bloom defuzzer - increases contrast of bloom / stop it hazing low brightness values
// what a fudge... but... it works... fancy that
// modulated by the overall brightness of the screen.
float mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)*0.333);
xcolorbloom.xyz-=(mavg*0.3);
//xcolorbloom.xyz=min(xcolorbloom.xyz,0.0);
xcolorbloom.xyz+=(mavg*0.22);
xcolorbloom.xyz*(mavg*1.2);
#endif


// Altering color balance is confusing, also Im not entirely sure it works properly :-D
#ifdef HD6_COLOR_TWEAKS
float ctbrt1 = lerp(uctbrt1t.x,uctbrt1t.y,hnd); // Brightness Night, Day (Alters before contrast adjustment)
float ctbrt2 = lerp(uctbrt2t.x,uctbrt2t.y,hnd); // Brightness Night, Day (Alters after contrast adjustment)
float ctcon = lerp(uctcont.x,uctcont.y,hnd); // Contrast Night, Day
float ctsat = lerp(uctsatt.x,uctsatt.y,hnd); // Saturation Night, Day

float3 ctLumCoeff = float3(0.2125, 0.7154, 0.0721);
float3 ctAvgLumin = float3(0.5, 0.5, 0.5);
float3 ctbrtColor = color.rgb * ctbrt1;

float3 ctintensity = dot(ctbrtColor, ctLumCoeff);
float3 ctsatColor = lerp(ctintensity, ctbrtColor, ctsat);
float3 cconColor = lerp(ctAvgLumin, ctsatColor, ctcon);

color.xyz = cconColor * ctbrt2;
float3 cbalance = lerp(rgbn,rgbd,hnd);
color.xyz=cbalance.xyz * color.xyz;
#endif


#ifdef USEBLOOM
#ifdef HD6_BLOOM_CRISP
float3 LumCoeff = float3( 0.2125, 0.7154, 0.0721 );
float3 AvgLumin = float3( 0.5, 0.5, 0.5 );
//color*=1.06;
//color*=1.0; // Brighten it up without loosing contrast
//color += lerp(0.1,0.1,hnd); // Night, Day, increase kinda lowers contrast, but makes things look more washed out also, this is to lift black areas really
//color+=((color/2)*EBloomAmount);
//xcolorbloom-=0.4;
//xcolorbloom=max(xcolorbloom,0); // will cause color shift/desaturation also
//color.xyz+=(color.xyz*(xcolorbloom*EBloomAmount*0.2))+(xcolorbloom/1.5);
//color.xyz=(color.xyz*color.xyz)/2;
//color.xyz=(color.xyz*0.5)+((color.xyz*(xcolorbloom*EBloomAmount))*0.5);
//color.xyz*=0.8;
//color.xyz*=1.4;

float3 brightbloom = ( xcolorbloom - lerp( 0.18, 0.0, hnd )); // darkens and thus limits what triggers a bloom, used in part to stop snow at night glowing blue
brightbloom = max( brightbloom , 0);

float3 superbright = xcolorbloom - 0.7; // crop it to only include superbright elemnts like sky and fire
superbright = max( superbright , 0 ) ; // crop so dont go any lower than black
//superbright = lerp( AvgLumin, superbright, 0.5); // Contrast
superbright *= 0.6;


//float lowestvaluec=min(min(brightbloom.x,brightbloom.y),brightbloom.z);
//float3 lowestpossiblec=brightbloom.xyz-lowestvaluec;
//brightbloom=max(brightbloom.xyz,lowestpossiblec);

// HD6 - Bloom - Brightntess, Contrast, Saturation adjustment 1,1,1 for no change // Remember this is bloom only being altered
float brt = lerp( 1.0, 1.0, hnd ) ; // doesnt work properly, should be done after contrast no?
//
float con = lerp( 1.1, 1.0, hnd ); // 1.0, 0.8 // 1.1, 1.1
float sat = lerp( 0.8, 0.7, hnd ); // 0.5, 0.7 // 0.7, 0.7
//

float3 brtColor = brightbloom * brt;
float3 cintensity = dot( brtColor, LumCoeff );
float3 satColor = lerp( cintensity, brtColor, sat );
float3 conColor = lerp( AvgLumin, satColor, con );
conColor -= 0.3;
brightbloom = conColor;



// These 2 should compensate so when even when no bloom exists it still matches brightness of scene without ENB
color.xyz += lerp( 0.12, 0.23, hnd ); color.xyz *= lerp( 1.1, 1.4, hnd );

// Now Add bloom and compensate for any brightness changes that introduces

color.xyz += (( superbright * hbs ) * lerp( 1.0, 1.0, hnd ));
brightbloom -= ( superbright * 2 ); // removes superbright from brightbloom so I dont bloom the brightest area twice
brightbloom = max( brightbloom , 0.0 );
color.xyz += (( brightbloom * hbs ) * lerp( 1.0, 1.0, hnd ));

// Blend in some of the orignal bloom to bring back SOME of the hazy glow of the day, none at night
// 1.0, 0.9 - 0.7, 0.6
color.xyz += (xcolorbloom.xyz * hbs) * lerp( 0.7, 0.6, hnd );
color.xyz *= lerp( 0.8, 0.7, hnd ); // compensate for brightening caused by above bloom
// End Blend

//color.xyz *= 1.0;
//color.xyz += (xcolorbloom * 0.3);
//color.xyz += 0.25;
//float4 debug = color;
//debug.xyz = ( superbright * EBloomAmount * 1 );

//color.xyz+=((xcolorbloom*EBloomAmount)/1);
//color.xyz*=lerp(1.25,0.8,hnd); // 1.25, 1 // Darkens end result to rematch with how it looks without BLOOM CRISP enabled

#else
#ifdef HD6_BLOOM_SCREEN
// Helios code to restrict bloom to bright areas only, not smudging dark outs around
color+=((color/1)*EBloomAmount); // compensate if bloom disabled
//color+=0.1;
//xcolorbloom-=0.5;
xcolorbloom=max(xcolorbloom,0); // will cause color shift/desaturation also
//xcolorbloom+=0.2;
// Soft Light: X = (((255-L)*U*L)+ (L*R_s))/255
//1 - ((1.0 - base) * (1.0 - blend))
//1 - ((255-U)*(255-L))/255
//xcolorbloom.xyz*=EBloomAmount;
float tmult = 10;
color/=tmult; xcolorbloom/=tmult; // Screen mode wont work with floating point numbers / big numbers, so I reduce it first

color.x = 1.0 - ((1.0 - color.x) * (1.0 - xcolorbloom.x));
color.y = 1.0 - ((1.0 - color.y) * (1.0 - xcolorbloom.y));
color.z = 1.0 - ((1.0 - color.z) * (1.0 - xcolorbloom.z));
color*=tmult;
// End helios code
#else
float tt=1;
//float3 tt = float3(1*tempF1.x,1*tempF1.x,1*tempF1.x);
color.xyz+=((xcolorbloom.xyz*EBloomAmount)*tt);
#endif
#endif
#else
// No bloom
color+=((color/1)*EBloomAmount); // compensate if bloom disabled
#endif

//+++++++++++++++++++++++++++++

#ifdef HD6_VIGNETTE
// yes this is my own crazy creation after seing how boring the usual linear circle vignettes typically are
// no doubt I have done it in an overly convoluted way :-)

//float fExposureLevel = 1.0; // compensate for any change from vignette so center is same brightness
float2 inTex = _v0;
float4 voriginal = r1;
float4 vcolor = voriginal;
vcolor.xyz=1;
inTex -= 0.5; // Centers vignette
inTex.y += 0.01; // Move it off center and up so it obscures sky less
float vignette = 1.0 - dot( inTex, inTex );
vcolor *= pow( vignette, vignettepow );


// Round Vignette
float4 rvigtex = vcolor;
rvigtex.xyz = pow( vcolor, 1 );
rvigtex.xyz = lerp(float3(0.5, 0.5, 0.5), rvigtex.xyz, 2.0); // Increase Contrast
rvigtex.xyz = lerp(float3(1,1,1),rvigtex.xyz,rovigpwr); // Set strength of round vignette

// Square Vignette (just top and bottom of screen)
float4 vigtex = vcolor;
vcolor.xyz = float3(1,1,1);
float3 topv = min((inTex.y+0.5)*2,0.5) * 2; // Top vignette
float3 botv = min(((0-inTex.y)+0.5)*2,0.5) * 2; // Bottom vignette

topv= lerp(float3(1,1,1), topv, sqvigpwr.x);
botv= lerp(float3(1,1,1), botv, sqvigpwr.y);
vigtex.xyz = (topv)*(botv);

//vigtex.xyz = lerp(float3(1,1,1),vigtex.xyz,sqvigpwr); // Set strength of square vignette

// Add round and square together
vigtex.xyz*=rvigtex.xyz;

vigtex.xyz = lerp(vigtex.xyz,float3(1,1,1),(1-vstrengthatnight)*(1-hnd)); // Alter Strength at night

vigtex.xyz = min(vigtex.xyz,1);
vigtex.xyz = max(vigtex.xyz,0);
//vigtex.xyz -= 0.5;
//(base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
//vigtex.xyz = vigtex.xyz < 0.5 ? (2.0 * color.xyz * vigtex.xyz) : (1 - 2 * (1 - color.xyz) * (1 - vigtex.xyz));
// Crap I keep forgetting overlay mode doesnt work in floating point/32bit/hdr dur bee durr

// Increase saturation where edges were darkenned
float3 vtintensity = dot(color.xyz, float3(0.2125, 0.7154, 0.0721));
color.xyz = lerp(vtintensity, color.xyz, ((((1-(vigtex.xyz*2))+2)-1)*vsatstrength)+1 );

//color.xyz+=0.02;
color.xyz *= (vigtex.xyz);
//color.xyz *= fExposureLevel;

#endif

// HD6 - Warning, Code below appears to reduce 'color.xyz' to 8bit / LDR


// HD6 - Eye Adaptation for extreme extreme over bright areas only, such as stupid stupid snow
// 0.3, 0.9 - affects day time sunny day = bad
float toobright = max(0,tex2D(_s2, _v0).xyz - 0.4); // 0.5
color.xyz *= 1-(1 * toobright); // 1.3

// <Lazy> HD6 - dopey arse code to alter enbpalette because im too lazy to open photoshop
// when using your own palette remove this.. ill fix this.. next
float palmix = 0.4; // 0.4
color.xyz*=lerp( 1.0, 0.90, palmix); // 0.9
// </Lazy>


//+++++++++++++++++++++++++++++
#if (POSTPROCESS==1)
grayadaptation=max(grayadaptation, 0.0);
grayadaptation=min(grayadaptation, 50.0);
color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV1+EAdaptationMinV1);//*tempF1.x

float cgray=dot(color.xyz, float3(0.27, 0.67, 0.06));
cgray=pow(cgray, EContrastV1);
float3 poweredcolor=pow(color.xyz, EColorSaturationV1);
float newgray=dot(poweredcolor.xyz, float3(0.27, 0.67, 0.06));
color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);

float3 luma=color.xyz;
float lumamax=300.0;
color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV1);
#endif
//+++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++
#if (POSTPROCESS==2)
grayadaptation=max(grayadaptation, 0.0);
grayadaptation=min(grayadaptation, 50.0);
color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV2+EAdaptationMinV2);//*tempF1.x

//color.xyz*=EBrightnessV2;
color.xyz+=0.000001;
float3 xncol=normalize(color.xyz);
float3 scl=color.xyz/xncol.xyz;
scl=pow(scl, EIntensityContrastV2);
xncol.xyz=pow(xncol.xyz, EColorSaturationV2);
color.xyz=scl*xncol.xyz;

float lumamax=EToneMappingOversaturationV2;
color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV2);
#endif
//+++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++ HD6 version based on postprocess 2
#if (POSTPROCESS==5)
grayadaptation=max(grayadaptation, 0.0);
grayadaptation=min(grayadaptation, 50.0);
//color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV2+EAdaptationMinV2); //*tempF1.x
// HD6 - Screw eye adaptation it drives me mad, bright sky causes everything else to darken yuck
// Human eye adaptation happens instantly or so slowly you dont notice it in reality
// it would make sense if the game was calibrated for true brightness values of indoors and outdoors being 10000x brighter
// but it isnt, and thus all the pseudo tone mapping and linear colorspace adaption shenanigans just drives me mad and for little gain
// So now simple adjust brightness based on time of day
// with all the other effects turned off this should roughly equal the brightness when ENB is disabled
color.xyz*=lerp( 3.1, 1.5, hnd );

//color.xyz*=EBrightnessV2;
//color.xyz+=0.000001; // HD6 - Why? how curious
float3 xncol=normalize(color.xyz);
float3 scl=color.xyz/xncol.xyz;
scl=pow(scl, EIntensityContrastV2);
xncol.xyz=pow(xncol.xyz, EColorSaturationV2);
color.xyz=scl*xncol.xyz;

//float lumamax=EToneMappingOversaturationV2;
//color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV2);

color.xyz=color.xyz/(color.xyz + EToneMappingCurveV2);
//color.xyz=tex2D(_s0, _v0.xy);
//color.xyz=color.xyz-0.03;
//color.xyz/=10;
#endif
//+++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++
#if (POSTPROCESS==3)
grayadaptation=max(grayadaptation, 0.0);
grayadaptation=min(grayadaptation, 50.0);
color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV3+EAdaptationMinV3); //*tempF1.x

//float3 luma=color.xyz;
//float lumamax=20.0;
float lumamax=EToneMappingOversaturationV3;
color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV3);
#endif
//+++++++++++++++++++++++++++++
//color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
//color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
//color.xyz*=0.7;

//+++++++++++++++++++++++++++++
#if (POSTPROCESS==4)
grayadaptation=max(grayadaptation, 0.0);
grayadaptation=min(grayadaptation, 50.0);
color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV4+EAdaptationMinV4);

float Y = dot(color.xyz, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
float V = dot(color.xyz, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;

Y=pow(Y, EBrightnessCurveV4);
Y=Y*EBrightnessMultiplierV4;
//Y=Y/(Y+EBrightnessToneMappingCurveV4);
//float desaturatefact=saturate(Y*Y*Y*1.7);
//U=lerp(U, 0.0, desaturatefact);
//V=lerp(V, 0.0, desaturatefact);
color.xyz=V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;

color.xyz=max(color.xyz, 0.0);
color.xyz=color.xyz/(color.xyz+EBrightnessToneMappingCurveV4);
#endif
//+++++++++++++++++++++++++++++



//+++++++++++++++++++++++++++++
//pallete texture (0.082+ version feature)
#ifdef E_CC_PALETTE


color.rgb=saturate(color.rgb);
float3 brightness=Adaptation.xyz; //tex2D(_s4, 0.5); //adaptation luminance
//brightness=saturate(brightness); //old version from ldr games
brightness=(brightness/(brightness+1.0));//new version
brightness=max(brightness.x, max(brightness.y, brightness.z));//new version
float3 palette;
float4 uvsrc=0.0;
uvsrc.y=brightness.r;
uvsrc.x=color.r;
palette.r=tex2Dlod(_s7, uvsrc).r;
uvsrc.x=color.g;
uvsrc.y=brightness.g;
palette.g=tex2Dlod(_s7, uvsrc).g;
uvsrc.x=color.b;
uvsrc.y=brightness.b;
palette.b=tex2Dlod(_s7, uvsrc).b;

color.rgb=lerp( color.rgb, palette.rgb, palmix );

//color.rgb=toobright;
#endif //E_CC_PALETTE
//+++++++++++++++++++++++++++++


/*
// HeliosDoubleSix cobbled code to Cap values above 0, not great as limits how black it can do say if it was pure red?!
// what is the lowest value out of r,g,b
float lowestvalue=min(min(color.x,color.y),color.z);
// work out lowest possible value to set RGB without going below 0 and without changing the RGB relative values ie shifting the color in the process
float3 lowestpossible=color.xyz-lowestvalue;
color.xyz=max(color.xyz,lowestpossible);
//color.r=max(color.r,lowestpossible.x);
//color.g=max(color.g,lowestpossible.y);
//color.b=max(color.b,lowestpossible.z);
*/

//color.xyz=saturate(xcolorbloom.xyz);
//color.xyz-=(pow(color.xyz, 6)/2);
//color.xyz=max(0,color.xyz);
//color.xyz=debug;

/*
//temporary testing
color.xyz=tex2D(_s0, _v0.xy);
//color.xyz=xcolorbloom.xyz*tempF1.x;

//color.xyz=pow(color.xyz, 0.5);
color.xyz+=(xcolorbloom.xyz-color.xyz)*tempF1.y;
//color.xyz=xcolorbloom.xyz*tempF1.y;
color.xyz=color.xyz*tempF1.x;
//color.xyz=color.xyz/(color.xyz +1.0*tempF1.z);
color.xyz=(color.xyz * (1.0 + color.xyz/40))/(color.xyz + EToneMappingCurveV3);
Adaptation=tex2D(_s4, 0.5);
grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
grayadaptation=max(grayadaptation, 0.0);
grayadaptation=min(grayadaptation, 50.0);
// color.xyz=Adaptation*2;//*tempF1.x

//color.xyz=tex2D(_s0, _v0.xy)*1.3;
*/

//color.xyz=tex2D(_s0, _v0.xy)*pow(tempF1.x,4);
//color.xyz=max(xcolorbloom.xyz, tex2D(_s0, _v0.xy).xyz)*pow(tempF1.x,4)*0.7;





_oC0.w=1.0;
_oC0.xyz=color.xyz;
//_oC0.xyz=debug;

// HD6 - debug triangle - draws a triangle top left showing the value of night/day for testing
//_oC0.xyz = _v0.x+_v0.y < 0.1 ? (hnd) : (_oC0.xyz);
float h11 = h1 == 1 ? 0 : 0.2;
_oC0.xyz += _v0.x+_v0.y < 0.003 ? (h11) : (0);
return _oC0;
}




//switch between vanilla and mine post processing
#ifndef ENB_FLIPTECHNIQUE
technique Shader_D6EC7DD1
#else
technique Shader_ORIGINALPOSTPROCESS
#endif
{
pass p0
{
VertexShader = compile vs_3_0 VS_Quad();
PixelShader = compile ps_3_0 PS_D6EC7DD1();

ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
ZEnable=FALSE;
ZWriteEnable=FALSE;
CullMode=NONE;
AlphaTestEnable=FALSE;
AlphaBlendEnable=FALSE;
SRGBWRITEENABLE=FALSE;
}
}


// HD6 - below doesnt make any diff??? so I disabled it *shrugs*
/*
//original shader of post processing
#ifndef ENB_FLIPTECHNIQUE
technique Shader_ORIGINALPOSTPROCESS
#else
technique Shader_D6EC7DD1
#endif
{
pass p0
{
VertexShader = compile vs_3_0 VS_Quad();
PixelShader=
asm
{
// Parameters:
// sampler2D Avg;
// sampler2D Blend;
// float4 Cinematic;
// float4 ColorRange;
// float4 Fade;
// sampler2D Image;
// float4 Param;
// float4 Tint;


// Registers:

// Name Reg Size
// ------------ ----- ----
// ColorRange c1 1
// Param c2 1
// Cinematic c3 1
// Tint c4 1
// Fade c5 1
// Image s0 1
// Blend s1 1
// Avg s2 1
//s0 bloom result
//s1 color
//s2 is average color

ps_3_0
def c6, 0, 0, 0, 0
//was c0 originally
def c7, 0.212500006, 0.715399981, 0.0720999986, 1
dcl_texcoord v0.xy
dcl_2d s0
dcl_2d s1
dcl_2d s2
rcp r0.x, c2.y
texld r1, v0, s2
mul r0.yz, r1.xxyw, c1.y
rcp r0.w, r0.y
mul r0.z, r0.w, r0.z
texld r1, v0, s1
mul r1.xyz, r1, c1.y
dp3 r0.w, c7, r1
mul r1.w, r0.w, r0.z
mad r0.z, r0.z, r0.w, c7.w
rcp r0.z, r0.z
mad r0.x, r1.w, r0.x, c7.w
mul r0.x, r0.x, r1.w
mul r0.x, r0.z, r0.x
cmp r0.x, -r0.w, c6.x, r0.x
rcp r0.z, r0.w
mul r0.z, r0.z, r0.x
add_sat r0.x, -r0.x, c2.x
texld r2, v0, s0
mul r2.xyz, r2, c1.y
mul r2.xyz, r0.x, r2
mad r1.xyz, r1, r0.z, r2
dp3 r0.x, r1, c7
mov r1.w, c7.w
lrp r2, c3.x, r1, r0.x
mad r1, r0.x, c4, -r2
mad r1, c4.w, r1, r2
mad r1, c3.w, r1, -r0.y
mad r0, c3.z, r1, r0.y
add r1, -r0, c5
mad oC0, c5.w, r1, r0

};
ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
ZEnable=FALSE;
ZWriteEnable=FALSE;
CullMode=NONE;
AlphaTestEnable=FALSE;
AlphaBlendEnable=FALSE;
SRGBWRITEENABLE=FALSE;
}
}
*/

enbeffectprepass.fx
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ENBSeries effect file
// visit http://enbdev.com for updates
// Copyright (c) 2007-2011 Boris Vorontsov
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

//+++++++++++++++++++++++++++++
// Internal parameters, can be modified
//+++++++++++++++++++++++++++++

//#define USE_MANUAL_APERTURE 1 // comment it to disable manual aperture size (focal distance)
//#define USE_MANUAL_BLUR_SCALE 1 // comment it to disable manual DOF blur scale
//#define USE_SWITCHABLE_MODE 1 // comment it to disable DOF switchable mode (switching between bokeh and gaussian)

float EBlurSamplingRange = 4.0;
float EApertureScale = 1.0; // Matso - base size of the manually changable aperture size (use keys to change the value of 'tempF1' to vary the actual aperture)

//+++++++++++++++++++++++++++++
// External parameters, do not modify
//+++++++++++++++++++++++++++++
// Keyboard controlled temporary variables (in some versions exists in the config file). Press and hold key 1,2,3...8 together with PageUp or PageDown to modify.
// By default all set to 1.0
float4 tempF1; //0,1,2,3
float4 tempF2; //5,6,7,8
float4 tempF3; //9,0
// x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
float4 ScreenSize;
// x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
float4 Timer;
// Adaptation delta time for focusing
float FadeFactor;

// textures
texture2D texColor;
texture2D texDepth;
texture2D texNoise;
texture2D texPalette;
texture2D texFocus; // computed focusing depth
texture2D texCurr; // 4*4 texture for focusing
texture2D texPrev; // 4*4 texture for focusing

sampler2D SamplerColor = sampler_state
{
Texture = <texColor>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = Mirror;
AddressV = Mirror;
SRGBTexture = FALSE;
MaxMipLevel = 9;
MipMapLodBias = 0;
};

sampler2D SamplerDepth = sampler_state
{
Texture = <texDepth>;
MinFilter = POINT;
MagFilter = POINT;
MipFilter = NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture = FALSE;
MaxMipLevel = 0;
MipMapLodBias = 0;
};

sampler2D SamplerNoise = sampler_state
{
Texture = <texNoise>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = Wrap;
AddressV = Wrap;
SRGBTexture = FALSE;
MaxMipLevel = 0;
MipMapLodBias = 0;
};

sampler2D SamplerPalette = sampler_state
{
Texture = <texPalette>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture = FALSE;
MaxMipLevel = 0;
MipMapLodBias = 0;
};

// for focus computation
sampler2D SamplerCurr = sampler_state
{
Texture = <texCurr>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture = FALSE;
MaxMipLevel = 0;
MipMapLodBias = 0;
};

// for focus computation
sampler2D SamplerPrev = sampler_state
{
Texture = <texPrev>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture = FALSE;
MaxMipLevel = 0;
MipMapLodBias = 0;
};
// for dof only in PostProcess techniques
sampler2D SamplerFocus = sampler_state
{
Texture = <texFocus>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = NONE;
AddressU = Clamp;
AddressV = Clamp;
SRGBTexture = FALSE;
MaxMipLevel = 0;
MipMapLodBias = 0;
};

struct VS_OUTPUT_POST
{
float4 vpos : POSITION;
float2 txcoord : TEXCOORD0;
};

struct VS_INPUT_POST
{
float3 pos : POSITION;
float2 txcoord : TEXCOORD0;
};

////////////////////////////////////////////////////////////////////
// Begin focusing (by Boris Vorontsov)
////////////////////////////////////////////////////////////////////
VS_OUTPUT_POST VS_Focus(VS_INPUT_POST IN)
{
VS_OUTPUT_POST OUT;

float4 pos = float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);

OUT.vpos = pos;
OUT.txcoord.xy = IN.txcoord.xy;

return OUT;
}

//SRCpass1X=ScreenWidth;
//SRCpass1Y=ScreenHeight;
//DESTpass2X=4;
//DESTpass2Y=4;
float4 PS_ReadFocus(VS_OUTPUT_POST IN) : COLOR
{
#ifndef USE_MANUAL_APERTURE
float res = tex2D(SamplerDepth, 0.5).x;
#else
float res = EApertureScale * tempF1.x;
#endif
return res;
}

//SRCpass1X=4;
//SRCpass1Y=4;
//DESTpass2X=4;
//DESTpass2Y=4;
float4 PS_WriteFocus(VS_OUTPUT_POST IN) : COLOR
{
float res = 0.0;
float curr = tex2D(SamplerCurr, 0.5).x;
float prev = tex2D(SamplerPrev, 0.5).x;

res = lerp(prev, curr, saturate(FadeFactor));// time elapsed factor
res = max(res, 0.0);

return res;
}

technique ReadFocus
{
pass P0
{
VertexShader = compile vs_3_0 VS_Focus();
PixelShader = compile ps_3_0 PS_ReadFocus();

ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}

technique WriteFocus
{
pass P0
{
VertexShader = compile vs_3_0 VS_Focus();
PixelShader = compile ps_3_0 PS_WriteFocus();

ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}
////////////////////////////////////////////////////////////////////
// End focusing code
////////////////////////////////////////////////////////////////////

/*------------------------------------------------------------------------------
ENB prepass modifications 4.0.0 by Matso
Credits to Boris Vorontsov
------------------------------------------------------------------------------*/
// Effects enabling options
#define ENABLE_DOF 1 // comment to disable depth of field
//#define ENABLE_CHROMA 1 // comment to disable chromatic aberration (additional chromatic aberration applied beyond depth of field)
//#define ENABLE_PREPASS 1 // comment to disable prepass effects
//#define ENABLE_POSTPASS 1 // comment to disable postpass effects

// Methods enabling options
//#define USE_CHROMA_DOF 1 // comment it to disable chromatic aberration sampling in DoF
#define USE_SMOOTH_DOF 1 // comment it to disable smooth DoF
//#define USE_BOKEH_DOF 1 // comment it to disable bokeh DoF
//#define USE_DOUBLE_BLUR 1 // comment it to disable additional blur
#define USE_SHARPENING 1 // comment it to disable sharpening
//#define USE_ANAMFLARE 1 // comment it to disable anamorphic lens flare
//#define USE_IMAGEGRAIN 1 // comment it to disable image grain
//#define USE_CLOSE_DOF_ONLY 1 // comment it to disable close-DoF-only effect

// Useful constants
#define SEED 1.0 //Timer.x
#define PI 3.1415926535897932384626433832795
#define CHROMA_POW 65.0 // the bigger the value, the more visible chomatic aberration effect in DoF

// DoF constants
#define DOF_SCALE 2356.1944901923449288469825374596 // PI * 750
// Set those below for diffrent blur shapes
#define FIRST_PASS 0 // only 0, 1, 2, or 3
#define SECOND_PASS 1 // only 0, 1, 2, or 3
#define THIRD_PASS 2 // only 0, 1, 2, or 3
#define FOURTH_PASS 3 // only 0, 1, 2, or 3

#ifndef USE_MANUAL_APERTURE
#define DOF(sd,sf) fBlurScale * smoothstep(fDofBias, fDofCutoff, abs(sd - sf))
#else
#define DOF(sd,sf) fBlurScale * smoothstep(fDofBias * tempF1.y, fDofCutoff * tempF1.z, abs(sd - sf))
#endif
//#define DOF(sd,sf) fBlurScale * pow(abs(sd - sf), 2.0) * 10.0
#define BOKEH_DOWNBLUR 0.3 // the default blur scale is too big for bokeh

// Bokeh flags
#define USE_NATURAL_BOKEH 1 // diffrent, more natural bokeh shape (comment to disable)
#define USE_BRIGHTNESS_LIMITING 1 // bokeh brightness limiting (comment to disable)
//#define USE_WEIGHT_CLAMP 1 // bokeh weight clamping (comment to disable)
#define USE_ENHANCED_BOKEH 1 // more pronounced bokeh blur (comment to disable)

// Chromatic aberration parameters
float3 fvChroma = float3(0.9995, 1.000, 1.0005);// displacement scales of red, green and blue respectively
#define fBaseRadius 0.9 // below this radius the effect is less visible
#define fFalloffRadius 1.8 // over this radius the effect is max
#define fChromaPower 10.0 // power of the chromatic displacement (curve of the 'fvChroma' vector)

// Sharpen parameters
#define fSharpScale 0.032 // intensity of sharpening
float2 fvTexelSize = float2(1.0 / 1920.0, 1.0 / 1080.0); // set your resolution sizes

// Depth of field parameters
#define fFocusBias 0.055 // bigger values for nearsightedness, smaller for farsightedness (lens focal point distance)
#define fDofCutoff 0.75 // manages the smoothness of the DoF (bigger value results in wider depth of field)
#define fDofBias 0.07 // distance not taken into account in DoF (all closer then the distance is in focus)
#define fBlurScale 0.002 // governs image blur scale (the bigger value, the stronger blur)
#define fBlurCutoff 0.50 // bluring tolerance depending on the pixel and sample depth (smaller causes objects edges to be preserved)
#define fCloseDofDistance 1.0 // only to this distance DoF will be applied
#define fStepScale 0.00018

// Bokeh parameters
#define fBokehCurve 5.0 // the larger the value, the more visible the bokeh effect is (not used with brightness limiting)
#define fBokehIntensity 0.95 // governs bokeh brightness (not used with brightness limiting)
#define fBokehConstant 0.1 // constant value of the bokeh weighting
#define fBokehMaxLevel 45.0 // bokeh max brightness level (scale factor for bokeh samples)
#define fBokehMin 0.001 // min input cutoff (anything below is 0)
#define fBokehMax 1.925 // max input cutoff (anything above is 1)
#define fBokehMaxWeight 25.0 // any weight above will be clamped

#define fBokehLuminance 0.956 // bright pass of the bokeh weight used with radiant version of the bokeh
#define BOKEH_RADIANT float3 bct = ct.rgb;float b = GrayScale(bct) + fBokehConstant + length(bct)
#define BOKEH_PASTEL float3 bct = BrightBokeh(ct.rgb);float b = dot(bct, bct) + fBokehConstant
#define BOKEH_VIBRANT float3 bct = BrightBokeh(ct.rgb);float b = GrayScale(ct.rgb) + dot(bct, bct) + fBokehConstant
#define BOKEH_FORMULA BOKEH_RADIANT //BOKEH_PASTEL // // choose one of the above

// Grain parameters
#define fGrainFreq 4000.0 // image grain frequency
#define fGrainScale 0.05 // grain effect scale

// Anamorphic flare parameters
#define fFlareLuminance 2.0 // bright pass luminance value
#define fFlareBlur 200.0 // manages the size of the flare
#define fFlareIntensity 0.07 // effect intensity

// Bokeh shape offset weights
#define DEFAULT_OFFSETS { -1.282, -0.524, 0.524, 1.282 }

// Sampling vectors
float offset[4] = DEFAULT_OFFSETS;
#ifndef USE_NATURAL_BOKEH
float2 tds[4] = { float2(1.0, 0.0), float2(0.0, 1.0), float2(0.707, 0.707), float2(-0.707, 0.707) };
#else
float2 tds[16] = {
float2(0.2007, 0.9796),
float2(-0.2007, 0.9796),
float2(0.2007, 0.9796),
float2(-0.2007, 0.9796),

float2(0.8240, 0.5665),
float2(0.5665, 0.8240),
float2(0.8240, 0.5665),
float2(0.5665, 0.8240),

float2(0.9796, 0.2007),
float2(0.9796, -0.2007),
float2(0.9796, 0.2007),
float2(0.9796, -0.2007),

float2(-0.8240, 0.5665),
float2(-0.5665, 0.8240),
float2(-0.8240, 0.5665),
float2(-0.5665, 0.8240)
}; // Natural bokeh sampling directions

float2 rnds[16] = {
float2(0.326212, 0.40581),
float2(0.840144, 0.07358),
float2(0.695914, 0.457137),
float2(0.203345, 0.620716),
float2(0.96234, 0.194983),
float2(0.473434, 0.480026),
float2(0.519456, 0.767022),
float2(0.185461, 0.893124),
float2(0.507431, 0.064425),
float2(0.89642, 0.412458),
float2(0.32194, 0.932615),
float2(0.791559, 0.59771),
float2(0.979602, 0.10275),
float2(0.56653, 0.82401),
float2(0.20071, 0.97966),
float2(0.98719, 0.12231)
};
#endif

// External parameters (Help needed - how to pass a game parameter value to the shader?)
extern float fWaterLevel = 1.0; // DO NOT CHANGE - must be 1.0 for now! (under water will be set to lower value)

/**
* Chromatic aberration function - given texture coordinate and a focus value
* retrieves chromatically distorted color of the pixel. Each of the color
* channels are displaced according to the pixel coordinate and its distance
* from the center of the image. Also the DoF out-of-focus value is applied.
* (http://en.wikipedia.org/wiki/Chromatic_aberration)
*/
float4 ChromaticAberration(float2 tex)
{
float d = distance(tex, float2(0.5, 0.5));
float f = smoothstep(fBaseRadius, fFalloffRadius, d);
float3 chroma = pow(f + fvChroma, fChromaPower);

float2 tr = ((2.0 * tex - 1.0) * chroma.r) * 0.5 + 0.5;
float2 tg = ((2.0 * tex - 1.0) * chroma.g) * 0.5 + 0.5;
float2 tb = ((2.0 * tex - 1.0) * chroma.b) * 0.5 + 0.5;

float3 color = float3(tex2D(SamplerColor, tr).r, tex2D(SamplerColor, tg).g, tex2D(SamplerColor, tb).b) * (1.0 - f);

return float4(color, 1.0);
}

/**
* Chromatic aberration done accoriding to the focus factor provided.
*/
float4 ChromaticAberration(float2 tex, float outOfFocus)
{
float d = distance(tex, float2(0.5, 0.5));
float f = smoothstep(fBaseRadius, fFalloffRadius, d);
float3 chroma = pow(f + fvChroma, CHROMA_POW * outOfFocus * fChromaPower);

float2 tr = ((2.0 * tex - 1.0) * chroma.r) * 0.5 + 0.5;
float2 tg = ((2.0 * tex - 1.0) * chroma.g) * 0.5 + 0.5;
float2 tb = ((2.0 * tex - 1.0) * chroma.b) * 0.5 + 0.5;

float3 color = float3(tex2D(SamplerColor, tr).r, tex2D(SamplerColor, tg).g, tex2D(SamplerColor, tb).b) * (1.0 - outOfFocus);

return float4(color, 1.0);
}

/**
* Pseudo-random number generator - returns a number generated according to the provided vector.
*/
float Random(float2 co)
{
return frac(sin(dot(co.xy, float2(12.9898, 78.233))) * 43758.5453);
}


float2 Random2(float2 coord)
{
float noiseX = ((frac(1.0-coord.x*(1920.0/2.0))*0.25)+(frac(coord.y*(1080.0/2.0))*0.75))*2.0-1.0;
float noiseY = ((frac(1.0-coord.x*(1920.0/2.0))*0.75)+(frac(coord.y*(1080.0/2.0))*0.25))*2.0-1.0;

noiseX = clamp(frac(sin(dot(coord ,float2(12.9898,78.233))) * 43758.5453),0.0,1.0)*2.0-1.0;
noiseY = clamp(frac(sin(dot(coord ,float2(12.9898,78.233)*2.0)) * 43758.5453),0.0,1.0)*2.0-1.0;

return float2(noiseX, noiseY);
}

/**
* Movie grain function - returns a random, time scaled value for the given pixel coordinate.
*/
float Grain(float3 tex)
{
float r = Random(tex.xy);
float grain = sin(PI * tex.z * r * fGrainFreq) * fGrainScale * r;
return grain;
}

/**
* Bright pass - rescales sampled pixel to emboss bright enough value.
*/
float3 BrightPass(float2 tex)
{
float3 c = tex2D(SamplerColor, tex).rgb;
float3 bC = max(c - float3(fFlareLuminance, fFlareLuminance, fFlareLuminance), 0.0);
float bright = dot(bC, 1.0);
bright = smoothstep(0.0f, 0.5, bright);
return lerp(0.0, c, bright);
}

/**
* Bright pass - rescales given color to emboss bright enough value.
*/
float3 BrightColor(float3 c)
{
float3 bC = max(c - float3(fFlareLuminance, fFlareLuminance, fFlareLuminance), 0.0);
float bright = dot(bC, 1.0);
bright = smoothstep(0.0f, 0.5, bright);
return lerp(0.0, c, bright);
}

float3 BrightBokeh(float3 c)
{
float3 bC = max(c - float3(fBokehLuminance, fBokehLuminance, fBokehLuminance), 0.0);
float bright = dot(bC, 1.0);
bright = smoothstep(0.0f, 0.5, bright);
return lerp(0.0, c, bright);
}

/**
* Anamorphic sampling function - scales pixel coordinate
* to stratch the image along one of the axels.
* (http://en.wikipedia.org/wiki/Anamorphosis)
*/
float3 AnamorphicSample(int axis, float2 tex, float blur)
{
tex = 2.0 * tex - 1.0;
if (!axis) tex.x /= -blur;
else tex.y /= -blur;
tex = 0.5 * tex + 0.5;
return BrightPass(tex);
}

/**
* Converts pixel color to gray-scale.
*/
float GrayScale(float3 sample)
{
return dot(sample, float3(0.3, 0.59, 0.11));
}

/**
* Returns an under water distortion according to the given coordinate and time factor. [WIP]
*/
float2 UnderWaterDistortion(float2 coord)
{
if (fWaterLevel > 1.0) {
float2 tap = tex2D(SamplerNoise, coord.xy * 2.0).rg; // add 'fWaveFreq'
float2 dist = normalize(coord - tap) * smoothstep(0.0, 1.0, distance(coord, tap) * 0.05); // add 'fWaveScale'
float scale = smoothstep(0.0, 6.0, distance(coord, float2(0.5, 0.5))) * 0.99 + 0.96; // add 'fFishEyeScale' and 'fFishEyeBias'

coord += dist;
coord = ((2.0 * coord - 1.0) * scale) * 0.5 + 0.5;
}
return coord;
}

///// Shaders ////////////////////////////////////////////////////////////////////////////////
// Vertex shader (Boris code)
VS_OUTPUT_POST VS_PostProcess(VS_INPUT_POST IN)
{
VS_OUTPUT_POST OUT;

float4 pos = float4(IN.pos.x, IN.pos.y, IN.pos.z, 1.0);

OUT.vpos = pos;
OUT.txcoord.xy = IN.txcoord.xy;

return OUT;
}

// Sharpen pixel shader (Matso code)
float4 PS_ProcessPass_Sharpen(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{
float2 coord = IN.txcoord.xy;
float4 Color = 9.0 * tex2D(SamplerColor, coord.xy);

Color -= tex2D(SamplerColor, coord.xy + float2(-fvTexelSize.x, fvTexelSize.y) * fSharpScale);
Color -= tex2D(SamplerColor, coord.xy + float2(0.0, fvTexelSize.y) * fSharpScale);
Color -= tex2D(SamplerColor, coord.xy + float2(fvTexelSize.x, fvTexelSize.y) * fSharpScale);
Color -= tex2D(SamplerColor, coord.xy + float2(fvTexelSize.x, 0.0) * fSharpScale);
Color -= tex2D(SamplerColor, coord.xy + float2(fvTexelSize.x, -fvTexelSize.y) * fSharpScale);
Color -= tex2D(SamplerColor, coord.xy + float2(0.0, -fvTexelSize.y) * fSharpScale);
Color -= tex2D(SamplerColor, coord.xy + float2(-fvTexelSize.x, -fvTexelSize.y) * fSharpScale);
Color -= tex2D(SamplerColor, coord.xy + float2(-fvTexelSize.x, 0.0) * fSharpScale);

Color.a = 1.0;
return Color;
}

// Anamorphic lens flare pixel shader (Matso code)
float4 PS_ProcessPass_Anamorphic(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{
float4 res;
float2 coord = IN.txcoord.xy;
float3 anamFlare = AnamorphicSample(0, coord.xy, fFlareBlur) * float3(0.0, 0.0, 1.0);

res.rgb = anamFlare * fFlareIntensity;
res.a = 1.0;

#if !defined(USE_SHARPENING)
res.rgb += tex2D(SamplerColor, coord.xy).rgb;
#endif

return res;
}

// Image grain pixel shader (Matso code)
float4 PS_ProcessPass_ImageGrain(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{
float4 res;
float2 coord = IN.txcoord.xy;
res.rgb = tex2D(SamplerColor, coord.xy).rgb;
res.rgb += tex2D(SamplerNoise, coord.xy * 1024).rgb * Grain(float3(coord.xy, SEED));
res.a = 1.0;
return res;
}

// Simple pass through shader (Matso code)
float4 PS_ProcessPass_None(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{
float4 res;
float2 coord = IN.txcoord.xy;
res.rgb = tex2D(SamplerColor, coord.xy).rgb;
res.a = 1.0;
return res;
}

// Depth of field pixel shader (Matso code)
float4 PS_ProcessPass_DepthOfField(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform int axis) : COLOR
{
float4 res;
float2 base = IN.txcoord.xy;
float4 tcol = tex2D(SamplerColor, base.xy);
float sd = tex2D(SamplerDepth, base).x; // acquire scene depth for the pixel
res = tcol;

#ifndef USE_SMOOTH_DOF // sample focus value
float sf = tex2D(SamplerDepth, 0.5).x - fFocusBias * fWaterLevel;
#else
float sf = tex2D(SamplerFocus, 0.5).x - fFocusBias * 2.0 * fWaterLevel;
#endif
float outOfFocus = DOF(sd, sf);
float blur = DOF_SCALE * outOfFocus;
float wValue = 1.0;

#ifdef USE_MANUAL_BLUR_SCALE
blur *= tempF1.w;
#endif

#ifndef USE_CLOSE_DOF_ONLY
#ifdef USE_BOKEH_DOF
blur *= BOKEH_DOWNBLUR; // should bokeh be used, decrease blur a bit
#endif
#else
blur *= (smoothstep(fCloseDofDistance, 0.0, sf) * 2.0);
if (blur > 0.001)
#endif

for (int i = 0; i < 4; i++)
{
#ifndef USE_NATURAL_BOKEH
float2 tdir = tds[axis] * fvTexelSize * blur * offset;
#else
float2 tdir = tds[axis * 4 + i] * fvTexelSize * blur * offset;
#endif

float2 coord = base + tdir.xy;
#ifdef USE_CHROMA_DOF
float4 ct = ChromaticAberration(coord, outOfFocus); // chromatic aberration sampling
#else
float4 ct = tex2D(SamplerColor, coord);
#endif
float sds = tex2D(SamplerDepth, coord).x;

if ((abs(sds - sd) / sd) <= fBlurCutoff) { // blur 'bleeding' control
#ifndef USE_BOKEH_DOF
float w = 1.0 + abs(offset); // weight blur for better effect
#else
#if USE_BOKEH_DOF == 1
BOKEH_FORMULA;
#ifndef USE_BRIGHTNESS_LIMITING // all samples above max input will be limited to max level
float w = pow(b * fBokehIntensity, fBokehCurve);
#else
#ifdef USE_ENHANCED_BOKEH
float w = smoothstep(fBokehMin, fBokehMax, b * b) * fBokehMaxLevel;
#else
float w = smoothstep(fBokehMin, fBokehMax, b) * fBokehMaxLevel;
#endif
#endif
#ifdef USE_WEIGHT_CLAMP
w = min(w, fBokehMaxWeight);
#endif
w += abs(offset) + blur;
#endif
#ifdef USE_SWITCHABLE_MODE
float w = 1.0 + abs(offset);

if (tempF2.z > 0.99f) {
BOKEH_FORMULA;
w += smoothstep(fBokehMin, fBokehMax, b * b) * fBokehMaxLevel + blur;
}
#endif
#endif
tcol += ct * w;
wValue += w;
}
}

tcol /= wValue;

res.rgb = tcol.rgb;
res.w = 1.0;
return res;
}

// Chromatic abrration with no DoF (Matso code)
float4 PS_ProcessPass_Chroma(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{
float2 coord = IN.txcoord.xy;
float4 result = ChromaticAberration(coord.xy);
result.a = 1.0;
return result;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifdef ENABLE_PREPASS
technique PostProcess
{
#ifdef USE_SHARPENING
pass P0
{
VertexShader = compile vs_3_0 VS_PostProcess();
PixelShader = compile ps_3_0 PS_ProcessPass_Sharpen();

DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
#endif
#ifdef USE_ANAMFLARE
pass P1
{
#if defined(USE_SHARPENING)
AlphaBlendEnable = true;
SrcBlend = One;
DestBlend = One;

PixelShader = compile ps_3_0 PS_ProcessPass_Anamorphic();
#else

VertexShader = compile vs_3_0 VS_PostProcess();
PixelShader = compile ps_3_0 PS_ProcessPass_Anamorphic();

DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
#endif
}
#endif
}
#endif

#ifndef ENABLE_DOF
#ifdef ENABLE_CHROMA
#ifndef ENABLE_PREPASS
technique PostProcess
#else
technique PostProcess2
#endif
{
pass P0
{
VertexShader = compile vs_3_0 VS_PostProcess();
PixelShader = compile ps_3_0 PS_ProcessPass_Chroma();

DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}
#endif
#endif

#ifndef ENABLE_CHROMA
#ifdef ENABLE_DOF
#ifndef ENABLE_PREPASS
technique PostProcess
#else
technique PostProcess2
#endif
{
pass P0
{
VertexShader = compile vs_3_0 VS_PostProcess();
PixelShader = compile ps_3_0 PS_ProcessPass_DepthOfField(FIRST_PASS);

DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}

#ifndef ENABLE_PREPASS
technique PostProcess2
#else
technique PostProcess3
#endif
{
pass P0
{
VertexShader = compile vs_3_0 VS_PostProcess();
PixelShader = compile ps_3_0 PS_ProcessPass_DepthOfField(SECOND_PASS);

DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}

#ifndef ENABLE_PREPASS
technique PostProcess3
#else
technique PostProcess4
#endif
{
pass P0
{
VertexShader = compile vs_3_0 VS_PostProcess();
PixelShader = compile ps_3_0 PS_ProcessPass_DepthOfField(THIRD_PASS);

DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}

#ifndef ENABLE_PREPASS
technique PostProcess4
#else
technique PostProcess5
#endif
{
pass P0
{
VertexShader = compile vs_3_0 VS_PostProcess();
PixelShader = compile ps_3_0 PS_ProcessPass_DepthOfField(FOURTH_PASS);

DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}
#endif
#endif

#ifdef ENABLE_POSTPASS
#ifndef ENABLE_PREPASS
technique PostProcess5
#else
technique PostProcess6
#endif
{
#ifdef USE_IMAGEGRAIN
pass P0
{
VertexShader = compile vs_3_0 VS_PostProcess();
PixelShader = compile ps_3_0 PS_ProcessPass_ImageGrain();

DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
#endif
}
#endif


palette
http://www.abload.de/img/enbpalette4ojmn.png
 
Zuletzt bearbeitet:
Hab dir ne PM geschickt...

Diese d3d9.dll fehlt da ja noch, welche muss ich da nehmen?

Und - muss ich an den Skyrim.inis was verändern?
 
Zuletzt bearbeitet:
Super, gleichmal testen. Danke nochmal!

*edit*

Ich glaube die ist mir zu "grün", da kommt ja fast Tropenfeeling auf. :)

Und Nachts ist es in Flusswald ja fast taghell. :fresse:

Ne, ich glaube die ist nichts für mich...

*edit2*

Nun habe ich eine gefunden, die mir gut gefällt. Project ENB at Skyrim Nexus

Habe die "Cinematic" Variante mit dunklen Nächten und Höhlen, sowie die Variante mit SSAO gewählt. Scheint auch speziell für Climates of Tamriel zu sein...
 
Zuletzt bearbeitet:
s6iukjc.jpg

s5gikwf.jpg

s4u0jom.jpg

s394khx.jpg

s2iujsj.jpg

s1fekdm.jpg
 
aber nicht sie 120 beta - da scheint es noch diverse probs zu geben
 
so ich hab meine enb :) - unbleak + climates of tamriel ...

wie man an dem bild in der nacht sieht, sehr realistisch und wenn man eben kein licht hat in der nacht, isses eben dunkel wie im bärenarsch :d

hier mal mein nord in riverwood ... die wolken O_O

unbl2osyuh.jpg


und hier nochmla vor alvor dem schmied ...

wie man sieht greift das settings + ssao echt gut ... da wo ein vordach ist, ist es dunkel drunter, aussen im freien ist alles mit sonne erhellt :)

unbl1uzyuf.jpg
 
sieht echt geil aus!

wieviel fps haste (und welche graka)?

jetzt speziell bei den bildern (renne zum testen auch immer in riverwood rum kann es dann besser vergleichen)
 
- meist 30-45 fps
- wenns richtig haarig wird sinds aber immernoch 25fps!
-> Intel i3 2120 + GTX 660 Ti ...

ich denke ein quadcore würde da einiges reissen, aber ist mein kleiner leiser htpc :P

das ding is halt ... aufm va panel ist schwarz wirklich schwarz usw. ... aufm normalen tn siehts net sooo gut aus ...

prinzipiell seht ihr ja nur die bilder mit euren monitor settings ...

wenn ich aber so die meisten screens und enb settings sehe, dann weiß ich, dass weder ein gescheiter monitor aufm tisch steht, noch kalibriert wurde ...
 
Zuletzt bearbeitet:
ich habe ne 560 ti und habe genau bei den beiden szenen 24-25 fps ^^


186pbn.jpg


22toi3.jpg


und ich hab schon AA off

hab selber nen ips ist schon besser als tn panel.

aber in de realität gibt es ganz schwarz nicht soo oft.

Solange nachts ein mond vorhanden ist müsste man auch was sehen können

so eine Nacht gefällt mir nicht so sehr. viel zu bunt. Nachts und je dunkler es wird desto weniger Farben nimmt das menschliche AUge wahr. das sollte im SPiel abgebildet werden da uns der Monitor ja anstrahlt.
mit bunt meine ich zum beispiel grünes gras (das sieht man jetzt nich so auf dem bild)

38cpto.jpg


das hier ist die Nacht deines ENBs ohne Climates of Tamriel

4qxue9.jpg


aber tagsüber siehts mit dem anderen und seinem bloom dafür besser aus als das hier:

5z5uon.jpg


bloom verdeckt einfach viel wie die distance bäume etc. das braucht skyrim

bleak ist mit der ausleuchtung besser. dafür sind die farben nix

 
Zuletzt bearbeitet:
naja ... man kann bloom ja rausnehmen oder dof ... ich lass beides drin :d ich geb nix auf die distance, da ich eh immer mit den nächsten 50 m ingame beschäftigt bin ...
 
mhm ich arbeite gerade am skylightning ... mhm

dawn114ucb.jpg


was zur :d nanana die herrschaften!
 
Zuletzt bearbeitet von einem Moderator:
ich sage nur es gibt mods die machen die akteure nackt, den herrn mit angefülltem Schwellkörper und dann gehts per idle animationen zur sache - auch dreier gehen...

geräusche auch dabei.. ein kompletter dreh o_O

dass das bei dir zufall ist seh ich doch auch ^^ - wollte es nur gesagt haben was man so on the wrong side of the internet so alles finden kann. bin da auch eher mehr oder weniger zufällig draufgestossen.

--

aber sag bloss du bist immer noch am anfang ^^ haha

zuviel modden zu wenig spielen was? :)

lies dir das buch auf dem tisch gut durch!
 
Zuletzt bearbeitet:
ich hab skyrim schonmal durchgespielt komplett ohne mods ...

hab 210 stunden spielzeit und hab da noch net wirklich viel erkundet! deshalb zock ich jetzt mal nen sehr sauberen khajit dieb hoch :) ... enb hat erstmal 2-3 stunden gedauert mitm einstellen ...

btw.: unbleak am besten mit deaktivierten DoF verwenden ... macht mehr spaß ... und bloß die finger von dem mod "terrain bump" lassen ... wurde einem update unterzogen ... viel texturen haben nun zuviel bump =/ und lässt die fps massiv droppen -.-
 
Zuletzt bearbeitet:
stells auf schwerste spielstufe und besorg dir nen realismus mod :P ...

sowas wie " ich muss essen, trinken, schlafen, mich am feuer wärmen " ... da gabs einen... ich komm aber gerade ni aufn namen ... kann ja morgen nachmittag mal danach schauen
 
Hardwareluxx setzt keine externen Werbe- und Tracking-Cookies ein. Auf unserer Webseite finden Sie nur noch Cookies nach berechtigtem Interesse (Art. 6 Abs. 1 Satz 1 lit. f DSGVO) oder eigene funktionelle Cookies. Durch die Nutzung unserer Webseite erklären Sie sich damit einverstanden, dass wir diese Cookies setzen. Mehr Informationen und Möglichkeiten zur Einstellung unserer Cookies finden Sie in unserer Datenschutzerklärung.


Zurück
Oben Unten refresh