diff --git a/enbseries/menbeffectfilters.fx b/enbseries/menbeffectfilters.fx index d8be1fa..d0bc51e 100644 --- a/enbseries/menbeffectfilters.fx +++ b/enbseries/menbeffectfilters.fx @@ -204,6 +204,25 @@ float3 GradingGame( float3 res ) tcol = max(0,(tcol*_r3.w-_r3.y)*_r3.z+_r3.y); return lerp(res,tcol,vgradeblend); } +/* LUT colour grading */ +float3 GradingLUT( float3 res ) +{ + /* + gross hacks were needed to "fix" the way direct3d interpolates on + sampling, and to manually interpolate on the blue channel + */ + float3 tcol = clamp(res,0.0,1.0)*0.875+0.0625; + float2 lc1 = float2(tcol.r/16.0+floor(tcol.b*16.0)/16.0,tcol.g/64.0 + +clut/64.0); + float2 lc2 = float2(tcol.r/16.0+ceil(tcol.b*16.0)/16.0,tcol.g/64.0 + +clut/64.0); + float dec = frac(tcol.b*16.0); + float3 tcl1 = tex2D(SamplerLUT,lc1); + float3 tcl2 = tex2D(SamplerLUT,lc2); + tcol = lerp(tcl1,tcl2,dec); + tcol = (tcol-0.0625)/0.875; + return lerp(res,tcol,lutblend); +} /* display debug register */ float debugreg( float r, float2 coord, int p ) { @@ -324,6 +343,7 @@ float4 PS_Mari( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR if ( gradeenable2 ) res.rgb = GradingColorize(res.rgb); if ( gradeenable3 ) res.rgb = GradingHSV(res.rgb); } + if ( lutenable ) res.rgb = GradingLUT(res.rgb); if ( !tintbeforegrade && tintenable ) res.rgb = Tint(res.rgb); if ( fadebeforefilm ) res.rgb = _r5.rgb*_r5.a + res.rgb*(1.0-_r5.a); if ( ne ) res.rgb = FilmGrain(res.rgb,coord); diff --git a/enbseries/menbeffectinternals.fx b/enbseries/menbeffectinternals.fx index fa48771..bb118a5 100644 --- a/enbseries/menbeffectinternals.fx +++ b/enbseries/menbeffectinternals.fx @@ -71,6 +71,10 @@ texture2D texNoise3 < string ResourceName = "menbnoise2.png"; >; +texture2D texLUT +< + string ResourceName = "menblutpreset.png"; +>; sampler2D _s0 = sampler_state { Texture = ; @@ -167,6 +171,18 @@ sampler2D SamplerNoise3 = sampler_state MaxMipLevel = 0; MipMapLodBias = 0; }; +sampler2D SamplerLUT = sampler_state +{ + Texture = ; + MinFilter = LINEAR; + MagFilter = LINEAR; + MipFilter = NONE; + AddressU = Wrap; + AddressV = Wrap; + SRGBTexture = FALSE; + MaxMipLevel = 0; + MipMapLodBias = 0; +}; /* whatever */ struct VS_OUTPUT_POST { diff --git a/enbseries/menbeffectsettings.fx b/enbseries/menbeffectsettings.fx index e852951..c246c26 100644 --- a/enbseries/menbeffectsettings.fx +++ b/enbseries/menbeffectsettings.fx @@ -828,6 +828,24 @@ float vgradeblend float UIMin = 0.0; float UIMax = 1.0; > = {1.0}; +/* LUT grading */ +bool lutenable +< + string UIName = "EnableLUTGrading"; + string UIWidget = "Checkbox"; +> = {false}; +float lutblend +< + string UIName = "LUTBlend"; + string UIWidget = "Spinner"; +> = {1.0}; +int clut +< + string UIName = "LUTPreset"; + string UIWidget = "Spinner"; + int UIMin = 0; + int UIMax = 63; +> = {1}; bool fadebeforefilm < string UIName = "FadeBeforeFilmFilters"; @@ -862,4 +880,4 @@ float regdebugscale string UIName = "DebugRegistersScale"; string UIWidget = "Spinner"; float UIMin = 0.0; -> = {5.0}; \ No newline at end of file +> = {5.0}; diff --git a/enbseries/menbextrafilters.fx b/enbseries/menbextrafilters.fx index edf2430..fae94b6 100644 --- a/enbseries/menbextrafilters.fx +++ b/enbseries/menbextrafilters.fx @@ -226,11 +226,11 @@ float4 PS_ASCII( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR float4 res = tex2D(SamplerColor,coord); if ( !asciienable ) return res; float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); - float2 fresl = float2(8,4096); - float2 cresl = float2(8,16); + float2 fresl = float2(FONT_WIDTH,FONT_HEIGHT); + float2 cresl = float2(GLYPH_WIDTH,GLYPH_HEIGHT); float2 bscl = floor(bresl/cresl); float3 col = tex2D(SamplerColor,floor(bscl*coord)/bscl).rgb; - int lum = luminance(col)*255; + int lum = luminance(col)*FONT_LEVELS; float2 itx = floor(coord*bresl); float2 blk = floor(itx/cresl)*cresl; float2 ofs = itx-blk; @@ -420,4 +420,4 @@ technique PostProcess5 FogEnable = FALSE; SRGBWRITEENABLE = FALSE; } -} \ No newline at end of file +} diff --git a/enbseries/menbextrainternals.fx b/enbseries/menbextrainternals.fx index 0fa2f7b..d7f6dd4 100644 --- a/enbseries/menbextrainternals.fx +++ b/enbseries/menbextrainternals.fx @@ -138,6 +138,12 @@ static const float3 aosega[16] = float3(d(256),d(256),d(256)), }; #undef d +/* dimensions for ascii art font */ +#define FONT_WIDTH 8 +#define FONT_HEIGHT 4096 +#define GLYPH_WIDTH 8 +#define GLYPH_HEIGHT 16 +#define FONT_LEVELS 255 /* standard stuff */ float4 ScreenSize; float ENightDayFactor; diff --git a/enbseries/menblutpreset.png b/enbseries/menblutpreset.png new file mode 100644 index 0000000..20b2f99 Binary files /dev/null and b/enbseries/menblutpreset.png differ diff --git a/settings_skyrim/enbseries/enbeffect.fx.ini b/settings_skyrim/enbseries/enbeffect.fx.ini index ac1657a..4576b2e 100644 --- a/settings_skyrim/enbseries/enbeffect.fx.ini +++ b/settings_skyrim/enbseries/enbeffect.fx.ini @@ -17,7 +17,7 @@ UseBox=false BoxVertical=0.8 UseGrain=false GrainFrequency=2500.0 -GrainIntensity=0.03 +GrainIntensity=0.02 GrainSaturation=0.0 GrainTwoPass=true GrainBlend=3 @@ -32,7 +32,7 @@ GrainPass1Magnification3=2.22 GrainPass2Magnification1=4.25 GrainPass2Magnification2=0.42 GrainPass2Magnification3=6.29 -GrainPower=2.05 +GrainPower=2.8 UseCurve=false CurveChromaAberration=0.03 UseAdaptation=true @@ -163,3 +163,14 @@ ChromaAberration=0.01 ChromaAberrationOverbright=0.0 ChromaAberrationOverbrightMax=4.0 ChromaAberrationOverbrightMin=0.8 +EnableLUTGrading=false +LUTBlendNight=1.0 +LUTBlendDay=1.0 +LUTBlendInteriorNight=1.0 +LUTBlendInteriorDay=1.0 +LUTNight=1 +LUTDay=1 +LUTInteriorNight=1 +LUTInteriorDay=1 +LUTBlend=1.0 +LUTPreset=50 diff --git a/settings_skyrim/enbseries/enbeffectprepass.fx.ini b/settings_skyrim/enbseries/enbeffectprepass.fx.ini index 8a0a29e..c16a207 100644 --- a/settings_skyrim/enbseries/enbeffectprepass.fx.ini +++ b/settings_skyrim/enbseries/enbeffectprepass.fx.ini @@ -122,6 +122,6 @@ FocusCenterX=0.5 FocusCenterY=0.5 FocusCircleAngle=0.0 FocusManual=false -FocusManualValue=0.7 +FocusManualValue=0.75 DistortionChromaticAberration=12.460001 FocusPointDisplay=false