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-2013 Boris Vorontsov
- //++++++++++++++++++++++++++++++++++++++++++++
- //post processing mode. Change value (could be 1, 2, 3, 4). Every mode have own internal parameters, look below
- #ifndef POSTPROCESS
- #define POSTPROCESS 3
- #endif
- //use original game processing first, then mine
- //#define APPLYGAMECOLORCORRECTION
- #define NLA_COLOUR_CONTROLS
- #define NLA_TONEMAPPING_CONTROLS
- #define NLA_BRIGHTNESS_CONTROLS
- #define NLA_LOWDEF_COLOUR_CONTROLS
- //+++++++++++++++++++++++++++++
- //internal parameters, can be modified
- //+++++++++++++++++++++++++++++
- //begin NLA Colour
- #ifdef NLA_COLOUR_CONTROLS
- float PaletteDay
- <
- string UIName="CC: Palette Intensity Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=5.0;
- > = {1.05};
- float PaletteNight
- <
- string UIName="CC: Palette Intensity Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=5.0;
- > = {1.05};
- float PaletteInterior
- <
- string UIName="CC: Palette Intensity Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=5.0;
- > = {1.0};
- float PaletteBrightnessDay
- <
- string UIName="CC: Palette Gamma Day";
- string UIWidget="Spinner";
- float UIMin=1.0;
- float UIMax=3.0;
- > = {1.0};
- float PaletteBrightnessNight
- <
- string UIName="CC: Palette Gamma Night";
- string UIWidget="Spinner";
- float UIMin=1.0;
- float UIMax=3.0;
- > = {3.0};
- float PaletteBrightnessInterior
- <
- string UIName="CC: Palette Gamma Interior";
- string UIWidget="Spinner";
- float UIMin=1.0;
- float UIMax=5.0;
- > = {3.0};
- float GammaDay
- <
- string UIName="CC: Gamma Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=5.0;
- > = {1.38};
- float GammaNight
- <
- string UIName="CC: Gamma Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=5.0;
- > = {1.25};
- float GammaInterior
- <
- string UIName="CC: Gamma Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=5.0;
- > = {1.1};
- float RedFilterDay
- <
- string UIName="CC: Red Filter Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {1.0};
- float RedFilterNight
- <
- string UIName="CC: Red Filter Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {1.0};
- float RedFilterInterior
- <
- string UIName="CC: Red Filter Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.98};
- float GreenFilterDay
- <
- string UIName="CC: Green Filter Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {1.0};
- float GreenFilterNight
- <
- string UIName="CC: Green Filter Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {1.0};
- float GreenFilterInterior
- <
- string UIName="CC: Green Filter Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.98};
- float BlueFilterDay
- <
- string UIName="CC: Blue Filter Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {1.0};
- float BlueFilterNight
- <
- string UIName="CC: Blue Filter Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.975};
- float BlueFilterInterior
- <
- string UIName="CC: Blue Filter Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {1.0};
- float DesatRDay
- <
- string UIName="CC: Desat Red Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {1.0};
- float DesatRNight
- <
- string UIName="CC: Desat Red Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {1.0};
- float DesatRInterior
- <
- string UIName="CC: Desat Red Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {1.0};
- float DesatGDay
- <
- string UIName="CC: Desat Green Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.1};
- float DesatGNight
- <
- string UIName="CC: Desat Green Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.2};
- float DesatGInterior
- <
- string UIName="CC: Desat Green Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.2};
- float DesatBDay
- <
- string UIName="CC: Desat Blue Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.6};
- float DesatBNight
- <
- string UIName="CC: Desat Blue Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.8};
- float DesatBInterior
- <
- string UIName="CC: Desat Blue Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.6};
- #endif
- //end NLA Colour
- //begin NLA Tonemapping
- #ifdef NLA_TONEMAPPING_CONTROLS
- float IntensityContrastDay
- <
- string UIName="TM: Intensity Contrast Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.3};
- float IntensityContrastNight
- <
- string UIName="TM: Intensity Contrast Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.3};
- float IntensityContrastInterior
- <
- string UIName="TM: Intensity Contrast Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.3};
- float SaturationDay
- <
- string UIName="TM: Saturation Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.7};
- float SaturationNight
- <
- string UIName="TM: Saturation Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.3};
- float SaturationInterior
- <
- string UIName="TM: Saturation Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.3};
- float ToneMappingCurveDay
- <
- string UIName="TM: ToneMapping Curve Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {2.0};
- float ToneMappingCurveNight
- <
- string UIName="TM: ToneMapping Curve Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {2.0};
- float ToneMappingCurveInterior
- <
- string UIName="TM: ToneMapping Curve Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.8};
- float ToneMappingOversaturationDay
- <
- string UIName="TM: ToneMapping Oversaturation Day";
- string UIWidget="Spinner";
- float UIMin=0.1;
- float UIMax=999.0;
- > = {120.0};
- float ToneMappingOversaturationNight
- <
- string UIName="TM: ToneMapping Oversaturation Night";
- string UIWidget="Spinner";
- float UIMin=0.1;
- float UIMax=999.0;
- > = {12.0};
- float ToneMappingOversaturationInterior
- <
- string UIName="TM: ToneMapping Oversaturation Interior";
- string UIWidget="Spinner";
- float UIMin=0.1;
- float UIMax=999.0;
- > = {20.0};
- #endif
- //end NLA Tonemapping
- //begin NLA Brightness
- #ifdef NLA_BRIGHTNESS_CONTROLS
- float BrightnessDay
- <
- string UIName="B: Brightness Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.15};
- float BrightnessNight
- <
- string UIName="B: Brightness Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.15};
- float BrightnessInterior
- <
- string UIName="B: Brightness Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.15};
- float BrightnessCurveDay
- <
- string UIName="B: Brightness Curve Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.28};
- float BrightnessCurveNight
- <
- string UIName="B: Brightness Curve Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.28};
- float BrightnessCurveInterior
- <
- string UIName="B: Brightness Curve Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=10.0;
- > = {1.22};
- float BrightnessMultiplierDay
- <
- string UIName="B: Brightness Multiplier Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.9};
- float BrightnessMultiplierNight
- <
- string UIName="B: Brightness Multiplier Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.9};
- float BrightnessMultiplierInterior
- <
- string UIName="B: Brightness Multiplier Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.15};
- float BrightnessToneMappingCurveDay
- <
- string UIName="B: Brightness ToneMapping Curve Day";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.5};
- float BrightnessToneMappingCurveNight
- <
- string UIName="B: Brightness ToneMapping Curve Night";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.5};
- float BrightnessToneMappingCurveInterior
- <
- string UIName="B: Brightness ToneMapping Curve Interior";
- string UIWidget="Spinner";
- float UIMin=0.0;
- float UIMax=1.0;
- > = {0.15};
- #endif
- //end NLA Brightness
- #ifdef NLA_LOWDEF_COLOUR_CONTROLS
- 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};
- #endif
- //+++++++++++++++++++++++++++++
- //external parameters, do not modify
- //+++++++++++++++++++++++++++++
- //keyboard controlled temporary variables (in some versions exists in the config file). Press and hold key 1,2,3...8 together with PageUp or PageDown to modify. By default all set to 1.0
- float4 tempF1; //0,1,2,3
- float4 tempF2; //5,6,7,8
- float4 tempF3; //9,0
- //x=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;
- 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;
- };
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 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;
- }
- //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;
- 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
- #ifdef APPLYGAMECOLORCORRECTION
- //apply original
- // 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
- //todo apply uv offsets to coordinates
- r0=tex2D(_s0, IN.txcoord0.xy);//r0=tex2D(_s0, IN.txcoord1.xy);
- r1=tex2D(_s1, IN.txcoord0.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;
- _oC0=r1;
- #endif //APPLYGAMECOLORCORRECTION
- float4 color=_oC0;
- //adaptation in time
- float4 Adaptation=tex2D(_s4, 0.5);
- float grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
- #if (POSTPROCESS==3)
- float Gamma=lerp(lerp(GammaNight, GammaDay, ENightDayFactor), GammaInterior, EInteriorFactor);
- float RedFilter=lerp(lerp(RedFilterNight, RedFilterDay, ENightDayFactor), RedFilterInterior, EInteriorFactor);
- float GreenFilter=lerp(lerp(GreenFilterNight, GreenFilterDay, ENightDayFactor), GreenFilterInterior, EInteriorFactor);
- float BlueFilter=lerp(lerp(BlueFilterNight, BlueFilterDay, ENightDayFactor), BlueFilterInterior, EInteriorFactor);
- float DesatR=lerp(lerp(DesatRNight, DesatRDay, ENightDayFactor), DesatRInterior, EInteriorFactor);
- float DesatG=lerp(lerp(DesatGNight, DesatGDay, ENightDayFactor), DesatGInterior, EInteriorFactor);
- float DesatB=lerp(lerp(DesatBNight, DesatBDay, ENightDayFactor), DesatBInterior, EInteriorFactor);
- float AdaptationMin=lerp(lerp(AdaptationMinNight, AdaptationMinDay, ENightDayFactor), AdaptationMinInterior, EInteriorFactor);
- float AdaptationMax=lerp(lerp(AdaptationMaxNight, AdaptationMaxDay, ENightDayFactor), AdaptationMaxInterior, EInteriorFactor);
- float Saturation=lerp(lerp(SaturationNight, SaturationDay, ENightDayFactor), SaturationInterior, EInteriorFactor);
- float ToneMappingCurve=lerp(lerp(ToneMappingCurveNight, ToneMappingCurveDay, ENightDayFactor), ToneMappingCurveInterior, EInteriorFactor);
- float ToneMappingOversaturation=lerp(lerp(ToneMappingOversaturationNight, ToneMappingOversaturationDay, ENightDayFactor), ToneMappingOversaturationInterior, EInteriorFactor);
- float IntensityContrast=lerp(lerp(IntensityContrastNight, IntensityContrastDay, ENightDayFactor), IntensityContrastInterior, EInteriorFactor);
- float Brightness=lerp(lerp(BrightnessNight, BrightnessDay, ENightDayFactor), BrightnessInterior, EInteriorFactor);
- float BrightnessCurve=lerp(lerp(BrightnessCurveNight, BrightnessCurveDay, ENightDayFactor), BrightnessCurveInterior, EInteriorFactor);
- float BrightnessMultiplier=lerp(lerp(BrightnessMultiplierNight, BrightnessMultiplierDay, ENightDayFactor), BrightnessMultiplierInterior, EInteriorFactor);
- float BrightnessToneMappingCurve=lerp(lerp(BrightnessToneMappingCurveNight, BrightnessToneMappingCurveDay, ENightDayFactor), BrightnessToneMappingCurveInterior, EInteriorFactor);
- float greyscale = dot(color.xyz, float3(0.3, 0.59, 0.11));
- color.r = lerp(greyscale, color.r, DesatR);
- color.g = lerp(greyscale, color.g, DesatG);
- color.b = lerp(greyscale, color.b, DesatB);
- color = pow(color, Gamma);
- color.r = pow(color.r, RedFilter);
- color.g = pow(color.g, GreenFilter);
- color.b = pow(color.b, BlueFilter);
- grayadaptation=max(grayadaptation, 0.0); //0.0
- grayadaptation=min(grayadaptation, 50.0); //50.0
- color.xyz=color.xyz/(grayadaptation*AdaptationMax+AdaptationMin);//*tempF1.x
- color.xyz*=Brightness;
- color.xyz+=0.000001;
- float3 xncol=normalize(color.xyz);
- float3 scl=color.xyz/xncol.xyz;
- scl=pow(scl, IntensityContrast);
- xncol.xyz=pow(xncol.xyz, Saturation);
- color.xyz=scl*xncol.xyz;
- float lumamax=ToneMappingOversaturation;
- color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + ToneMappingCurve);
- 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, BrightnessCurve);
- Y=Y*BrightnessMultiplier;
- Y=Y/(Y+BrightnessToneMappingCurve);
- 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;
- #endif
- //pallete texture (0.082+ version feature)
- #ifdef E_CC_PALETTE
- float Palette=lerp(lerp(PaletteNight, PaletteDay, ENightDayFactor), PaletteInterior, EInteriorFactor);
- float PaletteBrightness=lerp(lerp(PaletteBrightnessNight, PaletteBrightnessDay, ENightDayFactor), PaletteBrightnessInterior, EInteriorFactor);
- 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+PaletteBrightness));//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 * Palette;
- #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
- _oC0.w=1.0;
- _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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement