i hope i,ve got the right forum site
so i want to make an fallout 4 ENB preset and wanted to merge Marty McFly,s Lightroom with some effect from JawZ Modual shader libary. Got it to work so far but the effects dont apply :/
I am not that mutch into codeing (just some base C) so i have no idea what to do now. Here my edit of martys file:
Code: Select all
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ENBSeries Skyrim SE dx11 sm5 effect file
// visit facebook.com/MartyMcModding for news/updates
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Lightroom and Unsharp Mask 1.0 by Marty McFly
// Do not redistribute without credits!
// Configuration by: Adyss
// Copyright (c) 2008-2017 Marty McFly
// DO NOT REMOVE/REPLACE THIS HEADER.
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//LIGHTROOM
bool bShowClippingWhite < string UIName="Show white clipping"; > = {false};
bool bShowClippingBlack < string UIName="Show black clipping"; > = {false};
float fLightroom_Red_Hueshift < string UIName="Hue: Red"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Orange_Hueshift < string UIName="Hue: Orange"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Yellow_Hueshift < string UIName="Hue: Yellow"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Green_Hueshift < string UIName="Hue: Green"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Aqua_Hueshift < string UIName="Hue: Aqua"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Blue_Hueshift < string UIName="Hue: Blue"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Magenta_Hueshift < string UIName="Hue: Magenta"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Red_Exposure < string UIName="Exposure: Red"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Orange_Exposure < string UIName="Exposure: Orange"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Yellow_Exposure < string UIName="Exposure: Yellow"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Green_Exposure < string UIName="Exposure: Green"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Aqua_Exposure < string UIName="Exposure: Aqua"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Blue_Exposure < string UIName="Exposure: Blue"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Magenta_Exposure < string UIName="Exposure: Magenta"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Red_Saturation < string UIName="Saturation: Red"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Orange_Saturation < string UIName="Saturation: Orange"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Yellow_Saturation < string UIName="Saturation: Yellow"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Green_Saturation < string UIName="Saturation: Green"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Aqua_Saturation < string UIName="Saturation: Aqua"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Blue_Saturation < string UIName="Saturation: Blue"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_Magenta_Saturation < string UIName="Saturation: Magenta"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalBlackLevel < string UIName="Global Black Level"; string UIWidget="Spinner"; float UIStep=1.0; float UIMin=0.0; float UIMax=512.0; > = {0.0};
float fLightroom_GlobalWhiteLevel < string UIName="Global White Level"; string UIWidget="Spinner"; float UIStep=1.0; float UIMin=0.0; float UIMax=512.0; > = {255.0};
float fLightroom_GlobalExposure < string UIName="Global Exposure"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalGamma < string UIName="Global Gamma"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalBlacksCurve < string UIName="Global Blacks Curve"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalShadowsCurve < string UIName="Global Shadows Curve"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalMidtonesCurve < string UIName="Global Midtones Curve"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalHighlightsCurve < string UIName="Global Highlights Curve"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalWhitesCurve < string UIName="Global Whites Curve"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalContrast < string UIName="Global Contrast"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalSaturation < string UIName="Global Saturation"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalVibrance < string UIName="Global Vibrance"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalTemperature < string UIName="Global Temperature"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
float fLightroom_GlobalTint < string UIName="Global Tint"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=-1.00; float UIMax=1.0; > = {0.0};
bool bLightroom_VignetteEnable < string UIName="V: Enable Vignette"; > = {false};
int iLightroom_VignetteBlendMode < string UIName="V: Blend Mode"; string UIWidget="spinner"; int UIMin=1; int UIMax=4; > = {2};
bool bLightroom_VignetteShowInOut < string UIName="V: Show inner/outer vignette radius"; > = {false};
float fLightroom_VignetteRadiusInner < string UIName="V: Inner radius"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=0.00; float UIMax=2.0; > = {0.5};
float fLightroom_VignetteRadiusOuter < string UIName="V: Outer radius"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=0.00; float UIMax=2.0; > = {1.2};
float fLightroom_VignetteWidth < string UIName="V: Vignette width"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=0.00; float UIMax=1.0; > = {0.0};
float fLightroom_VignetteHeight < string UIName="V: Vignette height"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=0.00; float UIMax=1.0; > = {0.0};
float fLightroom_VignetteAmount < string UIName="V: Vignette amount"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=0.00; float UIMax=1.0; > = {0.5};
float fLightroom_VignetteCurve < string UIName="V: Vignette curve"; string UIWidget="Spinner"; float UIStep=0.01; float UIMin=0.00; float UIMax=10.0; > = {1.5};
//SHARP
int iSharpStepCount < string UIName="SH: Step Count"; string UIWidget="spinner"; int UIMin=1; int UIMax=7; > = {3};
float fSharpStepSize < string UIName="SH: Step Size"; string UIWidget="spinner"; float UIMin=0.0; float UIMax=10.0; > = {0.3};
float fSharpAmount < string UIName="SH: Amount"; string UIWidget="spinner"; float UIMin=0.0; float UIMax=10.0; > = {1.0};
float fSharpClamp < string UIName="SH: Clamp Luma"; string UIWidget="spinner"; float UIMin=0.0; float UIMax=10.0; > = {0.08};
bool bSharpVisualize < string UIName="SH: Show Sharp Mask"; > = {false};
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//external enb parameters, do not modify
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
float4 Timer; //x = generic timer in range 0..1, period of 16777216 ms (4.6 hours), y = average fps, w = frame time elapsed (in seconds)
float4 ScreenSize; //x = Width, y = 1/Width, z = aspect, w = 1/aspect, aspect is Width/Height
float AdaptiveQuality; //changes in range 0..1, 0 means full quality, 1 lowest dynamic quality (0.33, 0.66 are limits for quality levels)
float4 Weather; //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 weather ini file, for example WEATHER002 means index==2, but index==0 means that weather not captured.
float4 TimeOfDay1; //x = dawn, y = sunrise, z = day, w = sunset. Interpolators range from 0..1
float4 TimeOfDay2; //x = dusk, y = night. Interpolators range from 0..1
float ENightDayFactor; //changes in range 0..1, 0 means that night time, 1 - day time
float EInteriorFactor; //changes 0 or 1. 0 means that exterior, 1 - interior
#define PixelSize float2(ScreenSize.y,ScreenSize.y*ScreenSize.z)
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//external enb debugging parameters for shader programmers, do not modify
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
float4 tempF1; //0,1,2,3
float4 tempF2; //5,6,7,8
float4 tempF3; //9,0
float4 tempInfo1; //float4(cursorpos.xy 0~1,isshaderwindowopen, mouse buttons)
float4 tempInfo2; //float4(cursorpos.xy prev left mouse button click, cursorpos.xy prev right mouse button click)
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//mod parameters, do not modify
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// TextureOriginal used in ReShade for ReShade::BackBuffer (colors differ though, RGB vs RBGA)
Texture2D TextureOriginal; //color R10B10G10A2 32 bit ldr format
Texture2D TextureColor; //color which is output of previous technique (except when drawed to temporary render target), R10B10G10A2 32 bit ldr format
Texture2D TextureDepth; //scene depth R32F 32 bit hdr format
//temporary textures which can be set as render target for techniques via annotations like <string RenderTarget="RenderTargetRGBA32";>
Texture2D RenderTargetRGBA32; //R8G8B8A8 32 bit ldr format
Texture2D RenderTargetRGBA64; //R16B16G16A16 64 bit ldr format
Texture2D RenderTargetRGBA64F; //R16B16G16A16F 64 bit hdr format
Texture2D RenderTargetR16F; //R16F 16 bit hdr format with red channel only
Texture2D RenderTargetR32F; //R32F 32 bit hdr format with red channel only
Texture2D RenderTargetRGB32F; //32 bit hdr format without alpha
//Semplers
SamplerState Sampler0
{
Filter = MIN_MAG_MIP_POINT;
AddressU = Clamp;
AddressV = Clamp;
};
SamplerState Sampler1
{
Filter = MIN_MAG_MIP_LINEAR;
AddressU = Clamp;
AddressV = Clamp;
};
//MSL IMPORT
// DATA STRUCTURE
struct VS_INPUT_POST {
float3 pos : POSITION;
float2 txcoord : TEXCOORD0;
};
struct VS_OUTPUT_POST {
float4 pos : SV_POSITION;
float2 txcoord0 : TEXCOORD0;
};
//END
// HELPER FUNCTIONS
/// Include the additional shader files containing all helper functions and constants
#include "/Modular Shaders/msHelpers.fxh"
#include "/Modular Shaders/enbBlur.fxh"
#include "/Modular Shaders/Grain.fxh"
#include "/Modular Shaders/Letterbox.fxh"
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Vertex Shader
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void VS_PostProcess(in float3 inpos : POSITION, inout float2 txcoord0 : TEXCOORD0, out float4 outpos : SV_POSITION)
{
outpos = float4(inpos.xyz,1.0);
}
void VS_Lightroom(in float3 inpos : POSITION,
out float4 outpos : SV_POSITION,
inout float2 txcoord0 : TEXCOORD0,
out float huefactors[7] : TEXCOORD1)
{
outpos = float4(inpos.xyz,1.0);
static const float originalHue[8] = {0.0,0.0833333333333,0.1666666666666,0.3333333333333,0.5,0.6666666666666,0.8333333333333,1.0};
huefactors[0] = (fLightroom_Red_Hueshift > 0.0) ? lerp(originalHue[0], originalHue[1], fLightroom_Red_Hueshift) : lerp(originalHue[7], originalHue[6], -fLightroom_Red_Hueshift);
huefactors[1] = (fLightroom_Orange_Hueshift > 0.0) ? lerp(originalHue[1], originalHue[2], fLightroom_Orange_Hueshift) : lerp(originalHue[1], originalHue[0], -fLightroom_Orange_Hueshift);
huefactors[2] = (fLightroom_Yellow_Hueshift > 0.0) ? lerp(originalHue[2], originalHue[3], fLightroom_Yellow_Hueshift) : lerp(originalHue[2], originalHue[1], -fLightroom_Yellow_Hueshift);
huefactors[3] = (fLightroom_Green_Hueshift > 0.0) ? lerp(originalHue[3], originalHue[4], fLightroom_Green_Hueshift) : lerp(originalHue[3], originalHue[2], -fLightroom_Green_Hueshift);
huefactors[4] = (fLightroom_Aqua_Hueshift > 0.0) ? lerp(originalHue[4], originalHue[5], fLightroom_Aqua_Hueshift) : lerp(originalHue[4], originalHue[3], -fLightroom_Aqua_Hueshift);
huefactors[5] = (fLightroom_Blue_Hueshift > 0.0) ? lerp(originalHue[5], originalHue[6], fLightroom_Blue_Hueshift) : lerp(originalHue[5], originalHue[4], -fLightroom_Blue_Hueshift);
huefactors[6] = (fLightroom_Magenta_Hueshift > 0.0) ? lerp(originalHue[6], originalHue[7], fLightroom_Magenta_Hueshift) : lerp(originalHue[6], originalHue[5], -fLightroom_Magenta_Hueshift);
}
//MSL IMPORT
VS_OUTPUT_POST VS_PostProcess2(VS_INPUT_POST IN) {
VS_OUTPUT_POST OUT;
float4 pos;
pos.xyz = IN.pos.xyz;
pos.w = 1.0;
OUT.pos = pos;
OUT.txcoord0.xy = IN.txcoord.xy;
return OUT;
}
//END
//Bug solved
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Functions
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
float3 RGB2HCV(in float3 RGB)
{
RGB = saturate(RGB);
float Epsilon = 1e-10;
// Based on work by Sam Hocevar and Emil Persson
float4 P = (RGB.g < RGB.b) ? float4(RGB.bg, -1.0, 2.0/3.0) : float4(RGB.gb, 0.0, -1.0/3.0);
float4 Q = (RGB.r < P.x) ? float4(P.xyw, RGB.r) : float4(RGB.r, P.yzx);
float C = Q.x - min(Q.w, Q.y);
float H = abs((Q.w - Q.y) / (6 * C + Epsilon) + Q.z);
return float3(H, C, Q.x);
}
float3 RGB2HSL(in float3 RGB)
{
float3 HCV = RGB2HCV(RGB);
float L = HCV.z - HCV.y * 0.5;
float S = HCV.y / (1.0000001 - abs(L * 2 - 1));
return float3(HCV.x, S, L);
}
float3 HSL2RGB(in float3 HSL)
{
HSL = saturate(HSL);
//HSL.z *= 0.99;
float3 RGB = saturate(float3(abs(HSL.x * 6.0 - 3.0) - 1.0,2.0 - abs(HSL.x * 6.0 - 2.0),2.0 - abs(HSL.x * 6.0 - 4.0)));
float C = (1 - abs(2 * HSL.z - 1)) * HSL.y;
return (RGB - 0.5) * C + HSL.z;
}
float linearstep(float lower, float upper, float value)
{
return saturate((value-lower)/(upper-lower));
}
float GetLumaGradient(float x)
{
x = linearstep(fLightroom_GlobalBlackLevel / 255.0, fLightroom_GlobalWhiteLevel / 255.0, x);
x = saturate(x * exp2(fLightroom_GlobalExposure));
x = pow(x, exp2(-fLightroom_GlobalGamma));
//derp, could add more nodes here
float BlacksMult = smoothstep(0.25,0.00,x);
float ShadowsMult = smoothstep(0.00,0.25,x) * smoothstep(0.50,0.25,x);
float MidtonesMult = smoothstep(0.25,0.50,x) * smoothstep(0.75,0.50,x);
float HighlightsMult = smoothstep(0.50,0.75,x) * smoothstep(1.00,0.75,x);
float WhitesMult = smoothstep(0.75,1.00,x);
float BlacksCurve = fLightroom_GlobalBlacksCurve;
float ShadowsCurve = fLightroom_GlobalShadowsCurve;
float MidtonesCurve = fLightroom_GlobalMidtonesCurve;
float HighlightsCurve = fLightroom_GlobalHighlightsCurve;
float WhitesCurve = fLightroom_GlobalWhitesCurve;
//I'm not proud of that one :V
x = pow(saturate(x), exp2(BlacksMult *exp2(-BlacksCurve)
+ ShadowsMult *exp2(-ShadowsCurve)
+ MidtonesMult *exp2(-MidtonesCurve)
+ HighlightsMult *exp2(-HighlightsCurve)
+ WhitesMult *exp2(-WhitesCurve) - 1));
x = lerp(x,smoothstep(0.0,1.0,x),fLightroom_GlobalContrast); //faster than Dpeasant3's sin based contrast
return x;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Pixel Shaders
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
float4 PS_Sharp(float2 texcoord : TEXCOORD0) : SV_Target
{
float4 blurred = 0.0;
int iStepcount = iSharpStepCount;
float deviation = (float)iStepcount * 0.4;
float norm = -rcp(2.0*deviation*deviation);
float2 offset;
float3 sample;
float2 stepsize = PixelSize.xy * fSharpStepSize;
[loop]
for(int iStepsX=-iStepcount; iStepsX<=iStepcount; iStepsX++)
{
[loop]
for(int iStepsY=-iStepcount; iStepsY<=iStepcount; iStepsY++)
{
float2 cOffset = float2(iStepsX,iStepsY);
sample = TextureColor.SampleLevel(Sampler1, texcoord.xy + cOffset * stepsize,0).xyz;
float weight = exp(dot(cOffset,cOffset)*norm);
blurred.xyz += sample * weight;
blurred.w += weight;
}
}
blurred.xyz /= blurred.w;
/*
float4 res = TextureColor.Sample(Sampler1, texcoord.xy);
res.xyz = lerp(res.xyz,blurred.xyz,-fSharpAmount);
res.xyz = max(res.xyz,0.0);
*/
float4 res = TextureColor.Sample(Sampler1, texcoord.xy);
float3 sharp = res.xyz - blurred.xyz;
float sharp_luma = dot(sharp,fSharpAmount);
sharp_luma = clamp(sharp_luma, -fSharpClamp, fSharpClamp);
res.xyz = bSharpVisualize ? saturate(0.5 + 4*sharp_luma) : saturate(res.xyz + sharp_luma);
return res;
}
//MSL IMPORT
float4 PS_Blur(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target {
float4 res;
res = enbBlur(res, IN.txcoord0.xy);
res.w = 1.0;
return res;
}
float4 PS_PostFX(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target {
float4 res;
res = TextureColor.Sample(Sampler0, IN.txcoord0.xy);
res.rgb = msGrain(res.rgb, IN.txcoord0.xy);
res = msLetterbox(res, IN.txcoord0.xy);
res.w = 1.0;
return res;
}
//END
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
float4 PS_Lightroom(float4 vpos : SV_POSITION, float2 texcoord : TEXCOORD0, float huefactors[7] : TEXCOORD1) : SV_Target
{
float4 color = TextureColor.Sample(Sampler1, texcoord.xy);
color.xyz = saturate(color.xyz); //we did tonemapping in enbeffect.fx so we force LDR here.
//TEMPERATURE AND TINT - looking for better alternatives ..
float3 ColdKelvinColor = HSL2RGB(float3(0.56111,1.0,0.5));
float3 WarmKelvinColor = HSL2RGB(float3(0.06111,1.0,0.5));
float3 TempKelvinColor = lerp(ColdKelvinColor, WarmKelvinColor, fLightroom_GlobalTemperature*0.5+0.5);
float oldLuma = RGB2HSL(color.xyz).z;
float3 tintedColor = color.xyz * TempKelvinColor / dot(TempKelvinColor,float3(0.299,0.587,0.114)); //just using old luma does not work for some reason and weirds out colors.
color.xyz = HSL2RGB(float3(RGB2HSL(tintedColor.xyz).xy,oldLuma));
float3 TintColorGreen = HSL2RGB(float3(0.31111,1.0,0.5));
float3 TintColorPurple = HSL2RGB(float3(0.81111,1.0,0.5));
float3 TempTintColor = lerp(TintColorGreen, TintColorPurple, fLightroom_GlobalTint*0.5+0.5);
tintedColor = color.xyz * TempTintColor / dot(TempTintColor,float3(0.299,0.587,0.114)); //just using old luma does not work for some reason and weirds out colors.
color.xyz = HSL2RGB(float3(RGB2HSL(tintedColor.xyz).xy,oldLuma));
//GLOBAL ADJUSTMENTS
float3 HSL = RGB2HSL(color.xyz);
HSL.z = GetLumaGradient(HSL.z);
HSL.y = saturate(HSL.y + HSL.y*fLightroom_GlobalSaturation);
HSL.y = pow(HSL.y,1.0 / exp2(fLightroom_GlobalVibrance)); //Preprocessor makes -f[..] to --f[..] so we need 1 / x
HSL.xyz = saturate(HSL.xyz); //EXTREMELY IMPORTANT! FIXES BLACK PIXELS
//HUE ADJUSTMENTS
float huemults[7] =
{
/*red*/ max(saturate(1.0 - abs(HSL.x*12.0)), saturate(1.0 - abs((HSL.x-12.0/12)* 6.0))),
/*orange*/ saturate(1.0 - abs((HSL.x-1.0/12)*12.0)),
/*yellow*/ max(saturate(1.0 - abs((HSL.x-2.0/12)*12.0))*step(HSL.x,2.0/12.0), saturate(1.0 - abs((HSL.x-2.0/12)* 6.0))*step(2.0/12.0,HSL.x)),
/*green*/ saturate(1.0 - abs((HSL.x-4.0/12)* 6.0)),
/*aqua*/ saturate(1.0 - abs((HSL.x-6.0/12)* 6.0)),
/*blue*/ saturate(1.0 - abs((HSL.x-8.0/12)* 6.0)),
/*magenta*/ saturate(1.0 - abs((HSL.x-10.0/12)* 6.0))
};
//could use exp2 for saturation as well but then grayscale would require -inf as saturation setting. sqrt(sat) to make exposure changes more intense as it'd only apply fully on max saturated pixels.
color.xyz = 0.0;
color.xyz += huemults[0] * HSL2RGB(float3(huefactors[0],saturate(HSL.y + HSL.y * fLightroom_Red_Saturation), HSL.z * exp2(sqrt(HSL.y)*fLightroom_Red_Exposure) ));
color.xyz += huemults[1] * HSL2RGB(float3(huefactors[1],saturate(HSL.y + HSL.y * fLightroom_Orange_Saturation), HSL.z * exp2(sqrt(HSL.y)*fLightroom_Orange_Exposure) ));
color.xyz += huemults[2] * HSL2RGB(float3(huefactors[2],saturate(HSL.y + HSL.y * fLightroom_Yellow_Saturation), HSL.z * exp2(sqrt(HSL.y)*fLightroom_Yellow_Exposure) ));
color.xyz += huemults[3] * HSL2RGB(float3(huefactors[3],saturate(HSL.y + HSL.y * fLightroom_Green_Saturation), HSL.z * exp2(sqrt(HSL.y)*fLightroom_Green_Exposure) ));
color.xyz += huemults[4] * HSL2RGB(float3(huefactors[4],saturate(HSL.y + HSL.y * fLightroom_Aqua_Saturation), HSL.z * exp2(sqrt(HSL.y)*fLightroom_Aqua_Exposure) ));
color.xyz += huemults[5] * HSL2RGB(float3(huefactors[5],saturate(HSL.y + HSL.y * fLightroom_Blue_Saturation), HSL.z * exp2(sqrt(HSL.y)*fLightroom_Blue_Exposure) ));
color.xyz += huemults[6] * HSL2RGB(float3(huefactors[6],saturate(HSL.y + HSL.y * fLightroom_Magenta_Saturation), HSL.z * exp2(sqrt(HSL.y)*fLightroom_Magenta_Exposure) ));
//VIGNETTE
float2 VignetteCoord = texcoord.xy * 2.0 - 1.0;
VignetteCoord.xy *= 1.0 - float2(fLightroom_VignetteWidth,fLightroom_VignetteHeight);
float VignetteGradient = length(VignetteCoord);
float VignetteFactor = linearstep(fLightroom_VignetteRadiusInner, fLightroom_VignetteRadiusOuter, VignetteGradient);
VignetteFactor = pow(VignetteFactor,fLightroom_VignetteCurve+0.00001) * fLightroom_VignetteAmount;
if(bLightroom_VignetteEnable)
{
color.xyz = (iLightroom_VignetteBlendMode == 1) ? color.xyz * saturate(1.0 - VignetteFactor) : color.xyz;
color.xyz = (iLightroom_VignetteBlendMode == 2) ? saturate(color.xyz-VignetteFactor.xxx) : color.xyz;
color.xyz = (iLightroom_VignetteBlendMode == 3) ? 1.0-(1.0-color.xyz)*(VignetteFactor + 1.0) : color.xyz;
color.xyz = (iLightroom_VignetteBlendMode == 4) ? color.xyz * saturate(lerp(1.0 - VignetteFactor*2.0,1.0,dot(color.xyz,0.333))) : color.xyz;
//thanks inigo quilez!
float innerRing = abs(VignetteGradient-fLightroom_VignetteRadiusInner);
float outerRing = abs(VignetteGradient-fLightroom_VignetteRadiusOuter);
innerRing /= length(float2(ddx(innerRing),ddy(innerRing))/(2*PixelSize.y));
outerRing /= length(float2(ddx(outerRing),ddy(outerRing))/(2*PixelSize.y));
innerRing = saturate(1.0 - 100.0 * innerRing);
outerRing = saturate(1.0 - 100.0 * outerRing);
color.xyz = (bLightroom_VignetteShowInOut != 0) ? lerp(color.xyz,float3(0.0,1.0,0.0),saturate(innerRing)) : color.xyz;
color.xyz = (bLightroom_VignetteShowInOut != 0) ? lerp(color.xyz,float3(1.0,0.0,0.0),saturate(outerRing)) : color.xyz;
}
//CLIP MASK
color.xyz = (bShowClippingWhite && dot(color.xyz,1.0) >= 3.0) ? float3(1.0,0.0,0.0) : color.xyz;
color.xyz = (bShowClippingBlack && dot(color.xyz,1.0) <= 0.0) ? float3(0.0,0.0,1.0) : color.xyz; //"<=0" when we just saturate()'ed, am I drunk?
color.w = 1.0;
return color;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Techniques are drawn one after another and they use the result of
// the previous technique as input color to the next one. The number
// of techniques is limited to 255. If UIName is specified, then it
// is a base technique which may have extra techniques with indexing
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
technique11 Sharp <string UIName="Sharp";>
{
pass p0
{
SetVertexShader(CompileShader(vs_5_0, VS_PostProcess()));
SetPixelShader(CompileShader(ps_5_0, PS_Sharp()));
}
}
technique11 Lightroom <string UIName="Lightroom";>
{
pass p0
{
SetVertexShader(CompileShader(vs_5_0, VS_Lightroom()));
SetPixelShader(CompileShader(ps_5_0, PS_Lightroom()));
}
}
technique11 SharpLightroom <string UIName="SharpBlur + Lightroom + Noise + Letterbox";>
{
pass p0
{
SetVertexShader(CompileShader(vs_5_0, VS_PostProcess()));
SetPixelShader(CompileShader(ps_5_0, PS_Sharp()));
}
}
technique11 SharpLightroom1
{
pass p0
{
SetVertexShader(CompileShader(vs_5_0, VS_Lightroom()));
SetPixelShader(CompileShader(ps_5_0, PS_Lightroom()));
}
}
technique11 BlurSharp { /// First Blur Pass
pass p0 {
SetVertexShader(CompileShader(vs_5_0, VS_PostProcess2()));
SetPixelShader(CompileShader(ps_5_0, PS_Blur()));
}
}
technique11 BlurSharp1 { /// Second Blur Pass
pass p0 {
SetVertexShader(CompileShader(vs_5_0, VS_PostProcess2()));
SetPixelShader(CompileShader(ps_5_0, PS_Blur()));
}
}
technique11 BlurSharp3 { /// Post effects
pass p0 {
SetVertexShader(CompileShader(vs_5_0, VS_PostProcess2()));
SetPixelShader(CompileShader(ps_5_0, PS_PostFX()));
}
}
Hope you guys can help me I am really not to the world of codes and ENB
(and sorry for my english :/ its not my native language)