MariENB FO4 3.2.7b
This commit is contained in:
parent
8fa0d0eb97
commit
d4df9ee642
23 changed files with 1190 additions and 1304 deletions
|
|
@ -86,118 +86,303 @@ float nj
|
|||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {2.0};
|
||||
/* tone mapping */
|
||||
string str_tonemap = "Filmic Tone Mapping";
|
||||
bool tmapenable
|
||||
bool nbt
|
||||
<
|
||||
string UIName = "Enable Tonemapping";
|
||||
string UIName = "Apply Grain Before Tone Mapping";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {true};
|
||||
/* eye adaptation */
|
||||
string str_adaptation = "Eye Adaptation";
|
||||
bool aenable
|
||||
<
|
||||
string UIName = "Enable Adaptation";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {false};
|
||||
/* tone mapping */
|
||||
string str_tonemap = "Tone Mapping";
|
||||
/*
|
||||
algorithms:
|
||||
-1 : Disabled
|
||||
0 : Vanilla
|
||||
1 : Linear
|
||||
2 : Reinhard
|
||||
3 : Uncharted 2
|
||||
4 : Hejl Dawson
|
||||
5 : Haarm-Peter Duiker
|
||||
6 : SweetFX
|
||||
*/
|
||||
int tmapenable
|
||||
<
|
||||
string UIName = "Tonemapping Method";
|
||||
string UIWidget = "Spinner";
|
||||
int UIMin = -1;
|
||||
int UIMax = 6;
|
||||
> = {3};
|
||||
float tmapexposure_n
|
||||
<
|
||||
string UIName = "Tonemap Exposure Night";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.0};
|
||||
float tmapexposure_d
|
||||
<
|
||||
string UIName = "Tonemap Exposure Day";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.0};
|
||||
float tmapexposure_i
|
||||
<
|
||||
string UIName = "Tonemap Exposure Interior";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.0};
|
||||
float tmapblend_n
|
||||
<
|
||||
string UIName = "Tonemap Blend Night";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {1.0};
|
||||
float tmapblend_d
|
||||
<
|
||||
string UIName = "Tonemap Blend Day";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {1.0};
|
||||
float tmapblend_i
|
||||
<
|
||||
string UIName = "Tonemap Blend Interior";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {1.0};
|
||||
float unA_n
|
||||
<
|
||||
string UIName = "Tonemap Shoulder Strength Night";
|
||||
string UIName = "Uncharted2 Shoulder Strength Night";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.5};
|
||||
float unA_d
|
||||
<
|
||||
string UIName = "Tonemap Shoulder Strength Day";
|
||||
string UIName = "Uncharted2 Shoulder Strength Day";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.5};
|
||||
float unA_i
|
||||
<
|
||||
string UIName = "Tonemap Shoulder Strength Interior";
|
||||
string UIName = "Uncharted2 Shoulder Strength Interior";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.5};
|
||||
float unB_n
|
||||
<
|
||||
string UIName = "Tonemap Linear Strength Night";
|
||||
string UIName = "Uncharted2 Linear Strength Night";
|
||||
string UIWidget = "Spinner";
|
||||
> = {1.0};
|
||||
float unB_d
|
||||
<
|
||||
string UIName = "Tonemap Linear Strength Day";
|
||||
string UIName = "Uncharted2 Linear Strength Day";
|
||||
string UIWidget = "Spinner";
|
||||
> = {1.0};
|
||||
float unB_i
|
||||
<
|
||||
string UIName = "Tonemap Linear Strength Interior";
|
||||
string UIName = "Uncharted2 Linear Strength Interior";
|
||||
string UIWidget = "Spinner";
|
||||
> = {1.0};
|
||||
float unC_n
|
||||
<
|
||||
string UIName = "Tonemap Linear Angle Night";
|
||||
string UIName = "Uncharted2 Linear Angle Night";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.2};
|
||||
float unC_d
|
||||
<
|
||||
string UIName = "Tonemap Linear Angle Day";
|
||||
string UIName = "Uncharted2 Linear Angle Day";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.2};
|
||||
float unC_i
|
||||
<
|
||||
string UIName = "Tonemap Linear Angle Interior";
|
||||
string UIName = "Uncharted2 Linear Angle Interior";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.2};
|
||||
float unD_n
|
||||
<
|
||||
string UIName = "Tonemap Toe Strength Night";
|
||||
string UIName = "Uncharted2 Toe Strength Night";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.75};
|
||||
float unD_d
|
||||
<
|
||||
string UIName = "Tonemap Toe Strength Day";
|
||||
string UIName = "Uncharted2 Toe Strength Day";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.75};
|
||||
float unD_i
|
||||
<
|
||||
string UIName = "Tonemap Toe Strength Interior";
|
||||
string UIName = "Uncharted2 Toe Strength Interior";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.75};
|
||||
float unE_n
|
||||
<
|
||||
string UIName = "Tonemap Toe Numerator Night";
|
||||
string UIName = "Uncharted2 Toe Numerator Night";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.02};
|
||||
float unE_d
|
||||
<
|
||||
string UIName = "Tonemap Toe Numerator Day";
|
||||
string UIName = "Uncharted2 Toe Numerator Day";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.02};
|
||||
float unE_i
|
||||
<
|
||||
string UIName = "Tonemap Toe Numerator Interior";
|
||||
string UIName = "Uncharted2 Toe Numerator Interior";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.02};
|
||||
float unF_n
|
||||
<
|
||||
string UIName = "Tonemap Toe Denominator Night";
|
||||
string UIName = "Uncharted2 Toe Denominator Night";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.30};
|
||||
float unF_d
|
||||
<
|
||||
string UIName = "Tonemap Toe Denominator Day";
|
||||
string UIName = "Uncharted2 Toe Denominator Day";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.30};
|
||||
float unF_i
|
||||
<
|
||||
string UIName = "Tonemap Toe Denominator Interior";
|
||||
string UIName = "Uncharted2 Toe Denominator Interior";
|
||||
string UIWidget = "Spinner";
|
||||
> = {0.30};
|
||||
float unW_n
|
||||
<
|
||||
string UIName = "Tonemap Linear White Night";
|
||||
string UIName = "Uncharted2 Linear White Night";
|
||||
string UIWidget = "Spinner";
|
||||
> = {10.0};
|
||||
float unW_d
|
||||
<
|
||||
string UIName = "Tonemap Linear White Day";
|
||||
string UIName = "Uncharted2 Linear White Day";
|
||||
string UIWidget = "Spinner";
|
||||
> = {10.0};
|
||||
float unW_i
|
||||
<
|
||||
string UIName = "Tonemap Linear White Interior";
|
||||
string UIName = "Uncharted2 Linear White Interior";
|
||||
string UIWidget = "Spinner";
|
||||
> = {10.0};
|
||||
float sfxgamma_n
|
||||
<
|
||||
string UIName = "SweetFX Gamma Night";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 2.0;
|
||||
> = {1.0};
|
||||
float sfxgamma_d
|
||||
<
|
||||
string UIName = "SweetFX Gamma Day";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 2.0;
|
||||
> = {1.0};
|
||||
float sfxgamma_i
|
||||
<
|
||||
string UIName = "SweetFX Gamma Interior";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 2.0;
|
||||
> = {1.0};
|
||||
float sfxexposure_n
|
||||
<
|
||||
string UIName = "SweetFX Exposure Night";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = -1.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxexposure_d
|
||||
<
|
||||
string UIName = "SweetFX Exposure Day";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = -1.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxexposure_i
|
||||
<
|
||||
string UIName = "SweetFX Exposure Interior";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = -1.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxsaturation_n
|
||||
<
|
||||
string UIName = "SweetFX Saturation Night";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = -1.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxsaturation_d
|
||||
<
|
||||
string UIName = "SweetFX Saturation Day";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = -1.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxsaturation_i
|
||||
<
|
||||
string UIName = "SweetFX Saturation Interior";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = -1.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxbleach_n
|
||||
<
|
||||
string UIName = "SweetFX Bleach Night";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxbleach_d
|
||||
<
|
||||
string UIName = "SweetFX Bleach Day";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxbleach_i
|
||||
<
|
||||
string UIName = "SweetFX Bleach Interior";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxdefog_n
|
||||
<
|
||||
string UIName = "SweetFX Defog Night";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxdefog_d
|
||||
<
|
||||
string UIName = "SweetFX Defog Day";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float sfxdefog_i
|
||||
<
|
||||
string UIName = "SweetFX Defog Interior";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {0.0};
|
||||
float3 sfxfogcolor_n
|
||||
<
|
||||
string UIName = "SweetFX Defog Color Night";
|
||||
string UIWidget = "Color";
|
||||
> = {0.0,0.0,1.0};
|
||||
float3 sfxfogcolor_d
|
||||
<
|
||||
string UIName = "SweetFX Defog Color Day";
|
||||
string UIWidget = "Color";
|
||||
> = {0.0,0.0,1.0};
|
||||
float3 sfxfogcolor_i
|
||||
<
|
||||
string UIName = "SweetFX Defog Color Interior";
|
||||
string UIWidget = "Color";
|
||||
> = {0.0,0.0,1.0};
|
||||
|
||||
/* Color grading */
|
||||
string str_grade = "Color Grading Suite";
|
||||
bool gradeenable1
|
||||
|
|
@ -372,9 +557,23 @@ float lutblend_i
|
|||
string UIWidget = "Spinner";
|
||||
> = {1.0};
|
||||
#ifdef LUTMODE_LEGACY
|
||||
int clut
|
||||
int clut_n
|
||||
<
|
||||
string UIName = "LUT Preset";
|
||||
string UIName = "LUT Preset Night";
|
||||
string UIWidget = "Spinner";
|
||||
int UIMin = 0;
|
||||
int UIMax = 63;
|
||||
> = {1};
|
||||
int clut_d
|
||||
<
|
||||
string UIName = "LUT Preset Day";
|
||||
string UIWidget = "Spinner";
|
||||
int UIMin = 0;
|
||||
int UIMax = 63;
|
||||
> = {1};
|
||||
int clut_i
|
||||
<
|
||||
string UIName = "LUT Preset Interior";
|
||||
string UIWidget = "Spinner";
|
||||
int UIMin = 0;
|
||||
int UIMax = 63;
|
||||
|
|
@ -394,19 +593,58 @@ float techblend
|
|||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {1.0};
|
||||
string str_dither = "Dithering";
|
||||
bool dodither
|
||||
/* vanilla */
|
||||
string str_vanilla = "Vanilla Processing";
|
||||
bool vgradeenable
|
||||
<
|
||||
string UIName = "Enable Post Dither";
|
||||
string UIName = "Enable Vanilla Imagespace";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {true};
|
||||
int dither
|
||||
float vtintpow
|
||||
<
|
||||
string UIName = "Dither Pattern";
|
||||
string UIName = "Vanilla Tint Contrast";
|
||||
string UIWidget = "Spinner";
|
||||
int UIMin = 0;
|
||||
int UIMax = 4;
|
||||
> = {4};
|
||||
float UIMin = 0.0;
|
||||
> = {1.0};
|
||||
float vtintmul
|
||||
<
|
||||
string UIName = "Vanilla Tint Strength";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.0};
|
||||
float vtintblend
|
||||
<
|
||||
string UIName = "Vanilla Tint Blend";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {1.0};
|
||||
float vsatpow
|
||||
<
|
||||
string UIName = "Vanilla Vibrance Contrast";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.0};
|
||||
float vsatmul
|
||||
<
|
||||
string UIName = "Vanilla Vibrance Strength";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.0};
|
||||
float vsatblend
|
||||
<
|
||||
string UIName = "Vanilla Vibrance Blend";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {1.0};
|
||||
float vconblend
|
||||
<
|
||||
string UIName = "Vanilla Contrast Blend";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
float UIMax = 1.0;
|
||||
> = {1.0};
|
||||
string str_debug = "Debugging";
|
||||
bool bloomdebug
|
||||
<
|
||||
|
|
@ -419,53 +657,6 @@ bool adaptdebug
|
|||
string UIWidget = "Checkbox";
|
||||
> = {false};
|
||||
|
||||
/*
|
||||
dithering threshold maps
|
||||
don't touch unless you know what you're doing
|
||||
*/
|
||||
static const float checkers[4] =
|
||||
{
|
||||
1.0,0.0,
|
||||
0.0,1.0
|
||||
};
|
||||
#define d(x) x/4.0
|
||||
static const float ordered2[4] =
|
||||
{
|
||||
d(0),d(2),
|
||||
d(4),d(2)
|
||||
};
|
||||
#undef d
|
||||
#define d(x) x/9.0
|
||||
static const float ordered3[9] =
|
||||
{
|
||||
d(2),d(6),d(3),
|
||||
d(5),d(0),d(8),
|
||||
d(1),d(7),d(4)
|
||||
};
|
||||
#undef d
|
||||
#define d(x) x/16.0
|
||||
static const float ordered4[16] =
|
||||
{
|
||||
d( 0),d( 8),d( 2),d(10),
|
||||
d(12),d( 4),d(14),d( 6),
|
||||
d( 3),d(11),d( 1),d( 9),
|
||||
d(15),d( 7),d(13),d( 5)
|
||||
};
|
||||
#undef d
|
||||
#define d(x) x/64.0
|
||||
static const float ordered8[64] =
|
||||
{
|
||||
d( 0),d(48),d(12),d(60),d( 3),d(51),d(15),d(63),
|
||||
d(32),d(16),d(44),d(28),d(35),d(19),d(47),d(31),
|
||||
d( 8),d(56),d( 4),d(52),d(11),d(59),d( 7),d(55),
|
||||
d(40),d(24),d(36),d(20),d(43),d(27),d(39),d(23),
|
||||
d( 2),d(50),d(14),d(62),d( 1),d(49),d(13),d(61),
|
||||
d(34),d(18),d(46),d(30),d(33),d(17),d(45),d(29),
|
||||
d(10),d(58),d( 6),d(54),d( 9),d(57),d( 5),d(53),
|
||||
d(42),d(26),d(38),d(22),d(41),d(25),d(37),d(21)
|
||||
};
|
||||
#undef d
|
||||
|
||||
float4 Timer;
|
||||
float4 ScreenSize;
|
||||
float ENightDayFactor;
|
||||
|
|
@ -491,18 +682,44 @@ Texture2D TextureNoise3
|
|||
<
|
||||
string ResourceName = "menbnoise2.png";
|
||||
>;
|
||||
#ifdef LUTMODE_LEGACY
|
||||
Texture2D TextureLUT
|
||||
<
|
||||
#ifdef LUTMODE_LEGACY
|
||||
string ResourceName = "menblutpreset.png";
|
||||
#endif
|
||||
>;
|
||||
#else
|
||||
Texture2D TextureLUTN
|
||||
<
|
||||
#ifdef LUTMODE_16
|
||||
string ResourceName = "menblut16.png";
|
||||
string ResourceName = "menblut16_night.png";
|
||||
#endif
|
||||
#ifdef LUTMODE_64
|
||||
string ResourceName = "menblut64.png";
|
||||
string ResourceName = "menblut64_night.png";
|
||||
#endif
|
||||
>;
|
||||
Texture2D TextureLUTD
|
||||
<
|
||||
#ifdef LUTMODE_16
|
||||
string ResourceName = "menblut16_day.png";
|
||||
#endif
|
||||
#ifdef LUTMODE_64
|
||||
string ResourceName = "menblut64_day.png";
|
||||
#endif
|
||||
>;
|
||||
Texture2D TextureLUTI
|
||||
<
|
||||
#ifdef LUTMODE_16
|
||||
string ResourceName = "menblut16_interior.png";
|
||||
#endif
|
||||
#ifdef LUTMODE_64
|
||||
string ResourceName = "menblut64_interior.png";
|
||||
#endif
|
||||
>;
|
||||
#endif
|
||||
Texture2D TextureTonemap
|
||||
<
|
||||
string ResourceName = "menbfilmlut.png";
|
||||
>;
|
||||
|
||||
SamplerState Sampler0
|
||||
{
|
||||
|
|
@ -585,7 +802,7 @@ float3 hsv2rgb( float3 c )
|
|||
return c.z*lerp(K.x,saturate(p-K.x),c.y);
|
||||
}
|
||||
|
||||
/* "uncharted 2" filmic tone mapping */
|
||||
/* Uncharted 2 tone mapping */
|
||||
float3 Uch( float3 res )
|
||||
{
|
||||
float A = tod_ind(unA);
|
||||
|
|
@ -596,12 +813,108 @@ float3 Uch( float3 res )
|
|||
float F = tod_ind(unF);
|
||||
return ((res*(A*res+C*B)+D*E)/(res*(A*res+B)+D*F))-E/F;
|
||||
}
|
||||
float3 Tonemap( float3 res )
|
||||
float3 TonemapUC2( float3 res )
|
||||
{
|
||||
float W = tod_ind(unW);
|
||||
float3 ucol = Uch(res);
|
||||
float3 uwhite = Uch(W);
|
||||
return max(ucol/uwhite,0.0);
|
||||
return pow(max(ucol/uwhite,0.0),1.0/2.2);
|
||||
}
|
||||
/* Vanilla tonemap is weird */
|
||||
float3 TonemapGame( float3 res )
|
||||
{
|
||||
#ifdef SKYRIMSE
|
||||
return pow(max(res,0.0),1.0/2.2);
|
||||
#else
|
||||
float3 wat = res*2.0;
|
||||
float3 huh = res*0.3+0.05;
|
||||
float2 weh = float2(0.2,3.333333)*Params01[1].w;
|
||||
huh = wat*huh+weh.x;
|
||||
float3 ehh = wat*0.3+0.5;
|
||||
ehh = ehh*0.3+0.5;
|
||||
ehh = wat*ehh+0.06;
|
||||
ehh = huh/ehh;
|
||||
ehh = -Params01[1].w*3.333333+ehh;
|
||||
wat.x = Params01[1].w*0.2+19.376;
|
||||
wat.x = wat.x*0.0408564-weh.y;
|
||||
return pow(max(ehh/wat.x,0.0),1.0/2.2);
|
||||
#endif
|
||||
}
|
||||
/* Ugly old Reinhard tone mapping */
|
||||
float3 TonemapReinhard( float3 res )
|
||||
{
|
||||
float3 tcol = res/(1+res);
|
||||
return pow(max(tcol,0.0),1.0/2.2);
|
||||
}
|
||||
/* That thing used in watch_dogs */
|
||||
float3 TonemapHaarmPeterDuiker( float3 res )
|
||||
{
|
||||
float3 ld = 0.002;
|
||||
float linReference = 0.18;
|
||||
float logReference = 444;
|
||||
float logGamma = 0.45;
|
||||
float3 LogColor;
|
||||
LogColor.rgb = (log10(0.4*res/linReference)/ld*logGamma+logReference)/1023.f;
|
||||
LogColor.rgb = saturate(LogColor.rgb);
|
||||
float FilmLutWidth = 256;
|
||||
float Padding = .5/FilmLutWidth;
|
||||
float3 retColor;
|
||||
retColor.r = TextureTonemap.Sample(Sampler1,float2(lerp(Padding,1-Padding,LogColor.r),.5)).x;
|
||||
retColor.g = TextureTonemap.Sample(Sampler1,float2(lerp(Padding,1-Padding,LogColor.g),.5)).x;
|
||||
retColor.b = TextureTonemap.Sample(Sampler1,float2(lerp(Padding,1-Padding,LogColor.b),.5)).x;
|
||||
return retColor;
|
||||
}
|
||||
/* Practically nothing */
|
||||
float3 TonemapLinear( float3 res )
|
||||
{
|
||||
return pow(max(res,0.0),1.0/2.2);
|
||||
}
|
||||
/* People somehow call this one realistic */
|
||||
float3 TonemapHejlDawson( float3 res )
|
||||
{
|
||||
float3 x = max(0.0,res-0.004);
|
||||
return (x*(6.2*x+.5))/(x*(6.2*x+1.7)+0.06);
|
||||
}
|
||||
/* The standard tonemap from sweetfx */
|
||||
float3 TonemapSFX( float3 res )
|
||||
{
|
||||
float Gamma = tod_ind(sfxgamma);
|
||||
float Exposure = tod_ind(sfxexposure);
|
||||
float Saturation = tod_ind(sfxsaturation);
|
||||
float Bleach = tod_ind(sfxbleach);
|
||||
float Defog = tod_ind(sfxdefog);
|
||||
float3 FogColor = tod_ind(sfxfogcolor);
|
||||
float3 tcol = res;
|
||||
tcol = saturate(tcol-Defog*FogColor*2.55);
|
||||
tcol *= pow(2.0,Exposure);
|
||||
tcol = pow(tcol,Gamma);
|
||||
float lum = luminance(tcol);
|
||||
float L = saturate(1.0*(lum-0.45));
|
||||
float3 A2 = Bleach*tcol;
|
||||
float3 res1 = 2.0*tcol*lum;
|
||||
float3 res2 = 1.0-2.0*(1.0-lum)*(1.0-tcol);
|
||||
float3 newc = lerp(res1,res2,L);
|
||||
float3 mixrgb = A2*newc;
|
||||
tcol += (1.0-A2)*mixrgb;
|
||||
float3 gray = dot(tcol,1.0/3.0);
|
||||
float3 diff = tcol-gray;
|
||||
return (tcol+diff*Saturation)/(1+(diff*Saturation));
|
||||
}
|
||||
float3 Tonemap( float3 res )
|
||||
{
|
||||
float3 tcol = pow(max(res,0.0),1.0/2.2);
|
||||
if ( tmapenable == -1 ) return tcol;
|
||||
res *= tod_ind(tmapexposure);
|
||||
float tblend = tod_ind(tmapblend);
|
||||
float3 mapped;
|
||||
if ( tmapenable == 6 ) mapped = TonemapSFX(res);
|
||||
else if ( tmapenable == 5 ) mapped = TonemapHaarmPeterDuiker(res);
|
||||
else if ( tmapenable == 4 ) mapped = TonemapHejlDawson(res);
|
||||
else if ( tmapenable == 3 ) mapped = TonemapUC2(res);
|
||||
else if ( tmapenable == 2 ) mapped = TonemapReinhard(res);
|
||||
else if ( tmapenable == 1 ) mapped = TonemapLinear(res);
|
||||
else if ( tmapenable == 0 ) mapped = TonemapGame(res);
|
||||
return lerp(tcol,mapped,tblend);
|
||||
}
|
||||
/* colour grading passes */
|
||||
float3 GradingRGB( float3 res )
|
||||
|
|
@ -642,12 +955,25 @@ float3 GradingLUT( float3 res )
|
|||
float3 tcol = clamp(res,0.0001,0.9999);
|
||||
tcol.rg = tcol.rg*0.5+0.25;
|
||||
#ifdef LUTMODE_LEGACY
|
||||
float2 lc1 = float2(tcol.r/16.0+floor(tcol.b*16.0)/16.0,tcol.g/64.0
|
||||
+clut/64.0);
|
||||
float2 lc2 = float2(tcol.r/16.0+ceil(tcol.b*16.0)/16.0,tcol.g/64.0
|
||||
+clut/64.0);
|
||||
float2 lc1 = float2(tcol.r/16.0+floor(tcol.b*16.0)/16.0,tcol.g/64.0);
|
||||
float2 lc2 = float2(tcol.r/16.0+ceil(tcol.b*16.0)/16.0,tcol.g/64.0);
|
||||
float dec = (ceil(tcol.b*16.0)==16.0)?(0.0):frac(tcol.b*16.0);
|
||||
#endif
|
||||
/* night samples */
|
||||
float3 tcl1_n = TextureLUT.Sample(SamplerLUT,lc1
|
||||
+float2(0,clut_n/64.0)).rgb;
|
||||
float3 tcl2_n = TextureLUT.Sample(SamplerLUT,lc2
|
||||
+float2(0,clut_n/64.0)).rgb;
|
||||
/* day samples */
|
||||
float3 tcl1_d = TextureLUT.Sample(SamplerLUT,lc1
|
||||
+float2(0,clut_d/64.0)).rgb;
|
||||
float3 tcl2_d = TextureLUT.Sample(SamplerLUT,lc2
|
||||
+float2(0,clut_d/64.0)).rgb;
|
||||
/* interior samples */
|
||||
float3 tcl1_i = TextureLUT.Sample(SamplerLUT,lc1
|
||||
+float2(0,clut_i/64.0)).rgb;
|
||||
float3 tcl2_i = TextureLUT.Sample(SamplerLUT,lc2
|
||||
+float2(0,clut_i/64.0)).rgb;
|
||||
#else
|
||||
#ifdef LUTMODE_16
|
||||
float2 lc1 = float2(tcol.r,tcol.g/16.0+floor(tcol.b*16.0)/16.0);
|
||||
float2 lc2 = float2(tcol.r,tcol.g/16.0+ceil(tcol.b*16.0)/16.0);
|
||||
|
|
@ -658,8 +984,18 @@ float3 GradingLUT( float3 res )
|
|||
float2 lc2 = float2(tcol.r,tcol.g/64.0+ceil(tcol.b*64.0)/64.0);
|
||||
float dec = (ceil(tcol.b*64.0)==64.0)?(0.0):frac(tcol.b*64.0);
|
||||
#endif
|
||||
float3 tcl1 = TextureLUT.Sample(SamplerLUT,lc1).rgb;
|
||||
float3 tcl2 = TextureLUT.Sample(SamplerLUT,lc2).rgb;
|
||||
/* night samples */
|
||||
float3 tcl1_n = TextureLUTN.Sample(SamplerLUT,lc1).rgb;
|
||||
float3 tcl2_n = TextureLUTN.Sample(SamplerLUT,lc2).rgb;
|
||||
/* day samples */
|
||||
float3 tcl1_d = TextureLUTD.Sample(SamplerLUT,lc1).rgb;
|
||||
float3 tcl2_d = TextureLUTD.Sample(SamplerLUT,lc2).rgb;
|
||||
/* interior samples */
|
||||
float3 tcl1_i = TextureLUTI.Sample(SamplerLUT,lc1).rgb;
|
||||
float3 tcl2_i = TextureLUTI.Sample(SamplerLUT,lc2).rgb;
|
||||
#endif
|
||||
float3 tcl1 = tod_ind(tcl1);
|
||||
float3 tcl2 = tod_ind(tcl2);
|
||||
tcol = lerp(tcl1,tcl2,dec);
|
||||
float lutblend = tod_ind(lutblend);
|
||||
return lerp(res,tcol,lutblend);
|
||||
|
|
@ -674,24 +1010,6 @@ float3 Technicolor( float3 res )
|
|||
float3 tint = float3(green*blue,red*blue,red*green)*res;
|
||||
return lerp(res,res+0.5*(tint-res),techblend);
|
||||
}
|
||||
/* post-pass dithering, something apparently only my ENB does */
|
||||
float3 Dither( float3 res, float2 coord )
|
||||
{
|
||||
float2 rcoord = coord*float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
|
||||
float3 col = res;
|
||||
float dml = (1.0/256.0);
|
||||
if ( dither == 1 )
|
||||
col += ordered2[int(rcoord.x%2)+2*int(rcoord.y%2)]*dml-0.5*dml;
|
||||
else if ( dither == 2 )
|
||||
col += ordered3[int(rcoord.x%3)+3*int(rcoord.y%3)]*dml-0.5*dml;
|
||||
else if ( dither == 3 )
|
||||
col += ordered4[int(rcoord.x%4)+4*int(rcoord.y%4)]*dml-0.5*dml;
|
||||
else if ( dither == 4 )
|
||||
col += ordered8[int(rcoord.x%8)+8*int(rcoord.y%8)]*dml-0.5*dml;
|
||||
else col += checkers[int(rcoord.x%2)+2*int(rcoord.y%2)]*dml-0.5*dml;
|
||||
col = (trunc(col*256.0)/256.0);
|
||||
return col;
|
||||
}
|
||||
/* Fuzzy */
|
||||
float3 FilmGrain( float3 res, float2 coord )
|
||||
{
|
||||
|
|
@ -731,80 +1049,86 @@ float3 FilmGrain( float3 res, float2 coord )
|
|||
float3 ng = float3(n4,n4,n4);
|
||||
float3 nc = float3(n1,n2,n3);
|
||||
float3 nt = pow(clamp(lerp(ng,nc,ns),0.0,1.0),nj);
|
||||
if ( nb == 1 ) return res+nt*ni;
|
||||
if ( nb == 2 ) return overlay(res,(nt*ni));
|
||||
if ( nb == 1 ) return res+nt*ni*0.01;
|
||||
if ( nb == 2 ) return overlay(res,(nt*ni*0.01));
|
||||
if ( nb == 3 )
|
||||
{
|
||||
float bn = 1.0-saturate((res.r+res.g+res.b)/3.0);
|
||||
bn = pow(bn,bnp);
|
||||
float3 nn = saturate(nt*bn);
|
||||
return darkmask(res,(nn*ni));
|
||||
return darkmask(res,(nn*ni*0.01));
|
||||
}
|
||||
return lerp(res,nt,ni);
|
||||
return lerp(res,nt,ni*0.01);
|
||||
}
|
||||
|
||||
/* identical between games, the only difference is parameter indices */
|
||||
float3 GradingGame( float3 res, float adapt )
|
||||
{
|
||||
float satv, tintv, conv, brtv;
|
||||
float3 tintc;
|
||||
#ifdef SKYRIMSE
|
||||
satv = Params01[3].x;
|
||||
tintc = Params01[4].xyz;
|
||||
tintv = Params01[4].w;
|
||||
conv = Params01[3].w;
|
||||
brtv = Params01[3].z;
|
||||
#else
|
||||
satv = Params01[2].x;
|
||||
tintc = Params01[3].xyz;
|
||||
tintv = Params01[3].w;
|
||||
conv = Params01[2].w;
|
||||
brtv = Params01[2].z;
|
||||
#endif
|
||||
float val = luminance(res);
|
||||
float3 tcol = res-val;
|
||||
satv = (satv<0.0)?(-pow(abs(satv),vsatpow)*vsatmul)
|
||||
:(pow(max(satv,0.0),vsatpow)*vsatmul);
|
||||
tcol = satv*tcol+val;
|
||||
tcol = lerp(res,tcol,vsatblend);
|
||||
float3 tint = tintc*val-tcol;
|
||||
tintv = (tintv<0.0)?(-pow(abs(tintv),vtintpow)*vtintmul)
|
||||
:(pow(max(tintv,0.0),vtintpow)*vtintmul);
|
||||
tcol = tintv*tint+tcol;
|
||||
tcol = lerp(res,tcol,vtintblend);
|
||||
tcol = conv*tcol-adapt;
|
||||
tcol = brtv*tcol+adapt;
|
||||
return lerp(res,tcol,vconblend);
|
||||
}
|
||||
/* Skyrim SE version is blatantly incomplete and will glitch out */
|
||||
float2 Adaptation( float2 coord )
|
||||
{
|
||||
#ifdef SKYRIMSE
|
||||
float adapt = TextureAdaptation.Sample(Sampler1,coord).x;
|
||||
return float2(adapt);
|
||||
#else
|
||||
float adapt = TextureAdaptation.Sample(Sampler0,coord).x;
|
||||
float adapt_v1 = Params01[1].z/(0.001+adapt);
|
||||
float adapt_v2 = adapt_v1<Params01[1].y;
|
||||
adapt_v1 = adapt_v2?Params01[1].y:adapt_v1;
|
||||
adapt_v2 = Params01[1].x<adapt_v1;
|
||||
adapt_v1 = adapt_v2?Params01[1].x:adapt_v1;
|
||||
return float2(adapt_v1,adapt);
|
||||
#endif
|
||||
}
|
||||
|
||||
float4 PS_Draw( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord0.xy;
|
||||
float4 res;
|
||||
float4 res = TextureColor.Sample(Sampler0,coord);
|
||||
#ifdef SKYRIMSE
|
||||
res = TextureColor.Sample(Sampler0,coord)
|
||||
+TextureBloom.Sample(Sampler1,coord)*ENBParams01.x;
|
||||
/* Luckily I could sort of interpret some of the vanilla grading */
|
||||
float val = luminance(res.rgb);
|
||||
float adapt = TextureAdaptation.Sample(Sampler1,coord).x;
|
||||
float4 tint;
|
||||
res -= val;
|
||||
res = Params01[3].x*res+val;
|
||||
tint = Params01[4]*val-res;
|
||||
res = Params01[4].w*tint+res;
|
||||
res = Params01[3].w*res-adapt;
|
||||
res = Params01[3].z*res+adapt;
|
||||
if ( bloomdebug ) res = TextureBloom.Sample(Sampler1,coord)
|
||||
*ENBParams01.x;
|
||||
float4 mud = TextureBloom.Sample(Sampler1,coord);
|
||||
#else
|
||||
float4 color;
|
||||
color = TextureColor.Sample(Sampler0,IN.txcoord0.xy);
|
||||
float4 r0, r1, r2, r3;
|
||||
r0.xyz = color.xyz;
|
||||
r1.xy = Params01[4].zw*IN.txcoord0.xy;
|
||||
r1.xyz = TextureBloom.Sample(Sampler1,r1.xy).xyz*ENBParams01.x;
|
||||
r0.w = TextureAdaptation.Sample(Sampler0,IN.txcoord0.xy).x;
|
||||
r1.w = Params01[1].z/(0.001+r0.w);
|
||||
r2.x = r1.w<Params01[1].y;
|
||||
r1.w = r2.x?Params01[1].y:r1.w;
|
||||
r2.x = Params01[1].x<r1.w;
|
||||
r1.w = r2.x?Params01[1].x:r1.w;
|
||||
r0.xyz = r1.xyz+r0.xyz;
|
||||
r0.xyz = r0.xyz*r1.w;
|
||||
r1.xyz = r0.xyz+r0.xyz;
|
||||
r2.xyz = r0.xyz*0.3+0.05;
|
||||
r3.xy = float2(0.2,3.333333)*Params01[1].w;
|
||||
r2.xyz = r1.xyz*r2.xyz+r3.x;
|
||||
r0.xyz = r0.xyz*0.3+0.5;
|
||||
r0.xyz = r1.xyz*r0.xyz+0.06;
|
||||
r0.xyz = r2.xyz/r0.xyz;
|
||||
r0.xyz = -Params01[1].w*3.333333+r0.xyz;
|
||||
r1.x = Params01[1].w*0.2+19.376;
|
||||
r1.x = r1.x*0.0408564-r3.y;
|
||||
r1.xyz = r0.xyz/r1.x;
|
||||
r0.x = dot(r1.xyz,float3(0.2125,0.7154,0.0721));
|
||||
r1.xyz = r1.xyz-r0.x;
|
||||
r1.xyz = Params01[2].x * r1.xyz+r0.x;
|
||||
r2.xyz = r0.x*Params01[3].xyz-r1.xyz;
|
||||
r1.xyz = Params01[3].w*r2.xyz+r1.xyz;
|
||||
r1.xyz = Params01[2].w*r1.xyz-r0.w;
|
||||
r0.xyz = Params01[2].z*r1.xyz+r0.w;
|
||||
color.xyz = lerp(r0.xyz,Params01[5].xyz,Params01[5].w);
|
||||
color.xyz = saturate(color.xyz);
|
||||
color.xyz = pow(color.xyz,1.0/2.2);
|
||||
res.xyz = max(0,color.xyz);
|
||||
res.w = 1.0;
|
||||
if ( bloomdebug ) res = TextureBloom.Sample(Sampler1,Params01[4].zw
|
||||
*coord)*ENBParams01.x;
|
||||
float4 mud = TextureBloom.Sample(Sampler1,Params01[4].zw*coord);
|
||||
#endif
|
||||
/* Insert MariENB filters here */
|
||||
if ( tmapenable ) res.rgb = Tonemap(res.rgb);
|
||||
float2 adapt = Adaptation(coord);
|
||||
if ( bloomdebug ) res.rgb *= 0;
|
||||
float3 bcol = mud.rgb*ENBParams01.x;
|
||||
res.rgb += bcol;
|
||||
if ( aenable ) res.rgb *= adapt.x;
|
||||
if ( nbt && ne ) res.rgb = FilmGrain(res.rgb,coord);
|
||||
res.rgb = Tonemap(res.rgb);
|
||||
if ( vgradeenable ) res.rgb = GradingGame(res.rgb,adapt.y);
|
||||
if ( gradeenable1 ) res.rgb = GradingRGB(res.rgb);
|
||||
if ( colorizeafterhsv )
|
||||
{
|
||||
|
|
@ -818,9 +1142,10 @@ float4 PS_Draw( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
|||
}
|
||||
if ( lutenable ) res.rgb = GradingLUT(res.rgb);
|
||||
if ( techenable ) res.rgb = Technicolor(res.rgb);
|
||||
if ( ne ) res.rgb = FilmGrain(res.rgb,coord);
|
||||
if ( !nbt && ne ) res.rgb = FilmGrain(res.rgb,coord);
|
||||
/* fade has same index on both games */
|
||||
res.rgb = Params01[5].rgb*Params01[5].a+res.rgb*(1.0-Params01[5].a);
|
||||
if ( adaptdebug ) res.rgb = TextureAdaptation.Sample(Sampler1,coord).x;
|
||||
if ( dodither ) res.rgb = Dither(res.rgb,coord);
|
||||
res.rgb = max(0,res.rgb);
|
||||
res.a = 1.0;
|
||||
return res;
|
||||
|
|
|
|||
Reference in a new issue