Page 1 of 1

Rudy ENB for Fallout New Vegas enbeffect.fx file

Posted: 22 Aug 2022, 22:19
by Guzio

Code: Select all

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

// Rudy ENB for Fallout New Vegas
// NIGHTEYE CODE v2.5 by Scegielski author of "Enhanced ENB Night Eye" - http://www.nexusmods.com/newvegas/mods/55764/?



//========== GUI ==========================================

//========== NIGHT BRIGHTNESS GUI ==========================================

string NightBrightness = "!!! CHOOSE NIGHT BRIGHTNESS - 1.0 IS DEFAULT !!!";

float   fNightlevel
<
   string UIName="NIGHT BRIGHTNESS";
   string UIWidget="spinner";
   float UIMin=0.6;
   float UIMax=1.6;
   float UIStep=0.1;
> = {1.0};

//========== NIGHT BRIGHTNESS GUI END ==========================================

//========== INTERIORS BRIGHTNESS GUI ==========================================

string InteriorBrightness = "!!! CHOOSE INTERIORS BRIGHTNESS - 1.0 IS DEFAULT !!!";

float   fInteriorlevel
<
   string UIName="INTERIORS BRIGHTNESS";
   string UIWidget="spinner";
   float UIMin=0.6;
   float UIMax=1.6;
   float UIStep=0.1;
> = {1.0};

//========== INTERIORS BRIGHTNESS GUI END ==========================================

//========== LUT GUI ==========================================

string Lutchoose = "!!! CHOOSE LUT (1-4) - 1 IS DEFAULT !!!";

float   LUTSwitch
<
   string UIName="LUT NUMBER";
   string UIWidget="spinner";
   float UIMin=1.0;
   float UIMax=4.0;
   float UIStep=1.0;
> = {0.0};

//========== LUT GUI END ==========================================

string DayParam = "DAY";

	float	EBrightnessV2Day <
		string UIName="Brightness Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.70};

	float	EAdaptationMinV2Day <
		string UIName="Adaptation Min Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.04};

	float	EAdaptationMaxV2Day <
		string UIName="Adaptation Max Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.17};

	float	EToneMappingCurveV2Day <
		string UIName="ToneMapping Curve Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {1.65};

	float	EIntensityContrastV2Day <
		string UIName="Intensity Contrast Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {1.30};

	float	EToneMappingOversaturationV2Day <
		string UIName="ToneMapping Oversaturation Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=200.0;
	> = {200.0};

	float	EColorSaturationV2Day <
		string UIName="Color Saturation Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {1.45};


string NightParam = "NIGHT";

	float	EBrightnessV2Night <
		string UIName="Brightness Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.45};

	float	EAdaptationMinV2Night <
		string UIName="Adaptation Min Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.035};

	float	EAdaptationMaxV2Night <
		string UIName="Adaptation Max Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.1};

	float	EToneMappingCurveV2Night <
		string UIName="ToneMapping Curve Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {2.0};

	float	EIntensityContrastV2Night <
		string UIName="Intensity Contrast Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {1.1};

	float	EToneMappingOversaturationV2Night <
		string UIName="ToneMapping Oversaturation Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=200.0;
	> = {60.0};

	float	EColorSaturationV2Night <
		string UIName="Color Saturation Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.9};


string InteriorsParam = "INTERIORS";

	float	EBrightnessV2Interior <
		string UIName="Brightness Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.3};

	float	EAdaptationMinV2Interior <
		string UIName="Adaptation Min Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.036};

	float	EAdaptationMaxV2Interior <
		string UIName="Adaptation Max Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.2};

	float	EToneMappingCurveV2Interior <
		string UIName="ToneMapping Curve Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {1.7};

	float	EIntensityContrastV2Interior <
		string UIName="Intensity Contrast Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {0.9};

	float	EToneMappingOversaturationV2Interior <
		string UIName="ToneMapping Oversaturation Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=200.0;
	> = {160.0};

	float	EColorSaturationV2Interior <
		string UIName="Color Saturation Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=50.0;
	> = {1.05};

//========== DITHERING ==========================================

#define DITHER_METHOD 2 //0==linear, 1==srgb, 2==energy-preserved
	
string DitherHeader = "DITHER";
bool	HHKingDither
<
	string UIName = "Dither: Enable/Disable";
> = {true};

bool	HHDitherAdapt
<
	string UIName = "Dither: Adaptation";
> = {true};

float	dither_amp
<
	string UIName="Dither: Amplitude";
	string UIWidget="Spinner";
	float UIMin=0.0;
	float UIMax=10.0;
> = {1.0};

//========== DITHERING ==========================================


			
//parameters for ldr color correction, if enabled

string LdrCC = "PCC";
float	ECCGamma
<
	string UIName="CC: Gamma";
	string UIWidget="Spinner";
	float UIMin=0.2;//not zero!!!
	float UIMax=5.0;
> = {1.0};

float	ECCInBlack
<
	string UIName="CC: In black";
	string UIWidget="Spinner";
	float UIMin=0.0;
	float UIMax=1.0;
> = {0.0};

float	ECCInWhite
<
	string UIName="CC: In white";
	string UIWidget="Spinner";
	float UIMin=0.0;
	float UIMax=1.0;
> = {1.0};

float	ECCOutBlack
<
	string UIName="CC: Out black";
	string UIWidget="Spinner";
	float UIMin=0.0;
	float UIMax=1.0;
> = {0.0};

float	ECCOutWhite
<
	string UIName="CC: Out white";
	string UIWidget="Spinner";
	float UIMin=0.0;
	float UIMax=1.0;
> = {1.0};

float	ECCBrightness
<
	string UIName="CC: Brightness";
	string UIWidget="Spinner";
	float UIMin=0.0;
	float UIMax=10.0;
> = {1.0};

float	ECCContrastGrayLevel
<
	string UIName="CC: Contrast gray level";
	string UIWidget="Spinner";
	float UIMin=0.01;
	float UIMax=0.99;
> = {0.5};

float	ECCContrast
<
	string UIName="CC: Contrast";
	string UIWidget="Spinner";
	float UIMin=0.0;
	float UIMax=10.0;
> = {1.0};

float	ECCSaturation
<
	string UIName="CC: Saturation";
	string UIWidget="Spinner";
	float UIMin=0.0;
	float UIMax=10.0;
> = {1.0};

float	ECCDesaturateShadows
<
	string UIName="CC: Desaturate shadows";
	string UIWidget="Spinner";
	float UIMin=0.0;
	float UIMax=1.0;
> = {0.0};

float3	ECCColorBalanceShadows <
	string UIName="CC: Color balance shadows";
	string UIWidget="Color";
> = {0.5, 0.5, 0.5};

float3	ECCColorBalanceHighlights <
	string UIName="CC: Color balance highlights";
	string UIWidget="Color";
> = {0.5, 0.5, 0.5};

float3	ECCChannelMixerR <
	string UIName="CC: Channel mixer R";
	string UIWidget="Color";
> = {1.0, 0.0, 0.0};

float3	ECCChannelMixerG <
	string UIName="CC: Channel mixer G";
	string UIWidget="Color";
> = {0.0, 1.0, 0.0};

float3	ECCChannelMixerB <
	string UIName="CC: Channel mixer B";
	string UIWidget="Color";
> = {0.0, 0.0, 1.0};

// #########################
// BEGIN NIGHTEYE  UTILITIES
// #########################
#define ENABLE_CALIBRATION
#define	ENABLE_CALIBRATION_REGISTERS
//#define ENABLE_WARPING
//#define ENABLE_VIGNETTE
#define ENABLE_NOISE
//#define ENABLE_LENS
#define ENABLE_SCANLINES
#define ENABLE_NIGHT_VISION
#define ENABLE_THERMAL_VISION
#define ENABLE_EMI_VISION
//#define ENABLE_GENERAL_IMOD

#include "EnhancedENBDiagnostics.fxh"

float3 EENV_RGBtoHSV(float3 c)
{
	float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
	float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g));
	float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r));

	float d = q.x - min(q.w, q.y);
	float e = 1.0e-10;
	return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}

float3 EENV_HSVtoRGB(float3 c)
{
	float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
	float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
	return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
}

float EENV_randomNoise(in float3 uvw)
{
	float3 noise = (frac(sin(dot(uvw ,float3(12.9898,78.233, 42.2442)*2.0)) * 43758.5453));
	return abs(noise.x + noise.y + noise.z) * 0.3333;
}

float EENV_linStep(float minVal, float maxVal, float t)
{
	return saturate((t - minVal) / (maxVal - minVal));
}

texture2D EENV_LensMask
<
	string ResourceName="enblensmask.png";
>;

sampler2D EENV_LensMaskSampler = sampler_state
{
	Texture = <EENV_LensMask>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
};
// #########################
// END NIGHTEYE  UTILITIES
// #########################

string Param06 = "NIGHTEYE";
// ##########################
// BEGIN NIGHTEYE  PARAMETERS
// ##########################
//{
//{ MASTER ENABLE
	bool EENV_Enable <
		string UIName = "EENV Master Enable";
	> = {true};
	bool EENV_Game_CC_Override_Enable <
		string UIName = "EENV Game CC Override Enable";
	> = {false};
//}

//{ CALIBRATION DISPLAY
#ifdef ENABLE_CALIBRATION
	bool EENV_CalibrateEnable <
		string UIName = "EENV Calibrate Display";
	> = {false};
	
	float EENV_CalibratePosX
	<
		string UIName="EENV Calibrate Position X";
		string UIWidget="Spinner";
		float UIMin=-1.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.67};
	
	float EENV_CalibratePosY
	<
		string UIName="EENV Calibrate Position Y";
		string UIWidget="Spinner";
		float UIMin=-1.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {-0.10};
#endif // ENABLE_CALIBRATION
//}
			
//{ NIGHT VISION
#ifdef ENABLE_NIGHT_VISION
//{		Enable
	bool EENV_nightVisionEnable <
		string UIName = "EENV Night Vision Enable";
	> = {true};
	//}
//{		Calibration
//{			Offset	
	float EENV_nightVisionCalDayOffset
	<
		string UIName="EENV Night Vision Cal Day Offset";
		string UIWidget="Spinner";
		float UIMin=-10.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {-2.0};
	float EENV_nightVisionCalNightOffset
	<
		string UIName="EENV Night Vision Cal Night Offset";
		string UIWidget="Spinner";
		float UIMin=-10.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {-2.0};
	float EENV_nightVisionCalInteriorOffset
	<
		string UIName="EENV Night Vision Cal Interior Offset";
		string UIWidget="Spinner";
		float UIMin=-10.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {-2.0};
	//}
//{			Mult
	float EENV_nightVisionCalDayMult
	<
		string UIName="EENV Night Vision Cal Day Mult";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {0.5};
	float EENV_nightVisionCalNightMult
	<
		string UIName="EENV Night Vision Cal Night Mult";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {0.5};
	float EENV_nightVisionCalInteriorMult
	<
		string UIName="EENV Night Vision Cal Interior Mult";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {0.5};
	//}
//{			Use Color
	bool EENV_nightVisionCalUseColor <
		string UIName = "EENV Night Vision Cal Use Color";
	> = {true};	
	float EENV_nightVisionCalColorR
	<
		string UIName="EENV Night Vision Cal Color R";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.28};	
	float EENV_nightVisionCalColorG
	<
		string UIName="EENV Night Vision Cal Color G";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.65};
	float EENV_nightVisionCalColorB
	<
		string UIName="EENV Night Vision Cal Color B";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.38};
	float EENV_nightVisionCalRangeMin
	<
		string UIName="EENV Night Vision Cal Color Range Min";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.05};
	float EENV_nightVisionCalRangeMax
	<
		string UIName="EENV Night Vision Cal Color Range Max";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.2};
	//}
//}
//{		Settings
//{ 		Color Correction
	float EENV_nightVisionGammaDay
	<
		string UIName="EENV Night Vision Gamma Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.7};
	float EENV_nightVisionGammaNight
	<
		string UIName="EENV Night Vision Gamma Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.6};
	float EENV_nightVisionGammaInterior
	<
		string UIName="EENV Night Vision Gamma Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	float EENV_nightVisionHue
	<
		string UIName="EENV Night Vision Hue";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
	> = {0.0};
	float EENV_nightVisionSaturationDay
	<
		string UIName="EENV Night Vision Saturation Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_nightVisionSaturationNight
	<
		string UIName="EENV Night Vision Saturation Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	float EENV_nightVisionSaturationInterior
	<
		string UIName="EENV Night Vision Saturation Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	float EENV_nightVisionValueDay
	<
		string UIName="EENV Night Vision Value Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_nightVisionValueNight
	<
		string UIName="EENV Night Vision Value Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_nightVisionValueInterior
	<
		string UIName="EENV Night Vision Value Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	//}
//{			Bloom
	float EENV_nightVisionGameBloom
	<
		string UIName="EENV Night Vision Game Bloom";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.5};
	float EENV_nightVisionENBBloom
	<
		string UIName="EENV Night Vision ENB Bloom";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.0};
	float EENV_nightVisionENBBloomGamma
	<
		string UIName="EENV Night Vision ENB Bloom Gamma";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_nightVisionENBBloomTint
	<
		string UIName="EENV Night Vision ENB Bloom Tint";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
	> = {1.0};
	//}
//{			Vignette
	#ifdef ENABLE_VIGNETTE
		float EENV_nightVisionVignette
		<
			string UIName="EENV Night Vision Vignette";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=1.0;
		> = {0.0};
	#else
		float EENV_nightVisionVignette = 0;
	#endif // ENABLE_VIGNETTE
	//}
//{			Warping
	#ifdef ENABLE_WARPING
		float EENV_nightVisionWarp
		<
			string UIName="EENV Night Vision Warp";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
	#else
		float EENV_nightVisionWarp = 0;
	#endif // ENABLE_WARPING
	//}
//{			Noise
	#ifdef ENABLE_NOISE
		float EENV_nightVisionNoise
		<
			string UIName="EENV Night Vision Noise";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
	#else
		float EENV_nightVisionNoise = 0;
	#endif // ENABLE_NOISE
	//}
//{			Lens
	#ifdef ENABLE_LENS
		float EENV_nightVisionLensDay
		<
			string UIName="EENV Night Vision Lens Day";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
		float EENV_nightVisionLensNight
		<
			string UIName="EENV Night Vision Lens Night";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {1.0};
		float EENV_nightVisionLensInterior
		<
			string UIName="EENV Night Vision Lens Interior";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {1.0};
	#else
		float EENV_nightVisionLensDay = 0;
		float EENV_nightVisionLensNight = 0;
		float EENV_nightVisionLensInterior = 0;
	#endif // ENABLE_LENS
	//}
//{			Scanlines
	#ifdef ENABLE_SCANLINES
		float EENV_nightVisionScanlinesDay
		<
			string UIName="EENV Night Vision Scanlines Day";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
		float EENV_nightVisionScanlinesNight
		<
			string UIName="EENV Night Vision Scanlines Night";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
		float EENV_nightVisionScanlinesInterior
		<
			string UIName="EENV Night Vision Scanlines Interior";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
		float4 EENV_nightVisionScanlinesColor <
			string UIName="EENV Night Vision Scanlines Color";
			string UIWidget="Color";
		> = {0.702, 0.529, 0, 1};
	#else
		float EENV_nightVisionScanlinesDay = 0;
		float EENV_nightVisionScanlinesNight = 0;
		float EENV_nightVisionScanlinesInterior = 0;
		float4 EENV_nightVisionScanlinesColor = float4(1, 1, 1, 1);
	#endif // ENABLE_SCANLINES
	//}
//}
#else
float EENV_nightVisionWarp = 0;
#endif // ENABLE_NIGHT_VISION
//}

//{ THERMAL VISION
#ifdef ENABLE_THERMAL_VISION
//{		Enable
	bool EENV_thermalVisionEnable <
		string UIName = "EENV Thermal Vision Enable";
	> = {true};
//}
//{		Calibration
//{			Offset
	float EENV_thermalVisionCalDayOffset
	<
		string UIName="EENV Thermal Vision Cal Day Offset";
		string UIWidget="Spinner";
		float UIMin=-10.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {-0.2};
	float EENV_thermalVisionCalNightOffset
	<
		string UIName="EENV Thermal Vision Cal Night Offset";
		string UIWidget="Spinner";
		float UIMin=-10.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {-0.2};
	float EENV_thermalVisionCalInteriorOffset
	<
		string UIName="EENV Thermal Vision Cal Interior Offset";
		string UIWidget="Spinner";
		float UIMin=-10.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {-0.2};
	//}
//{			Mult
	float EENV_thermalVisionCalDayMult
	<
		string UIName="EENV Thermal Vision Cal Day Mult";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {2.1};
	float EENV_thermalVisionCalNightMult
	<
		string UIName="EENV Thermal Vision Cal Night Mult";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {2.1};
	float EENV_thermalVisionCalInteriorMult
	<
		string UIName="EENV Thermal Vision Cal Interior Mult";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {2.1};
	//}
//{			Use Color
	bool EENV_thermalVisionCalUseColor <
		string UIName = "EENV Thermal Vision Cal Use Color";
	> = {true};	
	float EENV_thermalVisionCalColorR
	<
		string UIName="EENV Thermal Vision Cal Color R";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.0};	
	float EENV_thermalVisionCalColorG
	<
		string UIName="EENV Thermal Vision Cal Color G";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.0};
	float EENV_thermalVisionCalColorB
	<
		string UIName="EENV Thermal Vision Cal Color B";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.6};
	float EENV_thermalVisionCalRangeMin
	<
		string UIName="EENV Thermal Vision Cal Color Range Min";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.1};
	float EENV_thermalVisionCalRangeMax
	<
		string UIName="EENV Thermal Vision Cal Color Range Max";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.2};
	//}
//}
//{		Settings
//{			Color Correction
	float EENV_thermalVisionGammaDay
	<
		string UIName="EENV Thermal Vision Gamma Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.5};
	float EENV_thermalVisionGammaNight
	<
		string UIName="EENV Thermal Vision Gamma Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.5};
	float EENV_thermalVisionGammaInterior
	<
		string UIName="EENV Thermal Vision Gamma Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.5};
	float EENV_thermalVisionHue
	<
		string UIName="EENV Thermal Vision Hue";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
	> = {0.0};
	float EENV_thermalVisionSaturationDay
	<
		string UIName="EENV Thermal Vision Saturation Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {2.0};
	float EENV_thermalVisionSaturationNight
	<
		string UIName="EENV Thermal Vision Saturation Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {2.0};
	float EENV_thermalVisionSaturationInterior
	<
		string UIName="EENV Thermal Vision Saturation Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {2.0};
	float EENV_thermalVisionValueDay
	<
		string UIName="EENV Thermal Vision Value Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	float EENV_thermalVisionValueNight
	<
		string UIName="EENV Thermal Vision Value Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	float EENV_thermalVisionValueInterior
	<
		string UIName="EENV Thermal Vision Value Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	//}
//{			Bloom
	float EENV_thermalVisionGameBloom
	<
		string UIName="EENV Thermal Vision Game Bloom";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_thermalVisionENBBloom
	<
		string UIName="EENV Thermal Vision ENB Bloom";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.5};
	float EENV_thermalVisionENBBloomGamma
	<
		string UIName="EENV Thermal Vision ENB Bloom Gamma";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_thermalVisionENBBloomTint
	<
		string UIName="EENV Thermal Vision ENB Bloom Tint";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
	> = {0.0};
	//}
//{			Vignette
	#ifdef ENABLE_VIGNETTE
		float EENV_thermalVisionVignette
		<
			string UIName="EENV Thermal Vision Vignette";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=100.0;
		> = {0.0};
	#else
		float EENV_thermalVisionVignette = 0;
	#endif // ENABLE_VIGNETTE
	//}
//{			Warping
	#ifdef ENABLE_WARPING
		float EENV_thermalVisionWarp
		<
			string UIName="EENV Thermal Vision Warp";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
	#else
		float EENV_thermalVisionWarp = 0;
	#endif // ENABLE_WARPING
	//}
//{			Noise
	#ifdef ENABLE_NOISE
		float EENV_thermalVisionNoise
		<
			string UIName="EENV Thermal Vision Noise";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=100.0;
		> = {0.0};
	#else
		float EENV_thermalVisionNoise = 0;
	#endif
	//}
//{			Lens
	#ifdef ENABLE_LENS
		float EENV_thermalVisionLensDay
		<
			string UIName="EENV Thermal Vision Lens Day";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
		float EENV_thermalVisionLensNight
		<
			string UIName="EENV Thermal Vision Lens Night";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
		float EENV_thermalVisionLensInterior
		<
			string UIName="EENV Thermal Vision Lens Interior";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
	#else
		float EENV_thermalVisionLensDay = 0;
		float EENV_thermalVisionLensNight = 0;
		float EENV_thermalVisionLensInterior = 0;
	#endif // ENABLE_LENS
	//}
//{			Scalines
	#ifdef ENABLE_SCANLINES
		float EENV_thermalVisionScanlinesDay
		<
			string UIName="EENV Thermal Vision Scanlines Day";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
		float EENV_thermalVisionScanlinesNight
		<
			string UIName="EENV Thermal Vision Scanlines Night";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
		float EENV_thermalVisionScanlinesInterior
		<
			string UIName="EENV Thermal Vision Scanlines Interior";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
		float4 EENV_thermalVisionScanlinesColor <
			string UIName="EENV Thermal Vision Scanlines Color";
			string UIWidget="Color";
		> = {0.702, 0.529, 0, 1};
	#else
		float EENV_thermalVisionScanlinesDay = 0;
		float EENV_thermalVisionScanlinesNight = 0;
		float EENV_thermalVisionScanlinesInterior = 0;
		float4 EENV_thermalVisionScanlinesColor = float4(1, 1, 1, 1);
	#endif // ENABLE_SCANLINES
	//}
//}
#else
float EENV_thermalVisionWarp = 0;
#endif // ENABLE_THERMAL_VISION
//}

//{ EMI VISION
#ifdef ENABLE_EMI_VISION
//{		Enable
	bool EENV_emiVisionEnable <
		string UIName = "EENV EMI Vision Enable";
	> = {true};
//}
//{		Calibration
//{			Offset
	float EENV_emiVisionCalDayOffset
	<
		string UIName="EENV EMI Vision Cal Day Offset";
		string UIWidget="Spinner";
		float UIMin=-100.0;
		float UIMax=100.0;
		float UIStep=0.01;
	> = {-0.22};
	float EENV_emiVisionCalNightOffset
	<
		string UIName="EENV EMI Vision Cal Night Offset";
		string UIWidget="Spinner";
		float UIMin=-100.0;
		float UIMax=100.0;
		float UIStep=0.01;
	> = {-0.22};
	float EENV_emiVisionCalInteriorOffset
	<
		string UIName="EENV EMI Vision Cal Interior Offset";
		string UIWidget="Spinner";
		float UIMin=-100.0;
		float UIMax=100.0;
		float UIStep=0.01;
	> = {-0.22};
	//}
//{			Mult
	float EENV_emiVisionCalDayMult
	<
		string UIName="EENV EMI Vision Cal Day Mult";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=100.0;
		float UIStep=0.01;
	> = {3.5};
	float EENV_emiVisionCalNightMult
	<
		string UIName="EENV EMI Vision Cal Night Mult";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=100.0;
		float UIStep=0.01;
	> = {3.5};
	float EENV_emiVisionCalInteriorMult
	<
		string UIName="EENV EMI Vision Cal Interior Mult";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=100.0;
		float UIStep=0.01;
	> = {3.5};
	//}
//{			Use Color
	bool EENV_emiVisionCalUseColor <
		string UIName = "EENV EMI Vision Cal Use Color";
	> = {true};	
	float EENV_emiVisionCalColorR
	<
		string UIName="EENV EMI Vision Cal Color R";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.27};	
	float EENV_emiVisionCalColorG
	<
		string UIName="EENV EMI Vision Cal Color G";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.6};
	float EENV_emiVisionCalColorB
	<
		string UIName="EENV EMI Vision Cal Color B";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.92};
	float EENV_emiVisionCalRangeMin
	<
		string UIName="EENV EMI Vision Cal Color Range Min";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.01};
	float EENV_emiVisionCalRangeMax
	<
		string UIName="EENV EMI Vision Cal Color Range Max";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.1};
	
	// Interior EMI Color Calibration
	float EENV_emiVisionCalColorInteriorR
	<
		string UIName="EENV EMI Vision Cal Color Interior R";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.4341};	
	float EENV_emiVisionCalColorInteriorG
	<
		string UIName="EENV EMI Vision Cal Color Interior G";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.6285};
	float EENV_emiVisionCalColorInteriorB
	<
		string UIName="EENV EMI Vision Cal Color Interior B";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.7927};
	float EENV_emiVisionCalRangeInteriorMin
	<
		string UIName="EENV EMI Vision Cal Color Range Interior Min";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.01};
	float EENV_emiVisionCalRangeInteriorMax
	<
		string UIName="EENV EMI Vision Cal Color Range Interior Max";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
		float UIStep=0.01;
	> = {0.1};
	//}
//}
//{		Settings
//{			Color Correction
	float EENV_emiVisionGammaDay
	<
		string UIName="EENV EMI Vision Gamma Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.5};
	float EENV_emiVisionGammaNight
	<
		string UIName="EENV EMI Vision Gamma Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.5};
	float EENV_emiVisionGammaInterior
	<
		string UIName="EENV EMI Vision Gamma Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	float EENV_emiVisionHue
	<
		string UIName="EENV EMI Vision Hue";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
	> = {0.0};
	float EENV_emiVisionSaturationDay
	<
		string UIName="EENV EMI Vision Saturation Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	float EENV_emiVisionSaturationNight
	<
		string UIName="EENV EMI Vision Saturation Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	float EENV_emiVisionSaturationInterior
	<
		string UIName="EENV EMI Vision Saturation Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.75};
	float EENV_emiVisionValueDay
	<
		string UIName="EENV EMI Vision Value Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_emiVisionValueNight
	<
		string UIName="EENV EMI Vision Value Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_emiVisionValueInterior
	<
		string UIName="EENV EMI Vision Value Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	//}
//{			Bloom
	float EENV_emiVisionGameBloom
	<
		string UIName="EENV EMI Vision Game Bloom";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_emiVisionENBBloomDay
	<
		string UIName="EENV EMI Vision ENB Bloom Day";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.0};
	float EENV_emiVisionENBBloomNight
	<
		string UIName="EENV EMI Vision ENB Bloom Night";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.0};
	float EENV_emiVisionENBBloomInterior
	<
		string UIName="EENV EMI Vision ENB Bloom Interior";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.0};
	float EENV_emiVisionENBBloomGamma
	<
		string UIName="EENV EMI Vision ENB Bloom Gamma";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_emiVisionENBBloomTint
	<
		string UIName="EENV EMI Vision ENB Bloom Tint";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	//}
//{			Vignette
	#ifdef ENABLE_VIGNETTE
		float EENV_emiVisionVignette
		<
			string UIName="EENV EMI Vision Vignette";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=100.0;
		> = {0.0};
	#else
		float EENV_emiVisionVignette = 0;
	#endif // ENABLE_VIGNETTE
	//}
//{			Warping
	#ifdef ENABLE_WARPING
		float EENV_emiVisionWarp
		<
			string UIName="EENV EMI Vision Warp";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
	#else
		float EENV_emiVisionWarp = 0;
	#endif // ENABLE_WARPING
	//}
//{			Noise
	#ifdef ENABLE_NOISE
		float EENV_emiVisionNoise
		<
			string UIName="EENV EMI Vision Noise";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
	#else
		float EENV_emiVisionNoise = 0;
	#endif // ENABLE_NOISE
	//}
//{			Lens
	#ifdef ENABLE_LENS
		float EENV_emiVisionLensDay
		<
			string UIName="EENV EMI Vision Lens Day";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
		float EENV_emiVisionLensNight
		<
			string UIName="EENV EMI Vision Lens Night";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
		float EENV_emiVisionLensInterior
		<
			string UIName="EENV EMI Vision Lens Interior";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
	#else
		float EENV_emiVisionLensDay = 0;
		float EENV_emiVisionLensNight = 0;
		float EENV_emiVisionLensInterior = 0;
	#endif // ENABLE_LENS
	//}
//{			Scanlines
	#ifdef ENABLE_SCANLINES
		float EENV_emiVisionScanlinesDay
		<
			string UIName="EENV EMI Vision Scanlines Day";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
		float EENV_emiVisionScanlinesNight
		<
			string UIName="EENV EMI Vision Scanlines Night";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
		float EENV_emiVisionScanlinesInterior
		<
			string UIName="EENV EMI Vision Scanlines Interior";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
		float4 EENV_emiVisionScanlinesColor <
			string UIName="EENV EMI Vision Scanlines Color";
			string UIWidget="Color";
		> = {0.702, 0.529, 0, 1};
	#else
		float EENV_emiVisionScanlinesDay = 0;
		float EENV_emiVisionScanlinesNight = 0; 
		float EENV_emiVisionScanlinesInterior = 0;
		float4 EENV_emiVisionScanlinesColor = float4(1, 1, 1, 1);
	#endif
	//}
//}
#else
float EENV_emiVisionWarp = 0;
#endif // ENABLE_EMI_VISION
//}

//{  GENERAL IMOD CALIBRATION ####
#ifdef ENABLE_GENERAL_IMOD
	bool EENV_generalImodEnable <
		string UIName = "EENV General IMOD Enable";
	> = {true};
	float EENV_generalImodC19Min
	<
		string UIName="EENV General IMOD _c19.w Min";
		string UIWidget="Spinner";
		float UIMin=-0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {1.2};
	float EENV_generalImodC19Max
	<
		string UIName="EENV General IMOD _c19.w Max";
		string UIWidget="Spinner";
		float UIMin=-0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {2.0};
	float EENV_generalImodC20Min
	<
		string UIName="EENV General IMOD _c20.w Min";
		string UIWidget="Spinner";
		float UIMin=-0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {0.2};
	float EENV_generalImodC20Max
	<
		string UIName="EENV General IMOD _c20.w Max";
		string UIWidget="Spinner";
		float UIMin=-0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {0.5};
	float EENV_generalImodC22Min
	<
		string UIName="EENV General IMOD _c22.w Min";
		string UIWidget="Spinner";
		float UIMin=-0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {0.05};
	float EENV_generalImodC22Max
	<
		string UIName="EENV General IMOD _c22.w Max";
		string UIWidget="Spinner";
		float UIMin=-0.0;
		float UIMax=10.0;
		float UIStep=0.01;
	> = {0.2};
	// #### GENERAL IMOD SETTINGS ####
	float EENV_generalImodGamma
	<
		string UIName="EENV General IMOD Gamma";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_generalImodHue
	<
		string UIName="EENV General IMOD Hue";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=1.0;
	> = {0.0};
	float EENV_generalImodSaturation
	<
		string UIName="EENV General IMOD Saturation";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
		float EENV_generalImodValue
	<
		string UIName="EENV General IMOD Value";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_generalImodGameBloom
	<
		string UIName="EENV General IMOD Game Bloom";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.5};
	float EENV_generalImodENBBloom
	<
		string UIName="EENV General IMOD ENB Bloom";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {0.0};
	float EENV_generalImodENBBloomGamma
	<
		string UIName="EENV General IMOD ENB Bloom Gamma";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
	float EENV_generalImodENBBloomTint
	<
		string UIName="EENV General IMOD ENB Bloom Tint";
		string UIWidget="Spinner";
		float UIMin=0.0;
		float UIMax=10.0;
	> = {1.0};
#endif // ENABLE_GENERAL_IMOD
//}

//{  EFFECT CONTROLS ####
#ifdef ENABLE_NOISE
	bool EENV_noiseEnable <
		string UIName = "EENV Noise Enable";
	> = {true};
#endif // ENABLE_NOISE
	
	// Vignette
	#ifdef ENABLE_VIGNETTE
		bool EENV_vignetteEnable <
			string UIName = "EENV Vignette Enable";
		> = {true};
		float EENV_vignetteMinDistance
		<
			string UIName="EENV Vignette Min Distance";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.5};

		float EENV_vignetteMaxDistance
		<
			string UIName="EENV Vignette Max Distance";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {1.0};

		float EENV_vignetteDistancePower
		<
			string UIName="EENV Vignette Distance Power";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {1.5};

		float EENV_vignetteAspectRatio
		<
			string UIName="EENV Vignette Aspect Ratio Power";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {1.66};
	#endif // ENABLE_VIGNETTE
	
	// Warp
	#ifdef ENABLE_WARPING
		bool EENV_warpEnable <
			string UIName = "EENV Warp Enable";
		> = {true};
		float EENV_warpMinDistance
		<
			string UIName="EENV Warp Min Distance";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.25};
		float EENV_warpMaxDistance
		<
			string UIName="EENV Warp Max Distance";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {1.0};
		float EENV_warpDistancePower
		<
			string UIName="EENV Warp Distance Power";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {1.75};
		float EENV_warpAspectRatio
		<
			string UIName="EENV Warp Aspect Ratio";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {1.0};
		float EENV_warpShift
		<
			string UIName="Warp Shift";
			string UIWidget="Spinner";
			float UIMin=-10.0;
			float UIMax=10.0;
		> = {0.0};
	#endif // ENABLE_WARPING
	
	// Lens
	#ifdef ENABLE_LENS
		bool EENV_lensEnable <
			string UIName = "EENV Lens Enable";
		> = {true};
		bool EENV_lensWarp <
			string UIName = "EENV Lens Warp";
		> = {true};
		float EENV_lensAdaptationMin
		<
			string UIName="EENV Lens Adaptation Min";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.0};
		float EENV_lensAdaptationMax
		<
			string UIName="EENV Lens Adaptation Max";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.1};
		float EENV_lensAdaptationGamma
		<
			string UIName="EENV  Lens Adaptation Gamma";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {2.0};
		float EENV_lensTextureScaleX
		<
			string UIName="EENV Lens Texture ScaleX";
			string UIWidget="Spinner";
			float UIMin=-10.0;
			float UIMax=10.0;
		> = {1.0};
		float EENV_lensTextureScaleY
		<
			string UIName="EENV Lens Texture ScaleY";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {1.0};
	#endif // ENABLE_LENS
	
	// Scanlines
	#ifdef ENABLE_SCANLINES
		bool EENV_scanlinesEnable <
			string UIName = "EENV Scanlines Enable";
		> = {true};
		bool EENV_scanlinesWarp <
			string UIName = "EENV Scanlines Warp";
		> = {true};
		float EENV_scanlinesFrequency
		<
			string UIName="EENV Scanlines Frequency";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=5000.0;
		> = {1000.0};
		float EENV_scanlinesSpeed
		<
			string UIName="EENV Scanlines Speed";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=100.0;
		> = {50.0};
		bool EENV_ScannerLinesEnable <
			string UIName = "EENV Scanner Lines Enable";
		> = {true};
		int EENV_ScannerLinesNum <
			string UIName="EENV Scanner Lines Number";
			string UIWidget="Spinner";
			int UIMin = 1;
			int UIMax = 10;
		> = {2};
		float EENV_ScannerLinesIntensity
		<
			string UIName="EENV Scanner Lines Intensity";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=1000.0;
		> = {50.0};
		float EENV_ScannerLinesDistance
		<
			string UIName="EENV Scanner Lines Distance";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=10.0;
		> = {0.1};
		float EENV_ScannerLinesDistancePower
		<
			string UIName="EENV Scanner Lines Distance Power";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=500.0;
		> = {20.0};
		float EENV_ScannerLinesSpeed
		<
			string UIName="EENV Scanner Lines Speed";
			string UIWidget="Spinner";
			float UIMin=0.0;
			float UIMax=500.0;
		> = {10.0};
	#endif // ENABLE_SCANLINES
//}
//}
// ##########################
// END NIGHTEYE  PARAMETERS
// ##########################

//+++++++++++++++++++++++++++++
//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=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;
//changes 0 or 1. 0 means that exterior, 1 - interior
float	EInteriorFactor;
//enb version of bloom applied, ignored if original post processing used
float	EBloomAmount;

//===============//
// 3D LUT helper //
//===============//

#define LOAD_TEXTURE( Name, Path, sampler, UV ) \
texture2D tex##Name <string ResourceName= #Path ; >; \
sampler2D Sampler##Name = sampler_state {   \
    Texture   = < tex##Name >; SRGBTexture=FALSE;   \
    MinFilter = sampler; MagFilter = sampler; MipFilter = NONE; \
    AddressU = UV; AddressV = UV; }
	
LOAD_TEXTURE( LUT_1,          LUT_1.bmp,          LINEAR, CLAMP );
LOAD_TEXTURE( LUT_2,          LUT_2.bmp,          LINEAR, CLAMP );
LOAD_TEXTURE( LUT_3,          LUT_3.bmp,          LINEAR, CLAMP );
LOAD_TEXTURE( LUT_4,          LUT_4.bmp,          LINEAR, CLAMP );

//===============//
// 3D LUT helper //
//===============//

texture2D texs0;//color falloutnv
texture2D texs1;//bloom falloutnv
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 _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;
};

//========== DITHERING ==========================================

	float InterleavedGradientNoise( float2 uv )
	{
		float3 magic = { 0.06711056, 0.00583715, 52.9829189 };
		return frac( magic.z * frac( dot( uv, magic.xy ) ) );
	}

//========== DITHERING ==========================================
	
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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;
}


//==============//
// LUT Function //
//==============//

static const float2 CLut_Size = float2(256.0, 16.0);

float3 CLutFunc( float3 colorIN, sampler2D LutSampler ) {
    float2 CLut_pSize = 1.0 / CLut_Size;
    float4 CLut_UV;
    colorIN    = saturate(colorIN) * ( CLut_Size.y - 1.0);
    CLut_UV.w  = floor(colorIN.b);
    CLut_UV.xy = (colorIN.rg + 0.5) * CLut_pSize;
    CLut_UV.x += CLut_UV.w * CLut_pSize.y;
    CLut_UV.z  = CLut_UV.x + CLut_pSize.y;
    return lerp( tex2Dlod(LutSampler, CLut_UV.xyzz).rgb, 
                 tex2Dlod(LutSampler, CLut_UV.zyzz).rgb, colorIN.b - CLut_UV.w);
}

//==============//
// LUT Function //
//==============//

//falloutnv shader specific externals, do not modify
float4	_c1 : register(c1);
float4	_c2 : register(c2);
float4	_c19 : register(c19);
float4	_c20 : register(c20);
float4	_c22 : register(c22);

float4 PS_C1DAE3F7(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
{
	float4 _oC0=0.0; //output

	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;
	
	// ##########################
	// BEGIN NIGHTEYE SETUP
	// ##########################
	// Default(Off) Values (used in Implementation section
	float EENV_nightVisionT = 0.0;
	float EENV_thermalVisionT = 0.0;
	float EENV_emiVisionT = 0.0;
	float EENV_warpT = 0.0;
	float EENV_generalImodT = 0.0;
	float4 EENV_gameCC=tex2D(_s0, _v0.xy);
	float4 EENV_Reg1 = _c1;
	float4 EENV_Reg2 = _c2;
	float4 EENV_Reg3 = _c19;
	float4 EENV_Reg4 = _c20;
	float4 EENV_Reg5 = _c22;
	
	if (EENV_Enable)
	{

		// EENV_nightVisionT
		#ifdef ENABLE_NIGHT_VISION
			//if(EENV_nightVisionEnable)
			//{
				float3 nightVisionDayFactor = clamp((EENV_Reg3.w + EENV_nightVisionCalDayOffset) * EENV_nightVisionCalDayMult, 0.0, 1.0);
				float3 nightVisionNightFactor = clamp((EENV_Reg3.w + EENV_nightVisionCalNightOffset) * EENV_nightVisionCalNightMult, 0.0, 1.0);
				float3 nightVisionInteriorFactor = clamp((EENV_Reg3.w + EENV_nightVisionCalInteriorOffset) * EENV_nightVisionCalInteriorMult, 0.0, 1.0);
				EENV_nightVisionT = lerp(lerp(nightVisionNightFactor, nightVisionDayFactor, ENightDayFactor), nightVisionInteriorFactor, EInteriorFactor);
				if (EENV_nightVisionCalUseColor)
				{
					float nightVisionRedT = 	lerp(1.0, 0.0, EENV_linStep(EENV_nightVisionCalRangeMin, EENV_nightVisionCalRangeMax, abs(EENV_Reg4.x - EENV_nightVisionCalColorR)));
					float nightVisionGreenT = 	lerp(1.0, 0.0, EENV_linStep(EENV_nightVisionCalRangeMin, EENV_nightVisionCalRangeMax, abs(EENV_Reg4.y - EENV_nightVisionCalColorG)));
					float nightVisionBlueT = 	lerp(1.0, 0.0, EENV_linStep(EENV_nightVisionCalRangeMin, EENV_nightVisionCalRangeMax, abs(EENV_Reg4.z - EENV_nightVisionCalColorB)));
					float nightVisionColorFactor = lerp(0.0, 1.0, min(min(nightVisionRedT, nightVisionGreenT), nightVisionBlueT));
					EENV_nightVisionT *= nightVisionColorFactor;
				}
			//}
		#endif // ENABLE_NIGHT_VISION
		
		// EENV_thermalVisionT
		#ifdef ENABLE_THERMAL_VISION
			//if(EENV_thermalVisionEnable)
			//{
				float3 thermalVisionDayFactor = clamp((EENV_Reg5.w + EENV_thermalVisionCalDayOffset) * EENV_thermalVisionCalDayMult, 0.0, 1.0);
				float3 thermalVisionNightFactor = clamp((EENV_Reg5.w + EENV_thermalVisionCalNightOffset) * EENV_thermalVisionCalNightMult, 0.0, 1.0);
				float3 thermalVisionInteriorFactor = clamp((EENV_Reg5.w + EENV_thermalVisionCalInteriorOffset) * EENV_thermalVisionCalInteriorMult, 0.0, 1.0);
				EENV_thermalVisionT = lerp(lerp(thermalVisionNightFactor, thermalVisionDayFactor, ENightDayFactor), thermalVisionInteriorFactor, EInteriorFactor);
				if (EENV_thermalVisionCalUseColor)
				{
					float thermalVisionRedT = 	lerp(1.0, 0.0, EENV_linStep(EENV_thermalVisionCalRangeMin, EENV_thermalVisionCalRangeMax, abs(EENV_Reg5.x - EENV_thermalVisionCalColorR)));
					float thermalVisionGreenT = lerp(1.0, 0.0, EENV_linStep(EENV_thermalVisionCalRangeMin, EENV_thermalVisionCalRangeMax, abs(EENV_Reg5.y - EENV_thermalVisionCalColorG)));
					float thermalVisionBlueT = 	lerp(1.0, 0.0, EENV_linStep(EENV_thermalVisionCalRangeMin, EENV_thermalVisionCalRangeMax, abs(EENV_Reg5.z - EENV_thermalVisionCalColorB)));
					float thermalVisionColorFactor = lerp(0.0, 1.0, min(min(thermalVisionRedT, thermalVisionGreenT), thermalVisionBlueT));
					EENV_thermalVisionT *= thermalVisionColorFactor;
				}
			//}
		#endif // ENABLE_THERMAL_VISION
		
		// EENV_emiVisionT
		#ifdef ENABLE_EMI_VISION
			//if(EENV_emiVisionEnable)
			//{
				float3 emiVisionDayFactor = clamp((EENV_Reg3.y + EENV_emiVisionCalDayOffset) * EENV_emiVisionCalDayMult, 0.0, 1.0);
				float3 emiVisionNightFactor = clamp((EENV_Reg3.y + EENV_emiVisionCalNightOffset) * EENV_emiVisionCalNightMult, 0.0, 1.0);
				float3 emiVisionInteriorFactor = clamp((EENV_Reg3.y + EENV_emiVisionCalInteriorOffset) * EENV_emiVisionCalInteriorMult, 0.0, 1.0);
				EENV_emiVisionT = lerp(lerp(emiVisionNightFactor, emiVisionDayFactor, ENightDayFactor), emiVisionInteriorFactor, EInteriorFactor);
				if (EENV_emiVisionCalUseColor)
				{
					float emiVisionRedT = 	lerp(1.0, 0.0, EENV_linStep(EENV_emiVisionCalRangeMin, EENV_emiVisionCalRangeMax, abs(EENV_Reg4.x - EENV_emiVisionCalColorR)));
					float emiVisionGreenT = lerp(1.0, 0.0, EENV_linStep(EENV_emiVisionCalRangeMin, EENV_emiVisionCalRangeMax, abs(EENV_Reg4.y - EENV_emiVisionCalColorG)));
					float emiVisionBlueT = 	lerp(1.0, 0.0, EENV_linStep(EENV_emiVisionCalRangeMin, EENV_emiVisionCalRangeMax, abs(EENV_Reg4.z - EENV_emiVisionCalColorB)));
					float emiVisionColorFactor = lerp(0.0, 1.0, min(min(emiVisionRedT, emiVisionGreenT), emiVisionBlueT));
					
					// Interior EMI Color Cal
					float emiVisionRedInteriorT = 	lerp(1.0, 0.0, EENV_linStep(EENV_emiVisionCalRangeInteriorMin, EENV_emiVisionCalRangeInteriorMax, abs(EENV_Reg4.x - EENV_emiVisionCalColorInteriorR)));
					float emiVisionGreenInteriorT = lerp(1.0, 0.0, EENV_linStep(EENV_emiVisionCalRangeInteriorMin, EENV_emiVisionCalRangeInteriorMax, abs(EENV_Reg4.y - EENV_emiVisionCalColorInteriorG)));
					float emiVisionBlueInteriorT = 	lerp(1.0, 0.0, EENV_linStep(EENV_emiVisionCalRangeInteriorMin, EENV_emiVisionCalRangeInteriorMax, abs(EENV_Reg4.z - EENV_emiVisionCalColorInteriorB)));
					float emiVisionColorInteriorFactor = lerp(0.0, 1.0, min(min(emiVisionRedInteriorT, emiVisionGreenInteriorT), emiVisionBlueInteriorT));
					
					EENV_emiVisionT *= lerp(emiVisionColorFactor, emiVisionColorInteriorFactor, EInteriorFactor);
				}
			//}
		#endif // ENABLE_EMI_VISION

		// EENV_generalImodT
		#ifdef ENABLE_GENERAL_IMOD
			if(EENV_generalImodEnable)
			{
				float generalImodC19_T = EENV_linStep(EENV_generalImodC19Min, EENV_generalImodC19Max,  EENV_Reg3.w);
				float generalImodC20_T = EENV_linStep(EENV_generalImodC20Min, EENV_generalImodC20Max,  EENV_Reg4.w);
				float generalImodC22_T = EENV_linStep(EENV_generalImodC22Min, EENV_generalImodC22Max,  EENV_Reg5.w);
				EENV_generalImodT = max(max(generalImodC19_T, generalImodC20_T), generalImodC22_T);
			}
		#endif // ENABLE_GENERAL_IMOD
		
		// Warping
		#ifdef ENABLE_WARPING
			EENV_warpT = 	EENV_nightVisionWarp * EENV_nightVisionT +
							EENV_thermalVisionWarp * EENV_thermalVisionT +
							EENV_emiVisionWarp * EENV_emiVisionT;
			
			float2 warpedTxCoords = IN.txcoord0;
			
			if(EENV_warpT > 0 && EENV_warpEnable)
			{
				float2 center = float2(0.5, 0.5);
				float2 warpedTxCoords = IN.txcoord0;
				float2 txCorrected = float2((warpedTxCoords.x - center.x) * 
					ScreenSize.z / EENV_warpAspectRatio + center.x, warpedTxCoords.y);
				float dist = distance(txCorrected, center);
				float2 warpVector = (txCorrected - center) / dist;

				float distT = EENV_linStep(EENV_warpMinDistance, EENV_warpMaxDistance, dist);
				distT = pow(distT, EENV_warpDistancePower);
				
				warpedTxCoords += EENV_warpT * -0.05 * 
					(distT + EENV_warpShift * 0.1) * warpVector;

				// Mirror and wrap if warped beyond screen border
				warpedTxCoords = fmod(abs(warpedTxCoords), 2.0);
				if(warpedTxCoords.x > 1.0) warpedTxCoords.x = warpedTxCoords.x - 2.0 * (warpedTxCoords.x - 1.0);
				if(warpedTxCoords.y > 1.0) warpedTxCoords.y = warpedTxCoords.y - 2.0 * (warpedTxCoords.y - 1.0);

				_v0.xy = warpedTxCoords.xy;
			}
		#endif // ENABLE_WARPING
	}
	// ##########################
	// END NIGHTEYE SETUP
	// ##########################	
	
	r1=tex2D(_s0, _v0.xy); //color
	

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

	xcolorbloom.xyz=xcolorbloom-r1;
	xcolorbloom.xyz=max(xcolorbloom, 0.0);
	r1.xyz+=xcolorbloom*EBloomAmount;

	r11=r1; //my bypass
	_oC0.xyz=r1.xyz; //for future use without game color corrections

//==============//
// DNI Function //
//==============//
	
	float hnd = ENightDayFactor;
	float pi = (1-EInteriorFactor);
	
//==============//
// DNI Function //
//==============//	

	float4 color=_oC0;


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

//========== PP2 =================================

	float newEAdaptationMax = lerp( EAdaptationMaxV2Interior, ( lerp( EAdaptationMaxV2Night, EAdaptationMaxV2Day, hnd ) ), pi );
	float newEAdaptationMin = lerp( EAdaptationMinV2Interior, ( lerp( EAdaptationMinV2Night, EAdaptationMinV2Day, hnd ) ), pi );
	float newEBrightnessV2 = lerp( EBrightnessV2Interior, ( lerp( EBrightnessV2Night, EBrightnessV2Day, hnd ) ), pi );
	float newEToneMappingCurve = lerp( ( EToneMappingCurveV2Interior*fInteriorlevel ), ( lerp( ( EToneMappingCurveV2Night*fNightlevel ), EToneMappingCurveV2Day, hnd ) ), pi );
	float newEIntensityContrastV2 = lerp( EIntensityContrastV2Interior, ( lerp( EIntensityContrastV2Night, EIntensityContrastV2Day, hnd ) ), pi );
	float newEToneMappingOversaturationV2 = lerp( EToneMappingOversaturationV2Interior, ( lerp( EToneMappingOversaturationV2Night, EToneMappingOversaturationV2Day, hnd ) ), pi );
	float newEColorSaturationV2 = lerp( EColorSaturationV2Interior, ( lerp( EColorSaturationV2Night, EColorSaturationV2Day, hnd ) ), pi );

	grayadaptation=max(grayadaptation, 0.0);
	grayadaptation=min(grayadaptation, 50.0);
	color.xyz=color.xyz/(grayadaptation*newEAdaptationMax+newEAdaptationMin);//*tempF1.x

	color.xyz*=(newEBrightnessV2);
	color.xyz+=0.000001;
	float3 xncol=normalize(color.xyz);
	float3 scl=color.xyz/xncol.xyz;
	scl=pow(scl, newEIntensityContrastV2);
	xncol.xyz=pow(xncol.xyz, newEColorSaturationV2);
	color.xyz=scl*xncol.xyz;

	float	lumamax=newEToneMappingOversaturationV2;
	color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + newEToneMappingCurve);

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

//////////////////////////////////////////////////////////////////////////////
//LUT Switch
//////////////////////////////////////////////////////////////////////////////	
	
//    color.rgb = CLutFunc(color.rgb, SamplerLUT_1);
	
    if (LUTSwitch==1) {
    color.rgb = CLutFunc(color.rgb, SamplerLUT_1);
   }
   
   if (LUTSwitch==2) {
   color.rgb = CLutFunc(color.rgb, SamplerLUT_2);
   }
   
   if (LUTSwitch==3) {
   color.rgb = CLutFunc(color.rgb, SamplerLUT_3);
   }
   
      if (LUTSwitch==4) {
   color.rgb = CLutFunc(color.rgb, SamplerLUT_4);
   }
	
//////////////////////////////////////////////////////////////////////////////
//LUT Switch
//////////////////////////////////////////////////////////////////////////////	

#ifdef E_CC_PROCEDURAL
	float	tempgray;
	float4	tempvar;
	float3	tempcolor;
/*
	//these replaced by "levels"
	//+++ gamma
	if (ECCGamma!=1.0)
	color=pow(color, 1.0/ECCGamma);

	//+++ brightness like in photoshop
	color=color+ECCAditiveBrightness;

	//+++ lightness
	tempvar.x=saturate(ELightness);
	tempvar.y=saturate(1.0+ECCLightness);
	color=tempvar.x*(1.0-color) + (tempvar.y*color);
*/
	//+++ levels like in photoshop, including gamma, lightness, additive brightness
	color=max(color-ECCInBlack, 0.0) / max(ECCInWhite-ECCInBlack, 0.0001);
	if (ECCGamma!=1.0) color=pow(color, ECCGamma);
	color=color*(ECCOutWhite-ECCOutBlack) + ECCOutBlack;

	//+++ brightness
	color=color*ECCBrightness;

	//+++ contrast
	color=(color-ECCContrastGrayLevel) * ECCContrast + ECCContrastGrayLevel;

	//+++ saturation
	tempgray=dot(color.xyz, 0.3333);
	color=lerp(tempgray, color, ECCSaturation);

	//+++ desaturate shadows
	tempgray=dot(color.xyz, 0.3333);
	tempvar.x=saturate(1.0-tempgray);
	tempvar.x*=tempvar.x;
	tempvar.x*=tempvar.x;
	color=lerp(color, tempgray, ECCDesaturateShadows*tempvar.x);

	//+++ color balance
	color=saturate(color);
	tempgray=dot(color.xyz, 0.3333);
	float2	shadow_highlight=float2(1.0-tempgray, tempgray);
	shadow_highlight*=shadow_highlight;
	color.rgb+=(ECCColorBalanceHighlights*2.0-1.0)*color * shadow_highlight.x;
	color.rgb+=(ECCColorBalanceShadows*2.0-1.0)*(1.0-color) * shadow_highlight.y;

	//+++ channel mixer
	tempcolor=color;
	color.r=dot(tempcolor, ECCChannelMixerR);
	color.g=dot(tempcolor, ECCChannelMixerG);
	color.b=dot(tempcolor, ECCChannelMixerB);
#endif //E_CC_PROCEDURAL

//========== DITHERING ==========================================

	if ( HHKingDither == true )
	{
		float noise = lerp(-0.5, 0.5, InterleavedGradientNoise( vPos )) * dither_amp;

		if ( HHDitherAdapt == true )
		{
			float Lvl = color.r + color.g + color.b;
			float DitherAdapt = 3.0 - Lvl;
			if ( DitherAdapt < 0 ) DitherAdapt = 0.0;
			noise *= DitherAdapt;
		};

		#if   DITHER_METHOD == 0 //linear
			color.xyz = color.xyz + noise / 255.0;
		#elif DITHER_METHOD == 1 //srgb
			color.xyz = pow( pow( color.xyz, 1.0 / 2.2) + noise / 255.0, 2.2);
		#else //energy-preserved [gdc16]
			color.xyz = pow(color.xyz, 1.0/2.2);
			color.xyz = color.xyz + noise * min(color.xyz + 0.5 * pow(1.0/255.0, 2.2), 0.75 * (pow(256.0/255.0, 2.2) - 1.0));
			color.xyz = pow(color.xyz, 2.2);
		#endif
	};
	
//========== DITHERING ==========================================	



	_oC0.w=1.0;
	
	// ##############################
	// BEGIN NIGHTEYE  IMPLEMENTATION
	// ##############################
	if(EENV_Enable)
	{
		if(EENV_Game_CC_Override_Enable)
		{
			// Game Color Correction
			r0=tex2D(_s0, _v0.xy);
			r1=tex2D(_s1, _v0.xy);
			r0.w=max(r1.w, _c1.x);
			r0.w=1.0/r0.w;
			r1.w=r0.w * 0.5;
			r0.w=r0.w * _c1.x;
			r1.xyz=r1 * r1.w;
			r2.xyz=max(r1, 0.0);
			r0.xyz=r0.w * r0 + r2.xyz;
			r0.w=dot(r0.xyz, float3(0.298999995, 0.587000012, 0.114));
			r1.xyz=lerp(r0.w, r0, _c19.x);
			r0.xyz=_c20 * r0.w - r1;
			r0.xyz=_c20.w * r0 + r1;
			r0.xyz=_c19.w * r0 - _c19.y;
			r0.xyz=_c19.z * r0 + _c19.y;
			r1.xyz=lerp(r0, _c22, _c22.w);
			r1.w=_c2.z;
			EENV_gameCC=r1;
			color.xyz = EENV_gameCC;
		}
		else
		{
			// Vignette
			float vignette = 1.0;
			#ifdef ENABLE_VIGNETTE
				if (EENV_vignetteEnable)
				{
					float2 center = float2(0.5, 0.5);
					float2 txCorrected = float2((IN.txcoord0.x - center.x) * 
						ScreenSize.z / EENV_vignetteAspectRatio + center.x, IN.txcoord0.y);
					float distT = EENV_linStep(EENV_vignetteMaxDistance, EENV_vignetteMinDistance, distance(txCorrected, center));
					vignette = pow(distT, EENV_vignetteDistancePower);
				}
			#endif // ENABLE_VIGNETTE

			// Noise
			float3 noiseVal = 0.0;
			#ifdef ENABLE_NOISE
				if (EENV_noiseEnable)
				{
					float3 noiseCoord = float3(_v0.x, _v0.y, Timer.x);
					noiseVal = EENV_randomNoise(noiseCoord);
				}
			#endif // ENABLE_NOISE
					
			// Lens
			float3	lensTexture = 0.0;
			float lensAdaptation = 0.0;
			#ifdef ENABLE_LENS
				if(EENV_lensEnable)
				{
					// Adaptation
					float3 adaptationENB = tex2D(_s4, IN.txcoord0);
					lensAdaptation = EENV_linStep(EENV_lensAdaptationMin, EENV_lensAdaptationMax, adaptationENB);
					lensAdaptation = pow(lensAdaptation, EENV_lensAdaptationGamma);

					float2 lensCoords = IN.txcoord0;
					if (EENV_lensWarp) lensCoords = _v0;
					lensCoords -= float2(0.5, 0.5);
					lensCoords *= float2(EENV_lensTextureScaleX, EENV_lensTextureScaleY);
					lensCoords += float2(0.5, 0.5);
					lensCoords.x = fmod(abs(lensCoords.x), 1.0);
					lensCoords.y = fmod(abs(lensCoords.y), 1.0);
					lensTexture=tex2D(EENV_LensMaskSampler, lensCoords);
				}
			#endif // ENABLE_LENS
			
			// Scanlines and Scanner Lines
			float scanlinesPattern = 0.0;
			float scannerLinesPattern = 0.0;
			#ifdef ENABLE_SCANLINES
				float2 scanLineCoords = IN.txcoord0;
				if (EENV_scanlinesWarp) scanLineCoords = _v0;
				if (EENV_scanlinesEnable)
				{
					scanlinesPattern = 0.5 + 0.5 * cos((scanLineCoords.y * EENV_scanlinesFrequency) + EENV_scanlinesSpeed * Timer.x * 10000.0);
				}
				if (EENV_ScannerLinesEnable)
				{
					const float offsets[10] = {0.0, 0.342, 0.5231, 0.632, 0.872, 0.2314, 0.4542, 0.75643, 0.93231, 1.0};
					const float speeds[10] = {0.214, 0.342, 0.5231, 0.632, 0.872, .1243, .721, 0.666, 0.151, 0.434};
					for (int i = 0; i < EENV_ScannerLinesNum; i++)
					{
						float linePosition = 0.5 + 0.5 * cos(offsets[i] + EENV_ScannerLinesSpeed * Timer.x * 5000.0 * speeds[i]);
						float dist = abs(scanLineCoords.y - linePosition);
						scannerLinesPattern += EENV_ScannerLinesIntensity * 
							pow(1.0 - EENV_linStep(0.0, EENV_ScannerLinesDistance, dist), EENV_ScannerLinesDistancePower);
					}
				}
			#endif // ENABLE_SCANLINES
			
			// ENB Bloom
			float3 ENBBloom = tex2D(_s3, _v0);
			
			// Night Vision
			#ifdef ENABLE_NIGHT_VISION
				if(EENV_nightVisionEnable && EENV_nightVisionT > 0)
				{
					// Game Color Correction
					float EENV_nightVisionGamma = lerp(lerp(EENV_nightVisionGammaNight, EENV_nightVisionGammaDay, ENightDayFactor), EENV_nightVisionGammaInterior, EInteriorFactor);
					r0=pow(tex2D(_s0, _v0.xy), EENV_nightVisionGamma);
					r1=tex2D(_s1, _v0.xy) * EENV_nightVisionGameBloom;
					r0.w=max(r1.w, _c1.x);
					r0.w=1.0/r0.w;
					r1.w=r0.w * 0.5;
					r0.w=r0.w * _c1.x;
					r1.xyz=r1 * r1.w;
					r2.xyz=max(r1, 0.0);
					r0.xyz=r0.w * r0 + r2.xyz;
					r0.w=dot(r0.xyz, float3(0.298999995, 0.587000012, 0.114));
					r1.xyz=lerp(r0.w, r0, _c19.x);
					r0.xyz=_c20 * r0.w - r1;
					r0.xyz=_c20.w * r0 + r1;
					r0.xyz=_c19.w * r0 - _c19.y;
					r0.xyz=_c19.z * r0 + _c19.y;
					r1.xyz=lerp(r0, _c22, _c22.w);
					r1.w=_c2.z;
					EENV_gameCC=r1;
						
					float3 nightVision = EENV_gameCC;
					nightVision += noiseVal * EENV_nightVisionNoise;
					float lensDNI = lerp(lerp(EENV_nightVisionLensNight, EENV_nightVisionLensDay, ENightDayFactor), EENV_nightVisionLensInterior, EInteriorFactor);
					nightVision += lensAdaptation * lensDNI * lensTexture;
					float scanlinesDNI = lerp(lerp(EENV_nightVisionScanlinesNight, EENV_nightVisionScanlinesDay, ENightDayFactor), EENV_nightVisionScanlinesInterior, EInteriorFactor);

					
					nightVision += pow(lerp(ENBBloom, ENBBloom * EENV_Reg4, EENV_nightVisionENBBloomTint), EENV_nightVisionENBBloomGamma) * 
						(EENV_nightVisionENBBloom + scannerLinesPattern * scanlinesDNI);
					nightVision = EENV_RGBtoHSV(nightVision);
					nightVision.x += EENV_nightVisionHue;
					float EENV_nightVisionSaturation = lerp(lerp(EENV_nightVisionSaturationNight, EENV_nightVisionSaturationDay, ENightDayFactor), EENV_nightVisionSaturationInterior, EInteriorFactor);
					nightVision.y *= EENV_nightVisionSaturation;
					float EENV_nightVisionValue = lerp(lerp(EENV_nightVisionValueNight, EENV_nightVisionValueDay, ENightDayFactor), EENV_nightVisionValueInterior, EInteriorFactor);
					nightVision.z *= EENV_nightVisionValue;
					nightVision = EENV_HSVtoRGB(nightVision);
					nightVision *= lerp(1.0, vignette, EENV_nightVisionVignette);
					color.xyz = lerp(color.xyz, nightVision.xyz, EENV_nightVisionT);
					color.xyz = lerp(color.xyz, EENV_nightVisionScanlinesColor.xyz, scanlinesDNI * scanlinesPattern);
				}
			#endif // ENABLE_NIGHT_VISION
			
			// Thermal Vision
			#ifdef ENABLE_THERMAL_VISION
				if(EENV_thermalVisionEnable && EENV_thermalVisionT > 0)
				{
					// Game Color Correction
					float EENV_thermalVisionGamma = lerp(lerp(EENV_thermalVisionGammaNight, EENV_thermalVisionGammaDay, ENightDayFactor), EENV_thermalVisionGammaInterior, EInteriorFactor);
					r0=pow(tex2D(_s0, _v0.xy), EENV_thermalVisionGamma);
					r1=tex2D(_s1, _v0.xy) * EENV_thermalVisionGameBloom;
					r0.w=max(r1.w, _c1.x);
					r0.w=1.0/r0.w;
					r1.w=r0.w * 0.5;
					r0.w=r0.w * _c1.x;
					r1.xyz=r1 * r1.w;
					r2.xyz=max(r1, 0.0);
					r0.xyz=r0.w * r0 + r2.xyz;
					r0.w=dot(r0.xyz, float3(0.298999995, 0.587000012, 0.114));
					r1.xyz=lerp(r0.w, r0, _c19.x);
					r0.xyz=_c20 * r0.w - r1;
					r0.xyz=_c20.w * r0 + r1;
					r0.xyz=_c19.w * r0 - _c19.y;
					r0.xyz=_c19.z * r0 + _c19.y;
					r1.xyz=lerp(r0, _c22, _c22.w);
					r1.w=_c2.z;
					EENV_gameCC=r1;
					
					float3 thermalVision = EENV_gameCC.xyz;
					thermalVision += noiseVal * EENV_thermalVisionNoise;
					float lensDNI = lerp(lerp(EENV_thermalVisionLensNight, EENV_thermalVisionLensDay, ENightDayFactor), EENV_thermalVisionLensInterior, EInteriorFactor);
					thermalVision += lensAdaptation * lensDNI * lensTexture;
					float scanlinesDNI = lerp(lerp(EENV_thermalVisionScanlinesNight, EENV_thermalVisionScanlinesDay, ENightDayFactor), EENV_thermalVisionScanlinesInterior, EInteriorFactor);

					thermalVision += pow(lerp(ENBBloom, ENBBloom * EENV_Reg5, EENV_thermalVisionENBBloomTint), EENV_thermalVisionENBBloomGamma) * 
						(EENV_thermalVisionENBBloom + scannerLinesPattern * scanlinesDNI);
					thermalVision = EENV_RGBtoHSV(thermalVision);
					thermalVision.x += EENV_thermalVisionHue;
					float EENV_thermalVisionSaturation = lerp(lerp(EENV_thermalVisionSaturationNight, EENV_thermalVisionSaturationDay, ENightDayFactor), EENV_thermalVisionSaturationInterior, EInteriorFactor);
					thermalVision.y *= EENV_thermalVisionSaturation;
					float EENV_thermalVisionValue = lerp(lerp(EENV_thermalVisionValueNight, EENV_thermalVisionValueDay, ENightDayFactor), EENV_thermalVisionValueInterior, EInteriorFactor);
					thermalVision.z *= EENV_thermalVisionValue;
					thermalVision = EENV_HSVtoRGB(thermalVision);
					//thermalVision = ((thermalVision - 0.5) * max(EENV_thermalVisionContrast + 1.0, 0)) + 0.5;  
					thermalVision *= lerp(1.0, vignette, EENV_thermalVisionVignette);
					color.xyz = lerp(color.xyz, thermalVision.xyz, EENV_thermalVisionT);
					color.xyz = lerp(color.xyz, EENV_thermalVisionScanlinesColor.xyz, scanlinesDNI * scanlinesPattern);
				}
			#endif // ENABLE_THERMAL_VISION
			
			// EMI Vision
			#ifdef ENABLE_EMI_VISION
				if(EENV_emiVisionEnable && EENV_emiVisionT > 0)
				{
					// Game Color Correction
					float EENV_emiVisionGamma = lerp(lerp(EENV_emiVisionGammaNight, EENV_emiVisionGammaDay, ENightDayFactor), EENV_emiVisionGammaInterior, EInteriorFactor);
					r0=pow(tex2D(_s0, _v0.xy), EENV_emiVisionGamma);
					r1=tex2D(_s1, _v0.xy) * EENV_emiVisionGameBloom;
					r0.w=max(r1.w, _c1.x);
					r0.w=1.0/r0.w;
					r1.w=r0.w * 0.5;
					r0.w=r0.w * _c1.x;
					r1.xyz=r1 * r1.w;
					r2.xyz=max(r1, 0.0);
					r0.xyz=r0.w * r0 + r2.xyz;
					r0.w=dot(r0.xyz, float3(0.298999995, 0.587000012, 0.114));
					r1.xyz=lerp(r0.w, r0, _c19.x);
					r0.xyz=_c20 * r0.w - r1;
					r0.xyz=_c20.w * r0 + r1;
					r0.xyz=_c19.w * r0 - _c19.y;
					r0.xyz=_c19.z * r0 + _c19.y;
					r1.xyz=lerp(r0, _c22, _c22.w);
					r1.w=_c2.z;
					EENV_gameCC=r1;
					
					float3 emiVision = EENV_gameCC;
					emiVision += noiseVal * EENV_emiVisionNoise;
					float lensDNI = lerp(lerp(EENV_emiVisionLensNight, EENV_emiVisionLensDay, ENightDayFactor), EENV_emiVisionLensInterior, EInteriorFactor);
					emiVision += lensAdaptation * lensDNI * lensTexture;
					float scanlinesDNI = lerp(lerp(EENV_emiVisionScanlinesNight, EENV_emiVisionScanlinesDay, ENightDayFactor), EENV_emiVisionScanlinesInterior, EInteriorFactor);

					float EENV_emiVisionENBBloomDNI = lerp(lerp(EENV_emiVisionENBBloomNight, EENV_emiVisionENBBloomDay, ENightDayFactor), EENV_emiVisionENBBloomInterior, EInteriorFactor);
					emiVision += pow(lerp(ENBBloom, ENBBloom * EENV_Reg4, EENV_emiVisionENBBloomTint), EENV_emiVisionENBBloomGamma) * 
						(EENV_emiVisionENBBloomDNI + scannerLinesPattern * scanlinesDNI);
					emiVision = EENV_RGBtoHSV(emiVision);
					emiVision.x += EENV_emiVisionHue;
					float EENV_emiVisionSaturation = lerp(lerp(EENV_emiVisionSaturationNight, EENV_emiVisionSaturationDay, ENightDayFactor), EENV_emiVisionSaturationInterior, EInteriorFactor);
					emiVision.y *= EENV_emiVisionSaturation;
					float EENV_emiVisionValue = lerp(lerp(EENV_emiVisionValueNight, EENV_emiVisionValueDay, ENightDayFactor), EENV_emiVisionValueInterior, EInteriorFactor);
					emiVision.z *= EENV_emiVisionValue;
					emiVision = EENV_HSVtoRGB(emiVision);
					emiVision *= lerp(1.0, vignette, EENV_emiVisionVignette);
					color.xyz = lerp(color.xyz, emiVision.xyz, EENV_emiVisionT);
					color.xyz = lerp(color.xyz, EENV_emiVisionScanlinesColor.xyz, scanlinesDNI * scanlinesPattern);
				}
			#endif // ENABLE_EMI_VISION
			
			#ifdef ENABLE_GENERAL_IMOD
				if(EENV_generalImodEnable && EENV_generalImodT > 0 && EENV_nightVisionT <= 0.05 && EENV_thermalVisionT <= 0.05 && EENV_emiVisionT <= 0.05)
				{
					// Game Color Correction
					r0=pow(tex2D(_s0, _v0.xy), EENV_generalImodGamma);
					r1=tex2D(_s1, _v0.xy) * EENV_generalImodGameBloom;
					r0.w=max(r1.w, _c1.x);
					r0.w=1.0/r0.w;
					r1.w=r0.w * 0.5;
					r0.w=r0.w * _c1.x;
					r1.xyz=r1 * r1.w;
					r2.xyz=max(r1, 0.0);
					r0.xyz=r0.w * r0 + r2.xyz;
					r0.w=dot(r0.xyz, float3(0.298999995, 0.587000012, 0.114));
					r1.xyz=lerp(r0.w, r0, _c19.x);
					r0.xyz=_c20 * r0.w - r1;
					r0.xyz=_c20.w * r0 + r1;
					r0.xyz=_c19.w * r0 - _c19.y;
					r0.xyz=_c19.z * r0 + _c19.y;
					r1.xyz=lerp(r0, _c22, _c22.w);
					r1.w=_c2.z;
					EENV_gameCC=r1;
						
					float3 generalImod = EENV_gameCC;

					generalImod += pow(lerp(ENBBloom, ENBBloom * EENV_Reg4, EENV_generalImodENBBloomTint), EENV_generalImodENBBloomGamma) * EENV_generalImodENBBloom;
					generalImod = EENV_RGBtoHSV(generalImod);
					generalImod.x += EENV_generalImodHue;
					generalImod.y *= EENV_generalImodSaturation;
					generalImod.z *= EENV_generalImodValue;
					generalImod = EENV_HSVtoRGB(generalImod);
					color.xyz = lerp(color.xyz, generalImod.xyz, EENV_generalImodT);
				}
			#endif // ENABLE_GENERAL_IMOD
			
		}

		// Calibration Display
		#ifdef ENABLE_CALIBRATION
			if(EENV_CalibrateEnable)
			{
				float2 calibrateCoords = IN.txcoord0 + 
					float2(-EENV_CalibratePosX, EENV_CalibratePosY);
				float4 calibrateText = 0;

				calibrateText += float4(1.0, 1.0, 1.0, 1.0) *
					EED_drawFloatText(
					//ASCII N   i    g    h
					float4(78, 105, 103, 104),  	
					// ACII t    V   i    s
					float4(116, 86, 105, 115),  	
					EENV_nightVisionT,
					calibrateCoords,
					float2(0.0, -0.05),
					1.2,
					6 // precision
				);
				
				calibrateText += float4(1.0, 1.0, 1.0, 1.0) *
					EED_drawFloatText(
					//ASCII T   h    e    r
					float4(84, 104, 101, 114),  	
					// ACII m    a   l     
					float4(109, 97, 108, 32),  	
					EENV_thermalVisionT,
					calibrateCoords,
					float2(0.0, -0.025),
					1.2,
					6 // precision
				);
				
				calibrateText += float4(1.0, 1.0, 1.0, 1.0) *
					EED_drawFloatText(
					//ASCII 
					float4(32, 32, 32, 32),  	
					// ACII E    M   I     
					float4(69, 77, 73, 32),  	
					EENV_emiVisionT,
					calibrateCoords,
					float2(0.0, 0.0),
					1.2,
					6 // precision
				);
				
				calibrateText += EED_drawFloatText(
					//ASCII N   i    g    h
					float4(78, 105, 103, 104),  	
					// ACII t    D   a    y
					float4(116, 68, 97, 121),  	
					ENightDayFactor,
					calibrateCoords,
					float2(0.0, 0.065),
					1.0,
					6 // precision
				);

				calibrateText += EED_drawFloatText(
					//ASCII I   n    t    e
					float4(73, 110, 116, 101),  	
					// ACII r    i   o    r
					float4(114, 105, 111, 114),  	
					EInteriorFactor,
					calibrateCoords,
					float2(0.0, 0.085),
					1.0,
					6 // precicsion
				);
				
				#ifdef ENABLE_CALIBRATION_REGISTERS
					calibrateText += EED_drawCRegistersText2(
						EENV_Reg1, EENV_Reg2, EENV_Reg3, EENV_Reg4, EENV_Reg5,
						calibrateCoords, float2(0.0, 0.125), 1.0, 6
					);
				#endif //ENABLE_CALIBRATION_REGISTERS
				
				float2 regSize = 100.0 * float2(ScreenSize.y * ScreenSize.w, ScreenSize.y);
				color.xyz = EED_drawCRegistersColors(
					color.xyz,
					EENV_Reg1, EENV_Reg2, EENV_Reg3, EENV_Reg4, EENV_Reg5,
					IN.txcoord0, float2(EENV_CalibratePosX + 0.115, -EENV_CalibratePosY + 0.15),
					regSize, float2(0.05, 0.1)
				);
				
				color.xyz += calibrateText.xyz;
			}
		#endif  //ENABLE_CALIBRATION

	}
	// ##############################
	// END NIGHTEYE  IMPLEMENTATION
	// ##############################	
	
	_oC0.xyz=color.xyz;
	return _oC0;
 
	
	
}



//switch between vanilla and mine post processing
technique Shader_C1DAE3F7 <string UIName="ENBSeries";>
{
	pass p0
	{
		VertexShader  = compile vs_3_0 VS_Quad();
		PixelShader  = compile ps_3_0 PS_C1DAE3F7();

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



//original shader of post processing
technique Shader_ORIGINALPOSTPROCESS <string UIName="Vanilla";>
{
	pass p0
	{
		//VertexShader  = compile vs_3_0 VS_Quad();
		VertexShader=
	asm
	{
// Parameters:
//   float4 geometryOffset;
//   float4 texOffset0;
//   float4 texOffset1;
// Registers:
//   Name           Reg   Size
//   -------------- ----- ----
//   geometryOffset c0       1
//   texOffset0     c1       1
//   texOffset1     c2       1
//
    vs_1_1
    def c3, 2, -2, 0, 0
    dcl_position v0
    dcl_texcoord v1
    mov r0.xy, c0
    mad oPos.xy, r0, -c3, v0
    add oT0.xy, v1, c1
    add oT1.xy, v1, c2
    mov oPos.zw, v0
	};
		PixelShader=
	asm
	{
// Parameters:
//   float3 BlurScale;
//   float4 Cinematic;
//   sampler2D DestBlend;
//   float4 Fade;
//   float4 HDRParam;
//   sampler2D Src0;
//   float4 Tint;
// Registers:
//   Name         Reg   Size
//   ------------ ----- ----
//   HDRParam     c1       1
//   BlurScale    c2       1
//   Cinematic    c19      1
//   Tint         c20      1
//   Fade         c22      1
//   Src0         s0       1
//   DestBlend    s1       1
//
    ps_2_x
    def c0, 0.5, 0, 0, 0
    def c3, 0.298999995, 0.587000012, 0.114, 0
    dcl t0.xy
    dcl t1.xy
    dcl_2d s0
    dcl_2d s1
    texld r0, t1, s1
    texld r1, t0, s0
    max r0.w, r1.w, c1.x
    rcp r0.w, r0.w
    mul r1.w, r0.w, c0.x
    mul r0.w, r0.w, c1.x
    mul r1.xyz, r1, r1.w
    max r2.xyz, r1, c0.y
    mad r0.xyz, r0.w, r0, r2
    dp3 r0.w, r0, c3
    lrp r1.xyz, c19.x, r0, r0.w
    mad r0.xyz, r0.w, c20, -r1
    mad r0.xyz, c20.w, r0, r1
    mad r0.xyz, c19.w, r0, -c19.y
    mad r0.xyz, c19.z, r0, c19.y
    lrp r1.xyz, c22.w, c22, r0
    mov r1.w, c2.z
    mov oC0, r1
	};
		ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
		ZEnable=FALSE;
		ZWriteEnable=FALSE;
		CullMode=NONE;
		AlphaTestEnable=FALSE;
		AlphaBlendEnable=FALSE;
		SRGBWRITEENABLE=FALSE;
    }
}