Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //++++++++++++++++++++++++++++++++++++++++++++
- // ENBSeries effect file
- // visit http://enbdev.com for updates
- // Copyright (c) 2007-2016 Boris Vorontsov
- //++++++++++++++++++++++++++++++++++++++++++++
- #define APPLYGAMECOLORCORRECTION
- #define FIFTYTIFTY_NOSTALGIA_GUI
- #define FIFTYTIFTY_VIBRANCE_GUI
- #define FIFTYTIFTY_LEVELS_GUI
- #define FIFTYTIFTY_TECHNICOLOR_PROD80_GUI
- #define FIFTYTIFTY_HPD_TONEMAPPING_GUI
- #define FIFTYTIFTY_COLOR_FILMIC_TONEMAPPING_GUI
- #define FIFTYTIFTY_CINEONDPX_GUI
- #define FIFTYTIFTY_SIMPLE_LINEAR_TONEMAPPING_GUI
- #define FIFTYTIFTY_DOS_GUI
- //post processing mode. Change value (could be 1, 2, 3, 4). Every mode have own internal parameters, look below
- #ifndef POSTPROCESS
- #define POSTPROCESS 2
- #endif
- //+++++++++++++++++++++++++++++
- //internal parameters, can be modified
- //+++++++++++++++++++++++++++++
- bool bFiftyTiftyNostalgia
- <
- string UIName = "Nostalgia: Enable";
- > = {false};
- #ifdef FIFTYTIFTY_NOSTALGIA_GUI
- bool bFiftyTiftyNostalgiaMethod
- <
- string UIName = "Nostalgia: Use Non-Linear Method?";
- > = {false};
- float3 NBlack
- <
- string UIName = "Nostalgia: Black";
- string UIWidget = "color";
- > = {0.0000, 0.0000, 0.0000};
- float3 NBlue
- <
- string UIName = "Nostalgia: Blue";
- string UIWidget = "color";
- > = {0.2431, 0.1922, 0.6353};
- float3 NDYellowBrown
- <
- string UIName = "Nostalgia: Dark Yellow-Brown";
- string UIWidget = "color";
- > = {0.3412, 0.2588, 0.0000};
- float3 NDRed
- <
- string UIName = "Nostalgia: Dark Red";
- string UIWidget = "color";
- float UIStep = 0.0001;
- > = {0.5490, 0.2431, 0.2039};
- float3 NDGrey
- <
- string UIName = "Nostalgia: Dark Grey";
- string UIWidget = "color";
- > = {0.3294, 0.2394, 0.3294};
- float3 NPurple
- <
- string UIName = "Nostalgia: Purple";
- string UIWidget = "color";
- float UIStep = 0.0001;
- > = {0.5529, 0.2784, 0.7020};
- float3 NBrown
- <
- string UIName = "Nostalgia: Brown";
- string UIWidget = "color";
- > = {0.5647, 0.3725, 0.1451};
- float3 NLPurple
- <
- string UIName = "Nostalgia: Light Purple";
- string UIWidget = "color";
- > = {0.4863, 0.4392, 0.8549};
- float3 NPGrey
- <
- string UIName = "Nostalgia: Pale Grey";
- string UIWidget = "color";
- > = {0.5020, 0.5020, 0.5059};
- float3 NGreen
- <
- string UIName = "Nostalgia: Green";
- string UIWidget = "color";
- > = {0.4078, 0.6627, 0.2549};
- float3 NPRed
- <
- string UIName = "Nostalgia: Pale Red";
- string UIWidget = "color";
- > = {0.7333, 0.4667, 0.4274};
- float3 NPCyan
- <
- string UIName = "Nostalgia: Pale Cyan";
- string UIWidget = "color";
- > = {0.4784, 0.7490, 0.7804};
- float3 NLGrey
- <
- string UIName = "Nostalgia: Light Grey";
- string UIWidget = "color";
- > = {0.6706, 0.6706, 0.6706};
- float3 NSnotGreen
- <
- string UIName = "Nostalgia: Snot-Green";
- string UIWidget = "color";
- > = {0.8157, 0.8627, 0.4431};
- float3 NLimeGreen
- <
- string UIName = "Nostalgia: Lime Green";
- string UIWidget = "color";
- > = {0.6745, 0.9176, 0.5333};
- float3 NWhite
- <
- string UIName = "Nostalgia: White";
- string UIWidget = "color";
- > = {1.0000, 1.0000, 1.0000};
- #endif
- //FiftyTifty Gui Vibrance
- bool bFiftyTiftyVibrance
- <
- string UIName = "Vibrance: Enable";
- > = {false};
- #ifdef FIFTYTIFTY_VIBRANCE_GUI
- float VibranceIntensity
- <
- string UIName="Vibrance: Intensity";
- string UIWidget="spinner";
- float UIMin=0.0000;
- float UIMax=1000.0000;
- float UIStep=0.01;
- > = {1.00};
- float VibranceR
- <
- string UIName = "Vibrance: Red Amount";
- string UIWidget = "Spinner";
- float UIStep=0.01;
- > = {1.00};
- float VibranceRBrightness
- <
- string UIName = "Vibrance: Red - Brightness";
- string UIWidget = "Spinner";
- float UIStep=0.01;
- > = {1.00};
- float VibranceG
- <
- string UIName = "Vibrance: Green Amount";
- string UIWidget = "Spinner";
- float UIStep=0.01;
- > = {1.00};
- float VibranceGBrightness
- <
- string UIName = "Vibrance: Green - Brightness";
- string UIWidget = "Spinner";
- float UIStep=0.01;
- > = {1.00};
- float VibranceB
- <
- string UIName = "Vibrance: Blue Amount";
- string UIWidget = "Spinner";
- float UIStep=0.01;
- > = {1.00};
- float VibranceBBrightness
- <
- string UIName = "Vibrance: Blue - Brightness";
- string UIWidget = "Spinner";
- float UIStep=0.01;
- > = {1.00};
- #endif
- //FiftyTifty GUI Levels
- bool bFiftyTiftyLevels
- <
- string UIName = "Levels: Enable";
- > = {false};
- #ifdef FIFTYTIFTY_LEVELS_GUI
- float LevelsBlackPoint
- <
- string UIName="Levels: Black Point";
- string UIWidget="spinner";
- float UIMin=0.0001;
- float UIMax=1.0000;
- float UIStep=0.0001;
- > = {0.0001};
- float LevelsWhitePoint
- <
- string UIName="Levels: White Point";
- string UIWidget="spinner";
- float UIMin=0.0001;
- float UIMax=1.00;
- float UIStep=0.0001;
- > = {1.0000};
- #endif
- //FiftyTifty GUI CineonDPX
- bool bFiftyTiftyDPX
- <
- string UIName = "CineonDPX: Enable";
- > = {false};
- #ifdef FIFTYTIFTY_CINEONDPX_GUI
- float DPXRed
- <
- string UIName="CineonDPX: Red";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {8.00};
- float DPXGreen
- <
- string UIName="CineonDPX: Green";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {8.00};
- float DPXBlue
- <
- string UIName="CineonDPX: Blue";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {8.00};
- float DPXColorGamma
- <
- string UIName="CineonDPX: Color Gamma";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {2.50};
- float DPXSaturation
- <
- string UIName="CineonDPX: Saturation";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {2.30};
- float DPXRedC
- <
- string UIName="CineonDPX: RedC";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {0.36};
- float DPXGreenC
- <
- string UIName="CineonDPX: GreenC";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {0.36};
- float DPXBlueC
- <
- string UIName="CineonDPX: BlueC";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {0.36};
- float DPXAmount
- <
- string UIName="CineonDPX: Amount";
- string UIWidget="spinner";
- float UIMin=0.001;
- float UIMax=1.000;
- float UIStep=0.001;
- > = {0.700};
- #endif
- //FiftyTifty GUI Technicolor Prod80
- bool bFiftyTiftyTechnicolorProd80
- <
- string UIName = "Technicolor - Prod80: Enable";
- > = {false};
- #ifdef FIFTYTIFTY_TECHNICOLOR_PROD80_GUI
- float TechnicolorProd80ColorStrengthR
- <
- string UIName="Technicolor - Prod80: Red Strength";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {0.20};
- float TechnicolorProd80ColorStrengthG
- <
- string UIName="Technicolor - Prod80: Green Strength";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {0.200};
- float TechnicolorProd80ColorStrengthB
- <
- string UIName="Technicolor - Prod80: Blue Strength";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {0.20};
- float TechnicolorProd80Brightness
- <
- string UIName="Technicolor - Prod80: Brightness";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {1.00};
- float TechnicolorProd80Strength
- <
- string UIName="Technicolor - Prod80: Strength";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {1.00};
- float TechnicolorProd80Saturation
- <
- string UIName="Technicolor - Prod80: Saturation";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {0.70};
- #endif
- //FiftyTifty Simple Linear Tonemapping
- bool bFiftyTiftySimpleLinearTonemapping
- <
- string UIName = "Simple Tonemapping: Enable";
- > = {false};
- #ifdef FIFTYTIFTY_SIMPLE_LINEAR_TONEMAPPING_GUI
- float FiftyTiftySLTonemappingExposure
- <
- string UIName="SL Tonemapping: Exposure.";
- string UIWidget="spinner";
- float UIMin=0.00;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {16.00};
- #endif
- //FiftyTifty GUI HPD Tonemapping
- bool bFiftyTiftyHPDTonemapping
- <
- string UIName = "HPD Tonemapping: Enable";
- > = {false};
- #ifdef FIFTYTIFTY_HPD_TONEMAPPING_GUI
- bool bFiftyTiftyHPDTonemappingMethod
- <
- string UIName = "HPD Tonemapping: Use 2nd Method?";
- > = {false};
- float HPDTonemappingExposure
- <
- string UIName="HPD Tonemapping: Exposure.";
- string UIWidget="spinner";
- float UIMin=0.00;
- float UIMax=1000.00;
- float UIStep=0.01;
- > = {2.2f};
- float HPDTonemappingClipping
- <
- string UIName="HPD Tonemapping: Clipping";
- string UIWidget="spinner";
- float UIMin=0.0;
- float UIMax=1000.0;
- float UIStep=0.0001;
- > = {0.004f};
- float HPDTonemappingUpperTone
- <
- string UIName="HPD Tonemapping: Upper Tone";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {6.2f};
- float HPDTonemappingGreyTone
- <
- string UIName="HPD Tonemapping: Grey Tone";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {0.5f};
- float HPDTonemappingMiddleTone
- <
- string UIName="HPD Tonemapping: Middle Tone";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {1.7f};
- float HPDTonemappingLowerTone
- <
- string UIName="HPD Tonemapping: Lower Tone";
- string UIWidget="spinner";
- float UIMin=0.01;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {0.06};
- float HPDTonemappingLerp // 1.0 = None, 0.001 = Practically entire effect
- <
- string UIName="HPD Tonemapping: Amount";
- string UIWidget="spinner";
- float UIMin=0.0001;
- float UIMax=1.0000;
- float UIStep=0.0001;
- > = {0.0001};
- #endif
- bool bFiftyTiftyColorFilmicTonemapping
- <
- string UIName = "Color Filmic Tonemapping: Enable";
- > = {false};
- #ifdef FIFTYTIFTY_COLOR_FILMIC_TONEMAPPING_GUI
- float CFLinearColorMultiplier
- <
- string UIName="Color Filmic Tonemapping: Linear Color.";
- string UIWidget="spinner";
- float UIMin=0.00;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {1.25};
- float CFTonemappingPower
- <
- string UIName="Color Filmic Tonemapping: Power.";
- string UIWidget="spinner";
- float UIMin=0.00;
- float UIMax=100.00;
- float UIStep=0.01;
- > = {1.25};
- #endif
- //modify these values to tweak various color processing
- //POSTPROCESS 1
- float EAdaptationMinV1=0.01;
- float EAdaptationMaxV1=0.07;
- float EContrastV1=0.95;
- float EColorSaturationV1=1.0;
- float EToneMappingCurveV1=6.0;
- //POSTPROCESS 2
- //float EBrightnessV2=2.5;
- float EAdaptationMinV2=0.05;
- float EAdaptationMaxV2=0.05;//0.125;
- float EToneMappingCurveV2=8.0;
- float EIntensityContrastV2=1.2;
- float EColorSaturationV2=1.0;
- float EToneMappingOversaturationV2=100.0;
- //POSTPROCESS 3
- float EAdaptationMinV3=0.05;
- float EAdaptationMaxV3=0.125;
- float EToneMappingCurveV3=4.0;
- float EToneMappingOversaturationV3=60.0;
- //POSTPROCESS 4
- float EAdaptationMinV4=0.2;
- float EAdaptationMaxV4=0.125;
- float EBrightnessCurveV4=0.7;
- float EBrightnessMultiplierV4=0.45;
- float EBrightnessToneMappingCurveV4=0.5;
- //parameters for ldr color correction, if enabled
- 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};
- //+++++++++++++++++++++++++++++
- //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;
- //changes in range 0..1, 0 means full quality, 1 lowest dynamic quality (0.33, 0.66 are limits for quality levels)
- //float EAdaptiveQualityFactor;
- //.x - current weather index, .y - outgoing weather index, .z - weather transition, .w - time of the day in 24 standart hours. Weather index is value from _weatherlist.ini, for example WEATHER002 means index==2, but index==0 means that weather not captured.
- //float4 WeatherAndTime;
- //enb version of bloom applied, ignored if original post processing used
- float EBloomAmount;
- //fov in degrees
- //float FieldOfView;
- texture2D texs0;//color
- 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 _s3 = sampler_state
- {
- Texture = <texs3>;
- MinFilter = LINEAR;//
- MagFilter = LINEAR;//
- MipFilter = NONE;//LINEAR;
- AddressU = Clamp;
- AddressV = Clamp;
- SRGBTexture=FALSE;
- MaxMipLevel=0;
- MipMapLodBias=0;
- };
- sampler2D _s4 = sampler_state
- {
- Texture = <texs4>;
- MinFilter = LINEAR;//
- MagFilter = LINEAR;//
- MipFilter = NONE;//LINEAR;
- AddressU = Clamp;
- AddressV = Clamp;
- SRGBTexture=FALSE;
- MaxMipLevel=0;
- MipMapLodBias=0;
- };
- sampler2D _s7 = sampler_state
- {
- Texture = <texs7>;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- MipFilter = NONE;
- AddressU = Clamp;
- AddressV = Clamp;
- SRGBTexture=FALSE;
- MaxMipLevel=0;
- MipMapLodBias=0;
- };
- struct VS_OUTPUT_POST
- {
- float4 vpos : POSITION;
- float2 txcoord0 : TEXCOORD0;
- };
- struct VS_INPUT_POST
- {
- float3 pos : POSITION;
- float2 txcoord0 : TEXCOORD0;
- };
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
- {
- VS_OUTPUT_POST OUT;
- OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
- OUT.txcoord0.xy=IN.txcoord0.xy;
- return OUT;
- }
- float4 PS_Draw(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
- {
- float4 _oC0=0.0; //output
- float4 _c6=float4(0, 0, 0, 0);
- float4 _c7=float4(0.212500006, 0.715399981, 0.0720999986, 1.0);
- float4 r0;
- float4 r1;
- float4 r2;
- float4 r3;
- float4 r4;
- float4 r5;
- float4 r6;
- float4 r7;
- float4 r8;
- float4 r9;
- float4 r10;
- float4 r11;
- float4 _v0=0.0;
- _v0.xy=IN.txcoord0.xy;
- r1=tex2D(_s0, _v0.xy); //color
- //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
- float4 color=_oC0;
- //adaptation in time
- float4 Adaptation=tex2D(_s4, 0.5);
- float grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
- #if (POSTPROCESS==1)
- grayadaptation=max(grayadaptation, 0.0);
- grayadaptation=min(grayadaptation, 50.0);
- color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV1+EAdaptationMinV1);//*tempF1.x
- float cgray=dot(color.xyz, float3(0.27, 0.67, 0.06));
- cgray=pow(cgray, EContrastV1);
- float3 poweredcolor=pow(color.xyz, EColorSaturationV1);
- float newgray=dot(poweredcolor.xyz, float3(0.27, 0.67, 0.06));
- color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
- float3 luma=color.xyz;
- float lumamax=300.0;
- color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV1);
- #endif
- #if (POSTPROCESS==2)
- grayadaptation=max(grayadaptation, 0.0);
- grayadaptation=min(grayadaptation, 50.0);
- color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV2+EAdaptationMinV2);//*tempF1.x
- //color.xyz*=EBrightnessV2;
- color.xyz+=0.000001;
- float3 xncol=normalize(color.xyz);
- float3 scl=color.xyz/xncol.xyz;
- scl=pow(scl, EIntensityContrastV2);
- xncol.xyz=pow(xncol.xyz, EColorSaturationV2);
- color.xyz=scl*xncol.xyz;
- float lumamax=EToneMappingOversaturationV2;
- color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV2);
- #endif
- #if (POSTPROCESS==3)
- grayadaptation=max(grayadaptation, 0.0);
- grayadaptation=min(grayadaptation, 50.0);
- color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV3+EAdaptationMinV3);//*tempF1.x
- float lumamax=EToneMappingOversaturationV3;
- color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV3);
- #endif
- //color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
- //color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
- //color.xyz*=0.7;
- #if (POSTPROCESS==4)
- grayadaptation=max(grayadaptation, 0.0);
- grayadaptation=min(grayadaptation, 50.0);
- color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV4+EAdaptationMinV4);
- float Y = dot(color.xyz, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
- float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
- float V = dot(color.xyz, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;
- Y=pow(Y, EBrightnessCurveV4);
- Y=Y*EBrightnessMultiplierV4;
- // Y=Y/(Y+EBrightnessToneMappingCurveV4);
- // float desaturatefact=saturate(Y*Y*Y*1.7);
- // U=lerp(U, 0.0, desaturatefact);
- // V=lerp(V, 0.0, desaturatefact);
- color.xyz=V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
- color.xyz=max(color.xyz, 0.0);
- color.xyz=color.xyz/(color.xyz+EBrightnessToneMappingCurveV4);
- #endif
- //pallete texture (0.082+ version feature)
- #ifdef E_CC_PALETTE
- color.rgb=saturate(color.rgb);
- float3 brightness=Adaptation.xyz;//tex2D(_s4, 0.5);//adaptation luminance
- // brightness=saturate(brightness);//old version from ldr games
- brightness=(brightness/(brightness+1.0));//new version
- brightness=max(brightness.x, max(brightness.y, brightness.z));//new version
- float3 palette;
- float4 uvsrc=0.0;
- uvsrc.y=brightness.r;
- uvsrc.x=color.r;
- palette.r=tex2Dlod(_s7, uvsrc).r;
- uvsrc.x=color.g;
- uvsrc.y=brightness.g;
- palette.g=tex2Dlod(_s7, uvsrc).g;
- uvsrc.x=color.b;
- uvsrc.y=brightness.b;
- palette.b=tex2Dlod(_s7, uvsrc).b;
- color.rgb=palette.rgb;
- #endif //E_CC_PALETTE
- #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, 0.3333);
- color=lerp(tempgray, color, ECCSaturation);
- //+++ desaturate shadows
- tempgray=dot(color, 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, 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
- //Begin FiftyTifty Levels
- if(bFiftyTiftyLevels)
- {
- float WhitePointFloat = (LevelsWhitePoint - LevelsBlackPoint);
- float BlackPointFloat = (LevelsBlackPoint);
- color.rgb = color.rgb * WhitePointFloat - (BlackPointFloat * WhitePointFloat);
- }
- //End FiftyTifty Levels
- //Begin FiftyTifty Nostalgia - Thing looks awful, probably didn't get it to work right. Only shows black, NDYellowBrown and white.
- if(bFiftyTiftyNostalgia)
- {
- float3 NColor = color.rgb;
- float3 NPalette[16];
- NPalette[0] = NBlack; //Black
- NPalette[1] = NBlue; //Blue
- NPalette[2] = NDYellowBrown; //Dark Yellow-Brown
- NPalette[3] = NDRed; //Dark Red
- NPalette[4] = NDGrey; //Dark Grey
- NPalette[5] = NPurple; //Purple
- NPalette[6] = NBrown; //Brown
- NPalette[7] = NLPurple; //Light Purple
- NPalette[8] = NPGrey; //Pale Grey
- NPalette[9] = NGreen; //Green
- NPalette[10] = NPRed; //Pale Red
- NPalette[11] = NPCyan; //Pale Cyan
- NPalette[12] = NLGrey; //Light Grey
- NPalette[13] = NSnotGreen; //Snot-Green
- NPalette[14] = NLimeGreen; //Lime-Green
- NPalette[15] = NWhite; //White
- float3 NDiff = NColor;
- float NDist = dot(NDiff,NDiff);
- float NClosestDist = NDist;
- float3 NClosestColor = float3(0.0000,0.0000,0.0000);
- int Nint = 1;
- for (Nint = 1 ; Nint <= 15 ; Nint++)
- {
- NDiff = NColor - NPalette[Nint]; //difference
- NClosestDist = dot(NDiff,NDiff); //squared distance
- if (NDist < NClosestDist) //ternary would also work here
- {
- NClosestDist = NDist;
- NClosestColor = NPalette[Nint];
- }
- }
- if(bFiftyTiftyNostalgiaMethod)
- {
- color.xyz = NClosestColor.rgb;
- color.xyz = pow(color.xyz, 1.0/2.2);
- }
- else
- {
- color.xyz = NClosestColor.rgb;
- }
- }
- //End FiftyTifty Nostalgia
- //Begin FiftyTifty DPX
- if(bFiftyTiftyDPX)
- {
- static const float3x3 DPXRGB = float3x3
- (
- 2.67147117265996,-1.26723605786241,-0.410995602172227,
- -1.02510702934664,1.98409116241089,0.0439502493584124,
- 0.0610009456429445,-0.223670750812863,1.15902104167061
- );
- static const float3x3 DPXXYZ = float3x3
- (
- 0.500303383543316,0.338097573222739,0.164589779545857,
- 0.257968894274758,0.676195259144706,0.0658358459823868,
- 0.0234517888692628,0.1126992737203,0.866839673124201
- );
- float DPXContrast = 0.1;
- float DPXGamma = 1.0;
- float3 RGB_Curve = float3(DPXRed,DPXGreen,DPXBlue);
- float3 RGB_C = float3(DPXRedC,DPXGreenC,DPXBlueC);
- float3 DPXColor = color.rgb;
- DPXColor = pow(abs(DPXColor), 1.0/DPXGamma);
- DPXColor = DPXColor * (1.0 - DPXContrast) + (0.5 * DPXContrast);
- float3 Btemp = (1.0 / (1.0 + exp(RGB_Curve / 2.0)));
- DPXColor = ((1.0 / (1.0 + exp(-RGB_Curve * (DPXColor - RGB_C)))) / (-2.0 * Btemp + 1.0)) + (-Btemp / (-2.0 * Btemp + 1.0));
- //RGB to HSV, replace the code k?
- float value = max(max(DPXColor.r, DPXColor.g), DPXColor.b);
- float3 DPXColorFinal = DPXColor / value;
- DPXColorFinal = pow(abs(DPXColorFinal), 1.0/DPXColorGamma);
- float3 c0 = DPXColorFinal * value;
- c0 = mul(DPXXYZ, c0);
- float DPXLuma = dot(c0, float3(0.30, 0.59, 0.11));
- c0 = (1.0 - DPXSaturation) * DPXLuma + DPXSaturation * c0;
- c0 = mul(DPXRGB, c0);
- color.rgb = lerp(color.rgb, c0, DPXAmount);
- }
- //End FiftyTifty DPX
- //Begin FiftyTifty Technicolor Prod80
- if(bFiftyTiftyTechnicolorProd80)
- {
- float3 colStrength = float3(TechnicolorProd80ColorStrengthR,TechnicolorProd80ColorStrengthG,TechnicolorProd80ColorStrengthB);
- float3 tsource = saturate(color.rgb);
- float3 ttemp = 1 - tsource;
- float3 ttarget = ttemp.grg;
- float3 ttarget2 = ttemp.bbr;
- float3 ttemp2 = tsource.rgb * ttarget.rgb;
- ttemp2.rgb *= ttarget2.rgb;
- ttemp.rgb = ttemp2.rgb * colStrength;
- ttemp2.rgb *= TechnicolorProd80Brightness;
- ttarget.rgb = ttemp.grg;
- ttarget2.rgb = ttemp.bbr;
- ttemp.rgb = tsource.rgb - ttarget.rgb;
- ttemp.rgb += ttemp2.rgb;
- ttemp2.rgb = ttemp.rgb - ttarget2.rgb;
- color.rgb = lerp(tsource.rgb, ttemp2.rgb, TechnicolorProd80Strength);
- color.rgb = lerp(dot(color.rgb, 0.333), color.rgb, TechnicolorProd80Saturation);
- }
- //End FiftyTifty Technicolor Prod80
- //Begin FiftyTifty Simple Linear Tonemapping
- if(bFiftyTiftySimpleLinearTonemapping)
- {
- float3 texColor = color.rgb;
- texColor *= FiftyTiftySLTonemappingExposure; // Hardcoded Exposure Adjustment
- color.rgb = pow(texColor,1/2.2);
- }
- //End FiftyTifty Simple Linear Tonemapping
- //Begin FiftyTifty HPD Tonemapping
- if(bFiftyTiftyHPDTonemapping)
- {
- float3 xColor = color.xyz;
- xColor = max(xColor, HPDTonemappingClipping);
- float3 HPDcolor = pow(abs((xColor * (HPDTonemappingUpperTone * xColor + HPDTonemappingGreyTone )) / (xColor * (HPDTonemappingUpperTone * xColor + HPDTonemappingMiddleTone) + HPDTonemappingLowerTone )), HPDTonemappingExposure);
- if(bFiftyTiftyHPDTonemappingMethod)
- {
- color.xyz = lerp(pow(HPDcolor.xyz, 1.0/2.2), color.xyz, HPDTonemappingLerp);
- }
- else
- {
- color.xyz = lerp(HPDcolor.xyz, color.xyz, HPDTonemappingLerp);
- }
- }
- //End FiftyTifty HPD Tonemapping
- //Begin FiftyTifty ColorFilmicTonemapping
- if(bFiftyTiftyColorFilmicTonemapping)
- {
- float3 xColor = color.xyz;
- const float3 A = float3(0.55f, 0.50f, 0.45f); // Shoulder strength
- const float3 B = float3(0.30f, 0.27f, 0.22f); // Linear strength
- const float3 C = float3(0.10f, 0.10f, 0.10f); // Linear angle
- const float3 D = float3(0.10f, 0.07f, 0.03f); // Toe strength
- const float3 E = float3(0.01f, 0.01f, 0.01f); // Toe Numerator
- const float3 F = float3(0.30f, 0.30f, 0.30f); // Toe Denominator
- const float3 W = float3(2.80f, 2.90f, 3.10f); // Linear White Point Value
- const float3 F_linearWhite = ((W*(A*W+C*B)+D*E)/(W*(A*W+B)+D*F))-(E/F);
- float3 F_linearColor = ((xColor*(A*xColor+C*B)+D*E)/(xColor*(A*xColor+B)+D*F))-(E/F);
- color.xyz = pow(saturate(F_linearColor * CFLinearColorMultiplier / F_linearWhite),CFTonemappingPower);
- }
- //End FiftyTifty ColorFilmicTonemapping
- //Begin FiftyTifty Vibrance
- if(bFiftyTiftyVibrance)
- {
- float3 VibCoeff = float3((VibranceR * VibranceIntensity), (VibranceG * VibranceIntensity), (VibranceB * VibranceIntensity));
- float3 VibColor = color.rgb;
- float3 LumCoeff = float3(0.2127, 0.7152, 0.0722);
- float Luma = dot(LumCoeff, VibColor.rgb);
- float VibMaxColor = max(color.r, max(color.g, color.b));
- float VibMinColor = min(color.r, min(color.g, color.b));
- float VibSaturation = VibMaxColor - VibMinColor;
- VibColor.rgb = lerp(Luma, VibColor.rgb, (1.0 + (VibCoeff * (1.0 - (sign(VibCoeff) * VibSaturation)))));
- VibColor.rgb = float3((VibColor.r * VibranceRBrightness), (VibColor.g * VibranceGBrightness), (VibColor.b * VibranceBBrightness)); //Made it possible to adjust the colours' brightness
- color.rgb = VibColor.rgb;
- }
- //End FiftyTifty Vibrance
- _oC0.w=1.0;
- _oC0.xyz=color.xyz;
- return _oC0;
- }
- //switch between vanilla and mine post processing
- technique Draw <string UIName="ENBSeries";>
- {
- pass p0
- {
- VertexShader = compile vs_3_0 VS_Quad();
- PixelShader = compile ps_3_0 PS_Draw();
- ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
- ZEnable=FALSE;
- ZWriteEnable=FALSE;
- CullMode=NONE;
- AlphaTestEnable=FALSE;
- AlphaBlendEnable=FALSE;
- SRGBWRITEENABLE=FALSE;
- }
- }
- float4 PS_Vanilla(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
- {
- float4 _oC0=0.0;
- float4 _v0=0.0;
- _v0.xy=IN.txcoord0.xy;
- _oC0=tex2D(_s0, _v0.xy); //color
- return _oC0;
- }
- //original shader of post processing
- technique Shader_ORIGINALPOSTPROCESS <string UIName="Vanilla";>
- {
- pass p0
- {
- VertexShader = compile vs_3_0 VS_Quad();
- PixelShader = compile ps_3_0 PS_Vanilla();
- ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
- ZEnable=FALSE;
- ZWriteEnable=FALSE;
- CullMode=NONE;
- AlphaTestEnable=FALSE;
- AlphaBlendEnable=FALSE;
- SRGBWRITEENABLE=FALSE;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement