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-2012 Boris Vorontsov
- //++++++++++++++++++++++++++++++++++++++++++++
- #ifndef POSTPROCESS
- #define POSTPROCESS 3
- #endif
- //+++++++++++++++++++++++++++++
- //internal parameters, can be modified
- //+++++++++++++++++++++++++++++
- //float3 EColorFilter=float3(1.0, 0.9, 0.9);
- //modify these values to tweak various color processing
- //POSTPROCESS 3
- float EAdaptationMinV3=0.05;
- float EAdaptationMaxV3=0.05;
- float EToneMappingCurveV3=1.0;
- float EToneMappingOversaturationV3=10.0;
- //begin NLA Adaptation
- float AdaptationMinInterior = 0.015;
- float AdaptationMaxInterior = 0.015;
- float AdaptationMinDay = 0.015;
- float AdaptationMaxDay = 0.015;
- float AdaptationMinNight = 0.015;
- float AdaptationMaxNight = 0.015;
- //End
- //begin NLA Palette
- float PaletteDay = 1.475;
- float PaletteNight = 1.475;
- float PaletteInterior = 1.475;
- float PaletteBrightnessDay = 1.0;
- float PaletteBrightnessNight = 1.0;
- float PaletteBrightnessInterior = 3.0;
- //End
- //begin NLA Color
- float GammaDay = 1.2;
- float GammaNight = 1.2;
- float GammaInterior = 1.2;
- float DesatRDay = 1.0;
- float DesatRNight = 1.0;
- float DesatRInterior = 1.0;
- float DesatGDay = 1.0;
- float DesatGNight = 1.0;
- float DesatGInterior = 1.0;
- float DesatBDay = 0.9;
- float DesatBNight = 1.0;
- float DesatBInterior = 0.9;
- //End
- //begin NLA Tonemapping
- float IntensityContrastDay = 1.5;
- float IntensityContrastNight = 1.5;
- float IntensityContrastInterior = 1.5;
- float SaturationDay = 1.0;
- float SaturationNight = 1.0;
- float SaturationInterior = 1.0;
- float ToneMappingCurveDay = 2.0;
- float ToneMappingCurveNight = 2.0;
- float ToneMappingCurveInterior = 2.0;
- float ToneMappingOversaturationDay = 40.0;
- float ToneMappingOversaturationNight = 40.0;
- float ToneMappingOversaturationInterior = 40.0;
- //End
- //begin NLA Brightness
- float BrightnessDay = 0.22;
- float BrightnessNight = 0.10;
- float BrightnessInterior = 0.22;
- float BrightnessCurveDay = 1.05;
- float BrightnessCurveNight = 1.05;
- float BrightnessCurveInterior = 1.05;
- float BrightnessMultiplierDay = 0.9;
- float BrightnessMultiplierNight = 0.9;
- float BrightnessMultiplierInterior = 0.9;
- float BrightnessToneMappingCurveDay = 0.7;
- float BrightnessToneMappingCurveNight = 0.7;
- float BrightnessToneMappingCurveInterior = 0.7;
- //end NLA Brightness
- //begin Vibrance
- float VibranceAmount = 0.50; // 1.00 = None, 0.0001 = Fuckloads
- float VibranceIntensity = 1.00;
- float VibranceR = 1.00;
- float VibranceRBrightness = 1.00;
- float VibranceG = 0.9;
- float VibranceGBrightness = 1.00;
- float VibranceB = 0.90;
- float VibranceBBrightness = 1.00;
- //end Vibrance
- //begin HPD Tonemapping
- float HPDTonemappingExposure = 2.2f;
- float HPDTonemappingClipping = 0.004f;
- float HPDTonemappingUpperTone = 6.2f;
- float HPDTonemappingGreyTone = 0.5f;
- float HPDTonemappingMiddleTone = 1.7f;
- float HPDTonemappingLowerTone = 0.06;
- float HPDTonemappingLerp = 0.5;
- //end HPD Tonemapping
- //+++++++++++++++++++++++++++++
- //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 oblivion
- texture2D texs1;//bloom oblivion
- texture2D texs2;//adaptaion oblivion
- texture2D texs3;//bloom enb
- texture2D texs4;//adaptation enb
- texture2D texs7;//palette enb
- sampler2D _s0 = sampler_state
- {
- Texture = <texs0>;
- MinFilter = POINT;//
- MagFilter = POINT;//
- MipFilter = NONE;//LINEAR;
- AddressU = Clamp;
- AddressV = Clamp;
- SRGBTexture=FALSE;
- MaxMipLevel=0;
- MipMapLodBias=0;
- };
- sampler2D _s1 = sampler_state
- {
- Texture = <texs1>;
- MinFilter = LINEAR;//
- MagFilter = LINEAR;//
- MipFilter = NONE;//LINEAR;
- AddressU = Clamp;
- AddressV = Clamp;
- SRGBTexture=FALSE;
- MaxMipLevel=0;
- MipMapLodBias=0;
- };
- sampler2D _s2 = sampler_state
- {
- Texture = <texs2>;
- MinFilter = LINEAR;//
- MagFilter = LINEAR;//
- MipFilter = NONE;//LINEAR;
- AddressU = Clamp;
- AddressV = Clamp;
- SRGBTexture=FALSE;
- MaxMipLevel=0;
- MipMapLodBias=0;
- };
- sampler2D _s3 = sampler_state
- {
- Texture = <texs3>;
- MinFilter = LINEAR;//
- MagFilter = LINEAR;//
- MipFilter = NONE;//LINEAR;
- AddressU = Clamp;
- AddressV = Clamp;
- SRGBTexture=FALSE;
- MaxMipLevel=0;
- MipMapLodBias=0;
- };
- sampler2D _s4 = sampler_state
- {
- Texture = <texs4>;
- MinFilter = LINEAR;//
- MagFilter = LINEAR;//
- MipFilter = NONE;//LINEAR;
- AddressU = Clamp;
- AddressV = Clamp;
- SRGBTexture=FALSE;
- MaxMipLevel=0;
- MipMapLodBias=0;
- };
- sampler2D _s7 = sampler_state
- {
- Texture = <texs7>;
- MinFilter = LINEAR;
- MagFilter = LINEAR;
- MipFilter = NONE;
- AddressU = Clamp;
- AddressV = Clamp;
- SRGBTexture=FALSE;
- MaxMipLevel=0;
- MipMapLodBias=0;
- };
- struct VS_OUTPUT_POST
- {
- float4 vpos : POSITION;
- float2 txcoord0 : TEXCOORD0;
- };
- struct VS_INPUT_POST
- {
- float3 pos : POSITION;
- float2 txcoord0 : TEXCOORD0;
- };
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- //
- //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
- {
- VS_OUTPUT_POST OUT;
- OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
- OUT.txcoord0.xy=IN.txcoord0.xy;
- return OUT;
- }
- //oblivion shader specific externals, do not modify
- float4 _c1 : register(c1);
- float4 PS_B8104A59(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
- // HDRParam c1 1
- // Src0 s0 1
- // DestBlend s1 1
- // AvgLum s2 1
- //s1 - bloom
- //s0 - color
- r2=tex2D(_s2, IN.txcoord0.xy);
- r1=tex2D(_s1, IN.txcoord0.xy);
- r0=tex2D(_s0, IN.txcoord0.xy);
- r2.x=dot(r2.xyz, 1.0);
- r0.w=max(r2.x, _c1.x);
- r0.w=1.0/r0.w;
- r1.w=r0.w * 0.5;
- r2.xyz=r1.xyz * r1.w;
- r0.w=r0.w * _c1.x;
- r1.xyz=max(r2.xyz, 0.0);
- r0.xyz=r0.w * r0.xyz + r1.xyz;
- r0.w=1.0;
- _oC0=r0;
- #endif //APPLYGAMECOLORCORRECTION
- float4 color=_oC0;
- //adaptation in time
- float4 Adaptation=tex2D(_s4, 0.5);
- float grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
- //Set up realtime vars
- ToneMappingCurveDay = tempF1.x;
- ToneMappingCurveNight = tempF1.y;
- ToneMappingCurveInterior = tempF1.z;
- ToneMappingOversaturationDay = tempF1.w;
- ToneMappingOversaturationNight = tempF2.x;
- ToneMappingOversaturationInterior = tempF2.y;
- IntensityContrastDay = tempF2.z;
- IntensityContrastNight = tempF2.w;
- IntensityContrastInterior = tempF3.x;
- //End
- //begin Paste01
- float fGamma = lerp(GammaNight, GammaDay, ENightDayFactor);
- fGamma = lerp(fGamma, GammaInterior, EInteriorFactor);
- float DesatR = lerp(DesatRNight, DesatRDay, ENightDayFactor);
- DesatR = lerp(DesatR, DesatRInterior, EInteriorFactor);
- float DesatG = lerp(DesatGNight, DesatGDay, ENightDayFactor);
- DesatG = lerp(DesatG, DesatGInterior, EInteriorFactor);
- float DesatB = lerp(DesatBNight, DesatBDay, ENightDayFactor);
- DesatB = lerp(DesatB, DesatBInterior, EInteriorFactor);
- float AdaptationMin = lerp(AdaptationMinNight, AdaptationMinDay, ENightDayFactor);
- AdaptationMin = lerp(AdaptationMin, AdaptationMinInterior, EInteriorFactor);
- float AdaptationMax = lerp(AdaptationMaxNight, AdaptationMaxDay, ENightDayFactor);
- AdaptationMax = lerp(AdaptationMax, AdaptationMaxInterior, EInteriorFactor);
- float Saturation = lerp(SaturationNight, SaturationDay, ENightDayFactor);
- Saturation = lerp(Saturation, SaturationInterior, EInteriorFactor);
- float ToneMappingCurve = lerp(ToneMappingCurveNight, ToneMappingCurveDay, ENightDayFactor);
- ToneMappingCurve = lerp(ToneMappingCurve, ToneMappingCurveInterior, EInteriorFactor);
- float ToneMappingOversaturation = lerp(ToneMappingOversaturationNight, ToneMappingOversaturationDay, ENightDayFactor);
- ToneMappingOversaturation = lerp(ToneMappingOversaturation, ToneMappingOversaturationInterior, EInteriorFactor);
- float IntensityContrast = lerp(IntensityContrastNight, IntensityContrastDay, ENightDayFactor);
- IntensityContrast = lerp(IntensityContrast, IntensityContrastInterior, EInteriorFactor);
- float Brightness = lerp(BrightnessNight, BrightnessDay, ENightDayFactor);
- Brightness = lerp(Brightness, BrightnessInterior, EInteriorFactor);
- float BrightnessCurve = lerp(BrightnessCurveNight, BrightnessCurveDay, ENightDayFactor);
- BrightnessCurve=lerp(BrightnessCurve, BrightnessCurveInterior, EInteriorFactor);
- float BrightnessMultiplier = lerp(BrightnessMultiplierNight, BrightnessMultiplierDay, ENightDayFactor);
- BrightnessMultiplier = lerp(BrightnessMultiplier, BrightnessMultiplierInterior, EInteriorFactor);
- float BrightnessToneMappingCurve = lerp(BrightnessToneMappingCurveNight, BrightnessToneMappingCurveDay, ENightDayFactor);
- BrightnessToneMappingCurve = lerp(BrightnessToneMappingCurve, 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.xyz = pow(color, fGamma);
- //end Paste01
- #if (POSTPROCESS==3)
- grayadaptation = max(grayadaptation, 0.0);
- grayadaptation = min(grayadaptation, 50.0);
- color.xyz = color.xyz / (grayadaptation * AdaptationMax + AdaptationMin);//*tempF1.x
- //begin Paste02
- 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;
- //end Paste02
- 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;
- //pallete texture (0.082+ version feature)
- #ifdef E_CC_PALETTE
- //begin Paste03
- float fPalette = lerp(PaletteNight, PaletteDay, ENightDayFactor);
- fPalette = lerp(fPalette, PaletteInterior, EInteriorFactor);
- float PaletteBrightness = lerp(PaletteBrightnessNight, PaletteBrightnessDay, ENightDayFactor);
- PaletteBrightness = lerp(PaletteBrightness, PaletteBrightnessInterior, EInteriorFactor);
- color.rgb = saturate(color.rgb);
- float3 brightness = Adaptation.xyz;//tex2D(_s4, 0.5);//adaptation luminance
- 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 * fPalette;
- //end Paste03
- #endif //E_CC_PALETTE
- //Vibrance
- 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 = lerp(VibColor.rgb, color.rgb, VibranceAmount);
- //End
- //HPD Tonemapping
- float3 HPDcolor = color.xyz;
- HPDcolor = max(HPDcolor, HPDTonemappingClipping);
- HPDcolor = pow(abs((HPDcolor * (HPDTonemappingUpperTone * HPDcolor + HPDTonemappingGreyTone )) / (HPDcolor * (HPDTonemappingUpperTone * HPDcolor + HPDTonemappingMiddleTone) + HPDTonemappingLowerTone )), HPDTonemappingExposure);
- color.xyz = lerp(HPDcolor.xyz, color.xyz, HPDTonemappingLerp);
- //End
- _oC0.w=1.0;
- _oC0.xyz=color.xyz;
- return _oC0;
- }
- //switch between vanilla and mine post processing
- #ifndef ENB_FLIPTECHNIQUE
- technique Shader_B8104A59
- #else
- technique Shader_ORIGINALPOSTPROCESS
- #endif
- {
- pass p0
- {
- VertexShader = compile vs_3_0 VS_Quad();
- PixelShader = compile ps_3_0 PS_B8104A59();
- ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
- ZEnable=FALSE;
- ZWriteEnable=FALSE;
- CullMode=NONE;
- AlphaTestEnable=FALSE;
- AlphaBlendEnable=FALSE;
- SRGBWRITEENABLE=FALSE;
- }
- }
- //original shader of post processing
- #ifndef ENB_FLIPTECHNIQUE
- technique Shader_ORIGINALPOSTPROCESS
- #else
- technique Shader_B8104A59
- #endif
- {
- pass p0
- {
- //VertexShader = compile vs_3_0 VS_Quad();
- VertexShader=
- asm
- {
- // float4 texRatio0;
- // float4 texRatio1;
- //
- //
- // Registers:
- //
- // Name Reg Size
- // ------------ ----- ----
- // texRatio0 c6 1
- // texRatio1 c7 1
- vs_1_1
- dcl_position v0
- dcl_texcoord v1
- // mad oT0.xy, v1, c6, c6.zwzw
- // mad oT1.xy, v1, c7, c7.zwzw
- mov oT0.xy, v1
- mov oT1.xy, v1
- mov oPos, v0
- };
- PixelShader=
- asm
- {
- // sampler2D AvgLum;
- // sampler2D DestBlend;
- // float4 HDRParam;
- // sampler2D Src0;
- //
- //
- // Registers:
- //
- // Name Reg Size
- // ------------ ----- ----
- // HDRParam c1 1
- // Src0 s0 1
- // DestBlend s1 1
- // AvgLum s2 1
- //s0 - bloom
- //s1 - color
- ps_2_x
- def c0, 1, 0.5, 0, 0
- dcl t0.xy
- dcl t1.xy
- dcl_2d s0
- dcl_2d s1
- dcl_2d s2
- texld r2, t0, s2
- texld r1, t0, s0
- texld r0, t1, s1
- dp3 r2.x, r2, c0.x
- max r0.w, r2.x, c1.x
- rcp r0.w, r0.w
- mul r1.w, r0.w, c0.y
- mul r2.xyz, r1, r1.w
- mul r0.w, r0.w, c1.x
- max r1.xyz, r2, c0.z
- mad r0.xyz, r0.w, r0, r1
- mov r0.w, c0.x
- mov oC0, r0
- };
- 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