diff --git a/enbseries.ini b/enbseries.ini index 4f660c0..74527ab 100644 --- a/enbseries.ini +++ b/enbseries.ini @@ -59,15 +59,15 @@ FadeFogRangeNight=3.0 SizeScale=0.5 SourceTexturesScale=0.5 FilterQuality=0 -AOAmount=1.07 -AOAmountInterior=1.05 -ILAmount=2.23 -ILAmountInterior=2.12 -AOIntensity=0.59 -AOIntensityInterior=0.52 +AOAmount=1.23 +AOAmountInterior=1.17 +ILAmount=1.28 +ILAmountInterior=1.19 +AOIntensity=1.17 +AOIntensityInterior=1.07 AOType=0 AOMixingType=2 -AOMixingTypeInterior=3 +AOMixingTypeInterior=2 EnableDenoiser=true [ENVIRONMENT] LightingIntensityDay=1.15 diff --git a/enbseries/VERSION b/enbseries/VERSION index 6af074d..23b0839 100644 --- a/enbseries/VERSION +++ b/enbseries/VERSION @@ -1 +1 @@ -2.5.1nv "Begin Again" +2.6.0nv "Wendigo" diff --git a/enbseries/effect.txt.ini b/enbseries/effect.txt.ini index b7c9e2a..938d246 100644 --- a/enbseries/effect.txt.ini +++ b/enbseries/effect.txt.ini @@ -1,17 +1,10 @@ [EFFECT.TXT] TECHNIQUE=0 -Enable Block GFX=false -Emulated Resolution Width=0.5 -Emulated Resolution Height=0.5 -Palette Type=4 -CGA Palette=1 -EGA Palette=0 -VGA Palette=0 -Dithering Pattern=2 -Contrast Modifier=1.0 -Saturation Modifier=0.75 -Dither Offset=-0.1 -Dither Range=0.15 +Enable Oil Filter=false +Enable FXAA=false +FXAA Span Max=4.0 +FXAA Reduce Mul=16.0 +FXAA Reduce Min=128.0 Enable Chroma Key=false Chroma Key Red=0.0 Chroma Key Green=0.5 @@ -33,15 +26,15 @@ Box Horizontal Ratio=2.39 Box Vertical Ratio=1.0 Enable Vignette=false Enable Border Blur=false -Vignette Shape=0 -Vignette Blending Mode=0 -Vignette Contrast=1.0 -Vignette Intensity=1.0 +Vignette Shape=1 +Vignette Blending Mode=2 +Vignette Contrast=9.35 +Vignette Intensity=0.61 Vignette Shift=0.0 -Vignette Color Red=0.0 -Vignette Color Green=0.0 -Vignette Color Blue=0.0 -Border Blur Contrast=1.0 -Border Blur Intensity=1.0 +Vignette Color Red=-0.2 +Vignette Color Green=-0.17 +Vignette Color Blue=-0.24 +Border Blur Contrast=1.22 +Border Blur Intensity=1.78 Border Blur Shift=0.0 Border Blur Radius=1.0 diff --git a/enbseries/enbeffect.fx.ini b/enbseries/enbeffect.fx.ini index fee55a5..25dffe2 100644 --- a/enbseries/enbeffect.fx.ini +++ b/enbseries/enbeffect.fx.ini @@ -16,12 +16,12 @@ Frost Factor Night=1.27 Frost Factor Day=-1.36 Frost Factor Interior=0.0 Enable Grain=true -Grain Speed=15.0 -Grain Intensity=0.18 -Grain Saturation=-0.19 +Grain Speed=8.0 +Grain Intensity=0.93 +Grain Saturation=-0.4 Grain Two-Pass=true Grain Blending Mode=3 -Grain Dark Mask Contrast=19.110001 +Grain Dark Mask Contrast=19.129999 Grain Two-Pass Factor=0.04 Grain Magnification 1=15.13 Grain Magnification 2=15.3 @@ -32,8 +32,13 @@ Grain Pass 1 Magnification 3=2.22 Grain Pass 2 Magnification 1=4.25 Grain Pass 2 Magnification 2=9.42 Grain Pass 2 Magnification 3=6.29 -Grain Contrast=4.63 +Grain Contrast=2.07 Apply Grain Before Tone Mapping=true +Enable Dirt=true +Dirt Coord Factor=-0.09 +Dirt Luminance Factor=0.0 +Dirt Coord Zoom=1.27 +Dirt Luminance Zoom=1.0 Enable Adaptation=true Adaptation Min Night=0.69 Adaptation Min Day=0.8 @@ -126,7 +131,7 @@ Vanilla Vibrance Strength=1.0 Enable LUT Grading=true LUT Blend Night=0.43 LUT Blend Day=0.32 -LUT Blend Interior=1.0 +LUT Blend Interior=0.26 Enable Technicolor=true Technicolor Blend=0.5 Enable Post Dither=true diff --git a/enbseries/enbeffectprepass.fx.ini b/enbseries/enbeffectprepass.fx.ini index a84fc93..73889c2 100644 --- a/enbseries/enbeffectprepass.fx.ini +++ b/enbseries/enbeffectprepass.fx.ini @@ -98,6 +98,35 @@ Edgevision Fade Intensity Interior=500.0 Edgevision Contrast=0.25 Edgevision Intensity=4.0 Edgevision Radius=1.0 +Invert Edgevision=false +Blend Edgevision=false +Enable Edge Detect=false +Edge Detect Contrast=1.0 +Edge Detect Intensity=1.0 +Edge Detect Radius=1.0 +Invert Edge Detect=false +Blend Edge Detect=false +Enable Linevision=false +Linevision Fade Contrast Night=2.0 +Linevision Fade Contrast Day=2.0 +Linevision Fade Contrast Interior=2.0 +Linevision Fade Intensity Night=500.0 +Linevision Fade Intensity Day=500.0 +Linevision Fade Intensity Interior=500.0 +Linevision Contrast=1.0 +Linevision Intensity=2.0 +Linevision Radius=1.0 +Linevision Threshold=0.05 +Invert Linevision=false +Blend Linevision=false +Enable Custom Fog=false +Fog Contrast=1.0 +Fog Intensity=1.0 +Fog Shift=0.0 +Fog ColorX=1.0 +Fog ColorY=1.0 +Fog ColorZ=1.0 +Limbo Mode=false Enable SSAO=false SSAO Radius=0.05 SSAO Noise=0 @@ -107,8 +136,9 @@ SSAO Fade Contrast Interior=0.43 SSAO Fade Intensity Night=1.343 SSAO Fade Intensity Day=1.53 SSAO Fade Intensity Interior=1.41 -SSAO Intensity=1.25 -SSAO Contrast=0.65 +SSAO Intensity=1.5 +SSAO Contrast=0.5 +SSAO Shift=-0.5 SSAO Blending=0.8 SSAO Blur=true SSAO Bilateral Factor=1500.0 diff --git a/enbseries/menbcgalut.png b/enbseries/menbcgalut.png deleted file mode 100644 index 17cda3f..0000000 Binary files a/enbseries/menbcgalut.png and /dev/null differ diff --git a/enbseries/menbeffectfilters.fx b/enbseries/menbeffectfilters.fx index e62c9fa..92cb1ec 100644 --- a/enbseries/menbeffectfilters.fx +++ b/enbseries/menbeffectfilters.fx @@ -196,54 +196,22 @@ float3 GradingGame( float3 res ) float3 GradingLUT( float3 res ) { /* - Gross hacks were needed to "fix" the way direct3d interpolates on - sampling, and to manually interpolate on the blue channel. - This could be removed if I could have the LUTs as volume maps, but - I think ENB doesn't support those. + Volume maps are SO MUCH BETTER on the shader side, no ugly + interpolation hacks are needed to work around sampling quirks, + and the code is EXTREMELY simplified as a result. + + Seriously, it's just as simple as using the screen rgb values + as xyz coordinates, nothing more, it maps exactly 1:1. Additionally, + the LUTs can have any arbitrary width, height and depth. + + It's also possible to use RGBA32F color on the LUT side, but that's + a bit more complicated to set up for the user. GIMP doesn't support + that format yet, dunno about Photoshop. */ -#ifdef LUTMODE_LEGACY - float3 tcol = clamp(res,0.08,0.92); - tcol.rg = tcol.rg*0.5+0.25; - float2 lc1 = float2(tcol.r/16.0+floor(tcol.b*16.0)/16.0,tcol.g/64.0); - float2 lc2 = float2(tcol.r/16.0+ceil(tcol.b*16.0)/16.0,tcol.g/64.0); - float dec = (ceil(tcol.b*16.0)==16.0)?(0.0):frac(tcol.b*16.0); - /* night samples */ - float3 tcl1_n = tex2D(SamplerLUT,lc1+float2(0,clut_n/64.0)).rgb; - float3 tcl2_n = tex2D(SamplerLUT,lc2+float2(0,clut_n/64.0)).rgb; - /* day samples */ - float3 tcl1_d = tex2D(SamplerLUT,lc1+float2(0,clut_d/64.0)).rgb; - float3 tcl2_d = tex2D(SamplerLUT,lc2+float2(0,clut_d/64.0)).rgb; - /* interior samples */ - float3 tcl1_i = tex2D(SamplerLUT,lc1+float2(0,clut_in/64.0)).rgb; - float3 tcl2_i = tex2D(SamplerLUT,lc2+float2(0,clut_in/64.0)).rgb; -#else -#ifdef LUTMODE_16 - float3 tcol = clamp(res,0.08,0.92); - tcol.rg = tcol.rg*0.5+0.25; - float2 lc1 = float2(tcol.r,tcol.g/16.0+floor(tcol.b*16.0)/16.0); - float2 lc2 = float2(tcol.r,tcol.g/16.0+ceil(tcol.b*16.0)/16.0); - float dec = (ceil(tcol.b*16.0)==16.0)?(0.0):frac(tcol.b*16.0); -#endif -#ifdef LUTMODE_64 - float3 tcol = clamp(res,0.02,0.98); - tcol.rg = tcol.rg*0.5+0.25; - float2 lc1 = float2(tcol.r,tcol.g/64.0+floor(tcol.b*64.0)/64.0); - float2 lc2 = float2(tcol.r,tcol.g/64.0+ceil(tcol.b*64.0)/64.0); - float dec = (ceil(tcol.b*64.0)==64.0)?(0.0):frac(tcol.b*64.0); -#endif - /* night samples */ - float3 tcl1_n = tex2D(SamplerLUTN,lc1).rgb; - float3 tcl2_n = tex2D(SamplerLUTN,lc2).rgb; - /* day samples */ - float3 tcl1_d = tex2D(SamplerLUTD,lc1).rgb; - float3 tcl2_d = tex2D(SamplerLUTD,lc2).rgb; - /* interior samples */ - float3 tcl1_i = tex2D(SamplerLUTI,lc1).rgb; - float3 tcl2_i = tex2D(SamplerLUTI,lc2).rgb; -#endif - float3 tcl1 = tod_ind(tcl1); - float3 tcl2 = tod_ind(tcl2); - tcol = lerp(tcl1,tcl2,dec); + float3 tcl_n = tex3D(SamplerLUTN,res).rgb; + float3 tcl_d = tex3D(SamplerLUTD,res).rgb; + float3 tcl_i = tex3D(SamplerLUTI,res).rgb; + float3 tcol = tod_ind(tcl); float lutblend = tod_ind(lutblend); return lerp(res,tcol,lutblend); } @@ -336,6 +304,19 @@ float2 ScreenFrost( float2 coord ) ofs *= clamp(pow(dist,frostrpow)*frostrmult+frostrbump,0.0,1.0); return coord+ofs; } +/* Old MariENB 0.x screen dirt filter, updated */ +float3 ScreenDirt( float3 res, float2 coord ) +{ + float2 nr = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w)/256.0; + float3 ncolc = tex2D(SamplerNoise1,coord*dirtmc*nr).rgb; + float2 ds = float2(res.r+res.g,res.g+res.b)/2.0; + float3 ncoll = tex2D(SamplerNoise1,ds*dirtml).rgb; + res = lerp(res,(ncolc.r+1.0)*res,dirtcfactor + *saturate(1.0-(ds.x+ds.y)*0.25)); + res = lerp(res,(ncoll.r+1.0)*res,dirtlfactor + *saturate(1.0-(ds.x+ds.y)*0.25)); + return res; +} /* MariENB shader */ float4 PS_Mari( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR { @@ -385,6 +366,7 @@ float4 PS_Mari( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR res.rgb += bcol; if ( aenable ) res.rgb = Adaptation(res.rgb); if ( nbt && ne ) res.rgb = FilmGrain(res.rgb,coord); + if ( dirtenable ) res.rgb = ScreenDirt(res.rgb,coord); res.rgb = Tonemap(res.rgb); if ( vgradeenable ) res.rgb = GradingGame(res.rgb); if ( gradeenable1 ) res.rgb = GradingRGB(res.rgb); diff --git a/enbseries/menbeffectinternals.fx b/enbseries/menbeffectinternals.fx index 1325292..82a9fa1 100644 --- a/enbseries/menbeffectinternals.fx +++ b/enbseries/menbeffectinternals.fx @@ -47,48 +47,30 @@ texture2D texs2; texture2D texs3; texture2D texs4; texture2D texs7; -texture2D texNoise2 +texture2D texNoise1 < string ResourceName = "menbnoise1.png"; >; -texture2D texNoise3 +texture2D texNoise2 < string ResourceName = "menbnoise2.png"; >; -#ifdef LUTMODE_LEGACY -texture2D texLUT +texture2D texNoise3 < - string ResourceName = "menblutpreset.png"; + string ResourceName = "menbnoise3.png"; >; -#else -texture2D texLUTN +texture3D texLUTN < -#ifdef LUTMODE_16 - string ResourceName = "menblut16_night.png"; -#endif -#ifdef LUTMODE_64 - string ResourceName = "menblut64_night.png"; -#endif + string ResourceName = "menblut_night.dds"; >; -texture2D texLUTD +texture3D texLUTD < -#ifdef LUTMODE_16 - string ResourceName = "menblut16_day.png"; -#endif -#ifdef LUTMODE_64 - string ResourceName = "menblut64_day.png"; -#endif + string ResourceName = "menblut_day.dds"; >; -texture2D texLUTI +texture3D texLUTI < -#ifdef LUTMODE_16 - string ResourceName = "menblut16_interior.png"; -#endif -#ifdef LUTMODE_64 - string ResourceName = "menblut64_interior.png"; -#endif + string ResourceName = "menblut_interior.dds"; >; -#endif texture2D texTonemap < string ResourceName = "menbfilmlut.png"; @@ -172,12 +154,23 @@ sampler2D _s7 = sampler_state SRGBTexture = FALSE; MaxMipLevel = 0; MipMapLodBias = 0; +};sampler2D SamplerNoise1 = sampler_state +{ + Texture = ; + MinFilter = LINEAR; + MagFilter = LINEAR; + MipFilter = NONE; + AddressU = Wrap; + AddressV = Wrap; + SRGBTexture = FALSE; + MaxMipLevel = 0; + MipMapLodBias = 0; }; sampler2D SamplerNoise2 = sampler_state { Texture = ; MinFilter = LINEAR; - MagFilter = POINT; + MagFilter = LINEAR; MipFilter = NONE; AddressU = Wrap; AddressV = Wrap; @@ -197,21 +190,7 @@ sampler2D SamplerNoise3 = sampler_state MaxMipLevel = 0; MipMapLodBias = 0; }; -#ifdef LUTMODE_LEGACY -sampler2D SamplerLUT = sampler_state -{ - Texture = ; - MinFilter = LINEAR; - MagFilter = LINEAR; - MipFilter = NONE; - AddressU = Clamp; - AddressV = Clamp; - SRGBTexture = FALSE; - MaxMipLevel = 0; - MipMapLodBias = 0; -}; -#else -sampler2D SamplerLUTN = sampler_state +sampler3D SamplerLUTN = sampler_state { Texture = ; MinFilter = LINEAR; @@ -219,11 +198,12 @@ sampler2D SamplerLUTN = sampler_state MipFilter = NONE; AddressU = Clamp; AddressV = Clamp; + AddressW = Clamp; SRGBTexture = FALSE; MaxMipLevel = 0; MipMapLodBias = 0; }; -sampler2D SamplerLUTD = sampler_state +sampler3D SamplerLUTD = sampler_state { Texture = ; MinFilter = LINEAR; @@ -231,11 +211,12 @@ sampler2D SamplerLUTD = sampler_state MipFilter = NONE; AddressU = Clamp; AddressV = Clamp; + AddressW = Clamp; SRGBTexture = FALSE; MaxMipLevel = 0; MipMapLodBias = 0; }; -sampler2D SamplerLUTI = sampler_state +sampler3D SamplerLUTI = sampler_state { Texture = ; MinFilter = LINEAR; @@ -243,11 +224,11 @@ sampler2D SamplerLUTI = sampler_state MipFilter = NONE; AddressU = Clamp; AddressV = Clamp; + AddressW = Clamp; SRGBTexture = FALSE; MaxMipLevel = 0; MipMapLodBias = 0; }; -#endif sampler2D SamplerTonemap = sampler_state { Texture = ; diff --git a/enbseries/menbeffectsettings.fx b/enbseries/menbeffectsettings.fx index e175ef5..e98aa3a 100644 --- a/enbseries/menbeffectsettings.fx +++ b/enbseries/menbeffectsettings.fx @@ -207,6 +207,33 @@ bool nbt string UIName = "Apply Grain Before Tone Mapping"; string UIWidget = "Checkbox"; > = {true}; +/* old dirt filter */ +string str_dirt = "Screen Dirt"; +bool dirtenable +< + string UIName = "Enable Dirt"; + string UIWidget = "Checkbox"; +> = {false}; +float dirtcfactor +< + string UIName = "Dirt Coord Factor"; + string UIWidget = "Spinner"; +> = {0.1}; +float dirtlfactor +< + string UIName = "Dirt Luminance Factor"; + string UIWidget = "Spinner"; +> = {0.0}; +float dirtmc +< + string UIName = "Dirt Coord Zoom"; + string UIWidget = "Spinner"; +> = {3.0}; +float dirtml +< + string UIName = "Dirt Luminance Zoom"; + string UIWidget = "Spinner"; +> = {1.0}; /* "adaptation" factors */ string str_adaptation = "Eye Adaptation"; bool aenable @@ -731,29 +758,6 @@ float lutblend_i string UIName = "LUT Blend Interior"; string UIWidget = "Spinner"; > = {1.0}; -#ifdef LUTMODE_LEGACY -int clut_n -< - string UIName = "LUT Preset Night"; - string UIWidget = "Spinner"; - int UIMin = 0; - int UIMax = 63; -> = {1}; -int clut_d -< - string UIName = "LUT Preset Day"; - string UIWidget = "Spinner"; - int UIMin = 0; - int UIMax = 63; -> = {1}; -int clut_i -< - string UIName = "LUT Preset Interior"; - string UIWidget = "Spinner"; - int UIMin = 0; - int UIMax = 63; -> = {1}; -#endif /* technicolor shader */ string str_tech = "Technicolor"; bool techenable diff --git a/enbseries/menbegalut.png b/enbseries/menbegalut.png deleted file mode 100644 index db0a4fd..0000000 Binary files a/enbseries/menbegalut.png and /dev/null differ diff --git a/enbseries/menbextrafilters.fx b/enbseries/menbextrafilters.fx index 190acbe..b4a853f 100644 --- a/enbseries/menbextrafilters.fx +++ b/enbseries/menbextrafilters.fx @@ -31,108 +31,6 @@ float3 hsv2rgb( float3 c ) float3 p = abs(frac(c.x+K.xyz)*6.0-K.w); return c.z*lerp(K.x,saturate(p-K.x),c.y); } -/* prepass */ -float4 ReducePrepass( in float4 col, in float2 coord ) -{ - float3 hsv = rgb2hsv(col); - hsv.y = clamp(hsv.y*bsaturation,0.0,1.0); - hsv.z = pow(max(0,hsv.z),bgamma); - col.rgb = hsv2rgb(saturate(hsv)); - if ( dither == 0 ) - col += bdbump+checkers[int(coord.x%2)+2*int(coord.y%2)]*bdmult; - else if ( dither == 1 ) - col += bdbump+ordered2[int(coord.x%2)+2*int(coord.y%2)]*bdmult; - else if ( dither == 2 ) - col += bdbump+ordered8[int(coord.x%8)+8*int(coord.y%8)]*bdmult; - col = saturate(col); - return col; -} -/* - CGA had seven graphic modes (320x200 modes have low/high contrast versions): - - 640x200 monochrome, which doesn't really need a palette here, as it can - be done procedurally with minimum effort. - - 320x200 black/cyan/magenta/white - - 320x200 black/green/red/brown - - 320x200 black/cyan/red/white -*/ -float4 ReduceCGA( in float4 color, in float2 coord ) -{ - float4 dac = clamp(ReducePrepass(color,coord),0.02,0.98); - float2 lc = float2((dac.r+cgapal)/7.0, - dac.g/64.0+floor(dac.b*64.0)/64.0); - return tex2D(SamplerCGA,lc); -} -/* - EGA technically only had a fixed 16-colour palette, but when VGA came out, - it was possible to tweak the DAC, allowing for custom palettes. - AOS EGA is a palette based on my terminal colour scheme on Linux, which I - also use for AliceOS. -*/ -float4 ReduceEGA( in float4 color, in float2 coord ) -{ - float4 dac = clamp(ReducePrepass(color,coord),0.02,0.98); - float2 lc = float2((dac.r+egapal)/2.0, - dac.g/64.0+floor(dac.b*64.0)/64.0); - return tex2D(SamplerEGA,lc); -} -/* A two bits per channel mode that can usually fit VGA mode 13h and mode x */ -float4 ReduceRGB2( in float4 color, in float2 coord ) -{ - float4 dac = ReducePrepass(color,coord); - color.rgb = trunc(dac.rgb*4.0)/4.0; - return color; -} -/* - The classic 16-bit colour mode everyone from my generation would remember, - especially that subtle green tint and the banding due to lack of dithering - in most games and GPUs at that time. -*/ -float4 ReduceRGB565( in float4 color, in float2 coord ) -{ - float4 dac = ReducePrepass(color,coord); - color.rgb = trunc(dac.rgb*float3(32.0,64.0,32.0)) - /float3(32.0,64.0,32.0); - return color; -} -/* Various VGA 256-colour palettes: Doom, Quake I, and the standard. */ -float4 ReduceVGA( in float4 color, in float2 coord ) -{ - float4 dac = clamp(ReducePrepass(color,coord),0.02,0.98); - float2 lc = float2((dac.r+vgapal)/15.0, - dac.g/64.0+floor(dac.b*64.0)/64.0); - return tex2D(SamplerVGA,lc); -} -/* Retro rockets */ -float4 PS_Retro( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR -{ - float2 coord = IN.txcoord.xy; - float4 res = tex2D(SamplerColorb,coord); - if ( !useblock ) return res; - float2 rresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); - float4 tcol; - float2 bresl = rresl; - if ( bresx <= 0 || bresy <= 0 ) bresl = rresl; - else - { - if ( bresx <= 1.0 ) bresl.x = rresl.x*bresx; - else bresl.x = bresx; - if ( bresy <= 1.0 ) bresl.y = rresl.y*bresy; - else bresl.y = bresy; - } - float2 ncoord = (coord-0.5)+0.5; - ncoord = floor(ncoord*bresl)/bresl; - ncoord += 0.5/bresl; - if ( bresx <= 0 || bresy <= 0 ) ncoord = coord; - tcol = tex2D(SamplerColorb,ncoord); - if ( paltype == 0 ) res = ReduceCGA(tcol,coord*bresl); - else if ( paltype == 1 ) res = ReduceEGA(tcol,coord*bresl); - else if ( paltype == 2 ) res = ReduceRGB2(tcol,coord*bresl); - else if ( paltype == 3 ) res = ReduceVGA(tcol,coord*bresl); - else if ( paltype == 4 ) res = ReduceRGB565(tcol,coord*bresl); - else res = tcol; - res.a = 1.0; - return res; -} float4 PS_ChromaKey( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR { float2 coord = IN.txcoord.xy; @@ -235,8 +133,8 @@ float4 PS_Vignette( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR /* box vignette */ float2 uv = coord.xy*(1.0-coord.yx)*4.0; vigdata.a = 1.0-(uv.x*uv.y); - vigdata.a = clamp(pow(vigdata.a,vigpow)*vigmul+vigbump, - 0.0,1.0); + vigdata.a = clamp(pow(max(vigdata.a,0.0),vigpow)*vigmul + +vigbump,0.0,1.0); vigdata.rgb = float3(vigcolor_r,vigcolor_g,vigcolor_b); } else @@ -271,13 +169,59 @@ float4 PS_Vignette( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR } return clamp(res,0.0,1.0); } -/* TODO paint filter */ -/*float4 PS_Oily( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR +/* paint filter */ +float4 PS_Kuwahara( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR { float2 coord = IN.txcoord.xy; float4 res = tex2D(SamplerColor,coord); + if ( !oilenable ) return res; + float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); + float2 bof = 1.0/bresl; + float n = 16.0; + float3 m[4] = + { + float3(0,0,0),float3(0,0,0),float3(0,0,0),float3(0,0,0) + }, s[4] = + { + float3(0,0,0),float3(0,0,0),float3(0,0,0),float3(0,0,0) + }, c; + int i, j; + [loop] for ( i=-3; i<=0; i++ ) [loop] for ( j=-3; j<=0; j++ ) + { + c = tex2D(SamplerColor,coord+float2(i,j)*bof).rgb; + m[0] += c; + s[0] += c*c; + } + [loop] for ( i=-3; i<=0; i++ ) [loop] for ( j=0; j<=3; j++ ) + { + c = tex2D(SamplerColor,coord+float2(i,j)*bof).rgb; + m[1] += c; + s[1] += c*c; + } + [loop] for ( i=0; i<=3; i++ ) [loop] for ( j=-3; j<=0; j++ ) + { + c = tex2D(SamplerColor,coord+float2(i,j)*bof).rgb; + m[2] += c; + s[2] += c*c; + } + [loop] for ( i=0; i<=3; i++ ) [loop] for ( j=0; j<=3; j++ ) + { + c = tex2D(SamplerColor,coord+float2(i,j)*bof).rgb; + m[3] += c; + s[3] += c*c; + } + float min_sigma2 = 1e+2, sigma2; + [unroll] for ( i=0; i<4; i++ ) + { + m[i] /= n; + s[i] = abs(s[i]/n-m[i]*m[i]); + sigma2 = s[i].r+s[i].g+s[i].b; + if ( sigma2 >= min_sigma2 ) continue; + min_sigma2 = sigma2; + res.rgb = m[i]; + } return res; -}*/ +} /* ultimate super-cinematic immersive black bars */ float4 PS_Cinematic( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR { @@ -295,13 +239,53 @@ float4 PS_Cinematic( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR if ( -test.x != test.y ) res *= 0.0; return res; } -/* TODO bring back oil filter */ +/* Legacy MariENB FXAA, useful for further smoothing the paint filter */ +float4 PS_FXAA( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR +{ + float2 coord = float2(IN.txcoord.x,IN.txcoord.y); + float4 res = tex2D(SamplerColor,coord); + if ( !fxaaenable ) return res; + float fxaareducemul_ = 1.0/max(abs(fxaareducemul),1.0); + float fxaareducemin_ = 1.0/max(abs(fxaareducemin),1.0); + float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); + float2 bof = float2(1.0/bresl.x,1.0/bresl.y); + float3 rgbNW = tex2D(SamplerColor,coord+float2(-1,-1)*bof).rgb; + float3 rgbNE = tex2D(SamplerColor,coord+float2(1,-1)*bof).rgb; + float3 rgbSW = tex2D(SamplerColor,coord+float2(-1,1)*bof).rgb; + float3 rgbSE = tex2D(SamplerColor,coord+float2(1,1)*bof).rgb; + float3 rgbM = tex2D(SamplerColor,coord).rgb; + float3 luma = float3(0.299,0.587,0.114); + float lumaNW = dot(rgbNW,luma); + float lumaNE = dot(rgbNE,luma); + float lumaSW = dot(rgbSW,luma); + float lumaSE = dot(rgbSE,luma); + float lumaM = dot(rgbM,luma); + float lumaMin = min(lumaM,min(min(lumaNW,lumaNE),min(lumaSW,lumaSE))); + float lumaMax = max(lumaM,max(max(lumaNW,lumaNE),max(lumaSW,lumaSE))); + float2 dir = float2(-((lumaNW+lumaNE)-(lumaSW+lumaSE)),((lumaNW+lumaSW) + -(lumaNE+lumaSE))); + float dirReduce = max((lumaNW+lumaNE+lumaSW+lumaSE)*(0.25 + *fxaareducemul_),fxaareducemin_); + float rcpDirMin = 1.0/(min(abs(dir.x),abs(dir.y))+dirReduce); + dir = min(float2(fxaaspanmax,fxaaspanmax),max(float2(-fxaaspanmax, + -fxaaspanmax),dir*rcpDirMin))/bresl; + float3 rgbA = (1.0/2.0)*(tex2D(SamplerColor,coord+dir*(1.0/3.0-0.5)) + .rgb+tex2D(SamplerColor,coord+dir*(2.0/3.0-0.5)).rgb); + float3 rgbB = rgbA*(1.0/2.0)+(1.0/4.0)*(tex2D(SamplerColor,coord+dir + *(0.0/3.0-0.5)).rgb+tex2D(SamplerColor,coord+dir*(3.0/3.0-0.5)) + .rgb); + float lumaB = dot(rgbB,luma); + if ( (lumaB < lumaMin) || (lumaB > lumaMax) ) res.rgb = rgbA; + else res.rgb = rgbB; + res.a = 1.0; + return res; +} technique PostProcess { pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_Blur(); + PixelShader = compile ps_3_0 PS_Kuwahara(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -318,7 +302,7 @@ technique PostProcess2 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_Sharp(); + PixelShader = compile ps_3_0 PS_FXAA(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -335,7 +319,7 @@ technique PostProcess3 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_Shift(); + PixelShader = compile ps_3_0 PS_Blur(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -352,7 +336,7 @@ technique PostProcess4 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_ChromaKey(); + PixelShader = compile ps_3_0 PS_Sharp(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -369,7 +353,7 @@ technique PostProcess5 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_Vignette(); + PixelShader = compile ps_3_0 PS_Shift(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -381,13 +365,12 @@ technique PostProcess5 SRGBWRITEENABLE = FALSE; } } -/* Paint will go between these two */ technique PostProcess6 { pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_Retro(); + PixelShader = compile ps_3_0 PS_ChromaKey(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -400,6 +383,23 @@ technique PostProcess6 } } technique PostProcess7 +{ + pass p0 + { + VertexShader = compile vs_3_0 VS_Pass(); + PixelShader = compile ps_3_0 PS_Vignette(); + DitherEnable = FALSE; + ZEnable = FALSE; + CullMode = NONE; + ALPHATESTENABLE = FALSE; + SEPARATEALPHABLENDENABLE = FALSE; + AlphaBlendEnable = FALSE; + StencilEnable = FALSE; + FogEnable = FALSE; + SRGBWRITEENABLE = FALSE; + } +} +technique PostProcess8 { pass p0 { diff --git a/enbseries/menbextrainternals.fx b/enbseries/menbextrainternals.fx index 1141662..0af77ed 100644 --- a/enbseries/menbextrainternals.fx +++ b/enbseries/menbextrainternals.fx @@ -10,54 +10,14 @@ static const float gauss4[4] = { 0.270682, 0.216745, 0.111281, 0.036633 }; -/* - dithering threshold maps - don't touch unless you know what you're doing -*/ -static const float checkers[4] = -{ - 1.0,0.0, - 0.0,1.0 -}; -#define d(x) x/4.0 -static const float ordered2[4] = -{ - d(0),d(2), - d(4),d(2) -}; -#undef d -#define d(x) x/64.0 -static const float ordered8[64] = -{ - d( 0),d(48),d(12),d(60),d( 3),d(51),d(15),d(63), - d(32),d(16),d(44),d(28),d(35),d(19),d(47),d(31), - d( 8),d(56),d( 4),d(52),d(11),d(59),d( 7),d(55), - d(40),d(24),d(36),d(20),d(43),d(27),d(39),d(23), - d( 2),d(50),d(14),d(62),d( 1),d(49),d(13),d(61), - d(34),d(18),d(46),d(30),d(33),d(17),d(45),d(29), - d(10),d(58),d( 6),d(54),d( 9),d(57),d( 5),d(53), - d(42),d(26),d(38),d(22),d(41),d(25),d(37),d(21) -}; -#undef d /* standard stuff */ float4 ScreenSize; float ENightDayFactor; float EInteriorFactor; +float4 Timer; /* samplers and textures */ texture2D texColor; texture2D texDepth; -texture2D texCGA -< - string ResourceName = "menbcgalut.png"; ->; -texture2D texEGA -< - string ResourceName = "menbegalut.png"; ->; -texture2D texVGA -< - string ResourceName = "menbvgalut.png"; ->; texture2D texVignette < #ifdef VIGNETTE_DDS @@ -102,42 +62,6 @@ sampler2D SamplerDepth = sampler_state MaxMipLevel = 0; MipMapLodBias = 0; }; -sampler2D SamplerCGA = sampler_state -{ - Texture = ; - MinFilter = POINT; - MagFilter = POINT; - MipFilter = NONE; - AddressU = Wrap; - AddressV = Clamp; - SRGBTexture = FALSE; - MaxMipLevel = 0; - MipMapLodBias = 0; -}; -sampler2D SamplerEGA = sampler_state -{ - Texture = ; - MinFilter = POINT; - MagFilter = POINT; - MipFilter = NONE; - AddressU = Wrap; - AddressV = Clamp; - SRGBTexture = FALSE; - MaxMipLevel = 0; - MipMapLodBias = 0; -}; -sampler2D SamplerVGA = sampler_state -{ - Texture = ; - MinFilter = POINT; - MagFilter = POINT; - MipFilter = NONE; - AddressU = Wrap; - AddressV = Clamp; - SRGBTexture = FALSE; - MaxMipLevel = 0; - MipMapLodBias = 0; -}; sampler2D SamplerVignette = sampler_state { Texture = ; diff --git a/enbseries/menbextrasettings.fx b/enbseries/menbextrasettings.fx index da1c8ef..13fe80e 100644 --- a/enbseries/menbextrasettings.fx +++ b/enbseries/menbextrasettings.fx @@ -4,142 +4,35 @@ Part of MariENB, the personal ENB of Marisa. Released under the GNU GPLv3 (or later). */ -/* BlockGFX filter, I'm proud of it */ -string str_block = "BlockGFX Suite"; -bool useblock +/* Paint filter */ +string str_paint = "Painting Filter"; +bool oilenable < - string UIName = "Enable Block GFX"; + string UIName = "Enable Oil Filter"; string UIWidget = "Checkbox"; > = {false}; -/* - emulated resolution: - 0 or 1 : real resolution - <1 and >0 : multiple of real resolution (e.g.: 0.5 is half resolution) - >1 : this resolution (e.g.: 320x200 is good ol' Mode 13h) -*/ -float bresx +/* legacy FXAA filter */ +string str_fxaa = "FXAA"; +bool fxaaenable < - string UIName = "Emulated Resolution Width"; - string UIWidget = "Spinner"; - float UIMin = 0.0; -> = {0.5}; -float bresy + string UIName = "Enable FXAA"; + string UIWidget = "Checkbox"; +> = {false}; +float fxaaspanmax < - string UIName = "Emulated Resolution Height"; - string UIWidget = "Spinner"; - float UIMin = 0.0; -> = {0.5}; -/* - palette type: - -1 : disable - 0 : CGA (320x200 4-color, or 640x200 monochrome) - 1 : EGA (320x200, 16 colors) - 2 : RGB2 (64-color quarter VGA palette, used in AOS) - 3 : VGA (256 colors) - 4 : RGB565 (ol' 16-bit "true color") -*/ -int paltype + string UIName = "FXAA Span Max"; + string UIWidget = "Checkbox"; +> = {4.0}; +float fxaareducemul < - string UIName = "Palette Type"; - string UIWidget = "Spinner"; - int UIMin = -1; - int UIMax = 4; -> = {1}; -/* - CGA palette to use: - 0 : black, white. - 1 : black, cyan, magenta, white. low contrast - 2 : black, cyan, magenta, white. high contrast - 3 : black, green, red, brown. low contrast - 4 : black, green, red, brown. high contrast - 5 : black, cyan, red, white. low contrast - 6 : black, cyan, red, white. high contrast -*/ -int cgapal + string UIName = "FXAA Reduce Mul"; + string UIWidget = "Checkbox"; +> = {16.0}; +float fxaareducemin < - string UIName = "CGA Palette"; - string UIWidget = "Spinner"; - int UIMin = 0; - int UIMax = 6; -> = {1}; -/* - EGA palette to use: - 0 : Standard EGA - 1 : AOS EGA (it's designed for text, but looks well on images too) -*/ -int egapal -< - string UIName = "EGA Palette"; - string UIWidget = "Spinner"; - int UIMin = 0; - int UIMax = 1; -> = {0}; -/* - VGA palette to use: - 0 : Standard VGA - 1 : Amulets & Armor - 2 : Blood - 3 : Doom - 4 : Duke Nukem 3D - 5 : Hacx 2.0 - 6 : Heretic - 7 : Hexen - 8 : Hexen 2 - 9 : Quake - 10 : Quake 2 - 11 : Rise of the Triad - 12 : Shadow Warrior - 13 : Strife - 14 : Wolfenstein 3D - TODO Project .Blank palette (when the design is finished) -*/ -int vgapal -< - string UIName = "VGA Palette"; - string UIWidget = "Spinner"; - int UIMin = 0; - int UIMax = 14; -> = {0}; -/* - Dithering mode: - -1 : No dithering, just raw banding - 0 : 2x2 checkerboard dithering, looks like ass - 1 : 2x2 ordered dithering - 2 : 8x8 ordered dithering -*/ -int dither -< - string UIName = "Dithering Pattern"; - string UIWidget = "Spinner"; - int UIMin = -1; - int UIMax = 2; -> = {2}; -/* gamma modifier for base color, lower values raise midtones and viceversa */ -float bgamma -< - string UIName = "Contrast Modifier"; - string UIWidget = "Spinner"; - float UIMin = 0.0; -> = {0.35}; -/* saturation modifier for base color, helps with limited palettes */ -float bsaturation -< - string UIName = "Saturation Modifier"; - string UIWidget = "Spinner"; -> = {1.1}; -/* base brightness bump for the dither grid */ -float bdbump -< - string UIName = "Dither Offset"; - string UIWidget = "Spinner"; -> = {-0.1}; -/* range multiplier for the dither grid */ -float bdmult -< - string UIName = "Dither Range"; - string UIWidget = "Spinner"; - float UIMin = 0.0; -> = {0.25}; + string UIName = "FXAA Reduce Min"; + string UIWidget = "Checkbox"; +> = {128.0}; /* Depth-cutting chroma key */ string str_mask = "Depth Chroma Key"; bool maskenable @@ -342,4 +235,4 @@ float bblurradius string UIName = "Border Blur Radius"; string UIWidget = "Spinner"; float UIMin = 0.0; -> = {1.0}; +> = {1.0}; \ No newline at end of file diff --git a/enbseries/menbglobaldefs.fx b/enbseries/menbglobaldefs.fx index d0393be..f7bf1d2 100644 --- a/enbseries/menbglobaldefs.fx +++ b/enbseries/menbglobaldefs.fx @@ -14,12 +14,7 @@ #define NOISESIZE 256.0 #define HEATSIZE 1024.0 #define FROSTSIZE 1024.0 -/* LUT mode (use only one) - The 256px option was discarded for size reasons */ -//#define LUTMODE_LEGACY -//#define LUTMODE_16 -#define LUTMODE_64 /* some textures can be provided as DDS rather than PNG to save space */ //#define HEAT_DDS //#define FROST_DDS -//#define FROSTBUMP_DDS //#define VIGNETTE_DDS \ No newline at end of file diff --git a/enbseries/menblut64_day.png b/enbseries/menblut64_day.png deleted file mode 100644 index e641b1e..0000000 Binary files a/enbseries/menblut64_day.png and /dev/null differ diff --git a/enbseries/menblut64_interior.png b/enbseries/menblut64_interior.png deleted file mode 100644 index 157d147..0000000 Binary files a/enbseries/menblut64_interior.png and /dev/null differ diff --git a/enbseries/menblut64_night.png b/enbseries/menblut64_night.png deleted file mode 100644 index 6f974ed..0000000 Binary files a/enbseries/menblut64_night.png and /dev/null differ diff --git a/enbseries/menblut_day.dds b/enbseries/menblut_day.dds new file mode 100644 index 0000000..b7c4231 Binary files /dev/null and b/enbseries/menblut_day.dds differ diff --git a/enbseries/menblut_interior.dds b/enbseries/menblut_interior.dds new file mode 100644 index 0000000..bd02931 Binary files /dev/null and b/enbseries/menblut_interior.dds differ diff --git a/enbseries/menblut_night.dds b/enbseries/menblut_night.dds new file mode 100644 index 0000000..b674f78 Binary files /dev/null and b/enbseries/menblut_night.dds differ diff --git a/enbseries/menbnoise1.png b/enbseries/menbnoise1.png index 3e915eb..2d794f5 100644 Binary files a/enbseries/menbnoise1.png and b/enbseries/menbnoise1.png differ diff --git a/enbseries/menbnoise2.png b/enbseries/menbnoise2.png index 450769f..3e915eb 100644 Binary files a/enbseries/menbnoise2.png and b/enbseries/menbnoise2.png differ diff --git a/enbseries/menbnoise3.png b/enbseries/menbnoise3.png new file mode 100644 index 0000000..450769f Binary files /dev/null and b/enbseries/menbnoise3.png differ diff --git a/enbseries/menbprepassfilters.fx b/enbseries/menbprepassfilters.fx index 3e48c50..a90ec07 100644 --- a/enbseries/menbprepassfilters.fx +++ b/enbseries/menbprepassfilters.fx @@ -153,9 +153,95 @@ float3 EdgeView( float3 res, float2 coord ) mdy += GY[2][2]*depths[2][2]; mud = pow(mdx*mdx+mdy*mdy,0.5); float fade = 1.0-tex2D(SamplerDepth,coord).x; - mud *= saturate(pow(max(0,fade),edgevfadepow)*edgevfademult); - mud = saturate(pow(max(0,mud),edgevpow)*edgevmult); - return mud; + mud *= clamp(pow(max(0.0,fade),edgevfadepow)*edgevfademult,0.0,1.0); + mud = clamp(pow(max(0.0,mud),edgevpow)*edgevmult,0.0,1.0); + if ( edgevblend ) return res-(edgevinv?1.0-mud:mud); + return edgevinv?1.0-mud:mud; +} +/* luminance edge detection */ +float3 EdgeDetect( float3 res, float2 coord ) +{ + float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); + if ( fixedx>0 ) bresl.x = fixedx; + if ( fixedy>0 ) bresl.y = fixedy; + float2 bof = float2(1.0/bresl.x,1.0/bresl.y)*comradius; + float mdx = 0, mdy = 0, mud = 0; + float3x3 lums; + float3 col = tex2D(SamplerColor,coord+float2(-1,-1)*bof).rgb; + lums[0][0] = luminance(col); + col = tex2D(SamplerColor,coord+float2(0,-1)*bof).rgb; + lums[0][1] = luminance(col); + col = tex2D(SamplerColor,coord+float2(1,-1)*bof).rgb; + lums[0][2] = luminance(col); + col = tex2D(SamplerColor,coord+float2(-1,0)*bof).rgb; + lums[1][0] = luminance(col); + col = tex2D(SamplerColor,coord+float2(0,0)*bof).rgb; + lums[1][1] = luminance(col); + col = tex2D(SamplerColor,coord+float2(1,0)*bof).rgb; + lums[1][2] = luminance(col); + col = tex2D(SamplerColor,coord+float2(-1,1)*bof).rgb; + lums[2][0] = luminance(col); + col = tex2D(SamplerColor,coord+float2(0,1)*bof).rgb; + lums[2][1] = luminance(col); + col = tex2D(SamplerColor,coord+float2(1,1)*bof).rgb; + lums[2][2] = luminance(col); + mdx += GX[0][0]*lums[0][0]; + mdx += GX[0][1]*lums[0][1]; + mdx += GX[0][2]*lums[0][2]; + mdx += GX[1][0]*lums[1][0]; + mdx += GX[1][1]*lums[1][1]; + mdx += GX[1][2]*lums[1][2]; + mdx += GX[2][0]*lums[2][0]; + mdx += GX[2][1]*lums[2][1]; + mdx += GX[2][2]*lums[2][2]; + mdy += GY[0][0]*lums[0][0]; + mdy += GY[0][1]*lums[0][1]; + mdy += GY[0][2]*lums[0][2]; + mdy += GY[1][0]*lums[1][0]; + mdy += GY[1][1]*lums[1][1]; + mdy += GY[1][2]*lums[1][2]; + mdy += GY[2][0]*lums[2][0]; + mdy += GY[2][1]*lums[2][1]; + mdy += GY[2][2]*lums[2][2]; + mud = pow(max(mdx*mdx+mdy*mdy,0.0),0.5); + mud = clamp(pow(max(mud,0.0),compow)*commult,0.0,1.0); + if ( comblend ) return res-(cominv?1.0-mud:mud); + return cominv?1.0-mud:mud; +} +/* linevision filter */ +float3 LineView( float3 res, float2 coord ) +{ + float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); + if ( fixedx>0 ) bresl.x = fixedx; + if ( fixedy>0 ) bresl.y = fixedy; + float contfadepow = tod_ind(contfadepow); + float contfademult = tod_ind(contfademult); + float2 bof = float2(1.0/bresl.x,1.0/bresl.y)*contradius; + float dep = depthlinear(coord); + float cont = depthlinear(coord+float2(-1,-1)*bof); + cont += depthlinear(coord+float2(0,-1)*bof); + cont += depthlinear(coord+float2(1,-1)*bof); + cont += depthlinear(coord+float2(-1,0)*bof); + cont += depthlinear(coord+float2(1,0)*bof); + cont += depthlinear(coord+float2(-1,1)*bof); + cont += depthlinear(coord+float2(0,1)*bof); + cont += depthlinear(coord+float2(1,1)*bof); + cont /= 8.0; + float mud = 0.0; + if ( abs(cont-dep) > (contthreshold*0.00001) ) mud = 1.0; + float fade = 1.0-tex2D(SamplerDepth,coord).x; + mud *= clamp(pow(max(0.0,fade),contfadepow)*contfademult,0.0,1.0); + mud = clamp(pow(max(0.0,mud),contpow)*contmult,0.0,1.0); + if ( contblend ) return res-(continv?1.0-mud:mud); + return continv?1.0-mud:mud; +} +/* fog filter */ +float3 Limbo( float3 res, float2 coord ) +{ + float mud = clamp(pow(max(0.0,depthlinear(coord)),fogpow)*fogmult + +fogbump,0.0,1.0); + if ( foglimbo ) return fogcolor*mud; + return lerp(res,fogcolor,mud); } /* Thank you Boris for not providing access to a normal buffer. Guesswork using @@ -176,15 +262,23 @@ float3 pseudonormal( float dep, float2 coord ) normal.z = -normal.z; return normalize(normal); } -/* Squeezed in are Depth Grading, Edgevision, Sharpen and ssao prepass */ -float4 PS_EdgePlusSSAOPrepass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR +float4 PS_MiscPrepass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR { float2 coord = IN.txcoord.xy; float4 res = tex2D(SamplerColor,coord); if ( sharpenable ) res.rgb = Sharpen(res.rgb,coord); res.rgb = DepthGrade(res.rgb,coord); if ( edgevenable ) res.rgb = EdgeView(res.rgb,coord); - /* get occlusion using single-step Ray Marching with 64 samples */ + if ( comenable ) res.rgb = EdgeDetect(res.rgb,coord); + if ( contenable ) res.rgb = LineView(res.rgb,coord); + if ( fogenable ) res.rgb = Limbo(res.rgb,coord); + return res; +} +/* this SSAO algorithm is honestly a big mess */ +float4 PS_SSAOPrepass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR +{ + float2 coord = IN.txcoord.xy; + float4 res = tex2D(SamplerColor,coord); float ssaofadepow = tod_ind(ssaofadepow); float ssaofademult = tod_ind(ssaofademult); if ( !ssaoenable ) return res; @@ -210,7 +304,7 @@ float4 PS_EdgePlusSSAOPrepass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR float sdepth, so, delta; float sclamp = ssaoclamp/100000.0; float sclampmin = ssaoclampmin/100000.0; - [unroll] for ( i=0; i<16; i++ ) + [loop] for ( i=0; i<64; i++ ) { sample = reflect(ssao_samples[i],rnormal); sample *= sign(dot(normal,sample)); @@ -221,10 +315,10 @@ float4 PS_EdgePlusSSAOPrepass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR if ( (delta > sclampmin) && (delta < sclamp) ) occ += 1.0-delta; } - float uocc = saturate(occ/16.0); + float uocc = saturate(occ/64.0); float fade = 1.0-depth; uocc *= saturate(pow(max(0,fade),ssaofadepow)*ssaofademult); - uocc = saturate(pow(max(0,uocc),ssaopow)*ssaomult); + uocc = saturate(pow(max(0,uocc),ssaopow)*ssaomult+ssaobump); res.a = saturate(1.0-(uocc*ssaoblend)); return res; } @@ -275,35 +369,14 @@ float4 PS_Distortion( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR return res; } /* - The blur passes use bilateral filtering to mostly preserve borders. + The blur pass uses bilateral filtering to mostly preserve borders. An additional factor using difference of normals was tested, but the performance decrease was too much, so it's gone forever. + + This has been reverted into a single pass since separable blur seems to + cause some ugly artifacting. */ -float4 PS_SSAOBlurH( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR -{ - float2 coord = IN.txcoord.xy; - float4 res = tex2D(SamplerColor,coord); - if ( !ssaoenable ) return res; - if ( !ssaobenable ) return res; - float bresl = ScreenSize.x; - float bof = (1.0/bresl)*ssaobradius; - float isd, sd, ds, sw, tw = 0; - res.a = 0.0; - int i; - isd = tex2D(SamplerDepth,coord).x; - [unroll] for ( i=-15; i<=15; i++ ) - { - sd = tex2D(SamplerDepth,coord+float2(i,0)*bof).x; - ds = 1.0/pow(1.0+abs(isd-sd),ssaobfact); - sw = ds; - sw *= gauss16[abs(i)]; - tw += sw; - res.a += sw*tex2D(SamplerColor,coord+float2(i,0)*bof).a; - } - res.a /= tw; - return res; -} -float4 PS_SSAOBlurV( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR +float4 PS_SSAOBlur( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR { float2 coord = IN.txcoord.xy; float4 res = tex2D(SamplerColor,coord); @@ -313,20 +386,20 @@ float4 PS_SSAOBlurV( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR if ( ssaodebug ) return saturate(res.a); return res*res.a; } - float bresl = ScreenSize.x*ScreenSize.w; - float bof = (1.0/bresl)*ssaobradius; + float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); + float2 bof = (1.0/bresl)*ssaobradius; float isd, sd, ds, sw, tw = 0; res.a = 0.0; - int i; + int i, j; isd = tex2D(SamplerDepth,coord).x; - [unroll] for ( i=-15; i<=15; i++ ) + [loop] for ( j=-7; j<=7; j++ ) [loop] for ( i=-7; i<=7; i++ ) { - sd = tex2D(SamplerDepth,coord+float2(0,i)*bof).x; + sd = tex2D(SamplerDepth,coord+float2(i,j)*bof).x; ds = 1.0/pow(1.0+abs(isd-sd),ssaobfact); sw = ds; - sw *= gauss16[abs(i)]; + sw *= gauss8[abs(i)]*gauss8[abs(j)]; tw += sw; - res.a += sw*tex2D(SamplerColor,coord+float2(0,i)*bof).a; + res.a += sw*tex2D(SamplerColor,coord+float2(i,j)*bof).a; } res.a /= tw; if ( ssaodebug ) return saturate(res.a); @@ -640,7 +713,7 @@ technique PostProcess pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_EdgePlusSSAOPrepass(); + PixelShader = compile ps_3_0 PS_MiscPrepass(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -657,7 +730,7 @@ technique PostProcess2 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_Distortion(); + PixelShader = compile ps_3_0 PS_SSAOPrepass(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -674,7 +747,7 @@ technique PostProcess3 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_SSAOBlurH(); + PixelShader = compile ps_3_0 PS_Distortion(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -691,7 +764,7 @@ technique PostProcess4 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_SSAOBlurV(); + PixelShader = compile ps_3_0 PS_SSAOBlur(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -777,7 +850,7 @@ technique PostProcessB pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_EdgePlusSSAOPrepass(); + PixelShader = compile ps_3_0 PS_MiscPrepass(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -794,7 +867,7 @@ technique PostProcessB2 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_Distortion(); + PixelShader = compile ps_3_0 PS_SSAOPrepass(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -811,7 +884,7 @@ technique PostProcessB3 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_SSAOBlurH(); + PixelShader = compile ps_3_0 PS_Distortion(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -828,7 +901,7 @@ technique PostProcessB4 pass p0 { VertexShader = compile vs_3_0 VS_Pass(); - PixelShader = compile ps_3_0 PS_SSAOBlurV(); + PixelShader = compile ps_3_0 PS_SSAOBlur(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; diff --git a/enbseries/menbprepassinternals.fx b/enbseries/menbprepassinternals.fx index e60e0bf..66958ca 100644 --- a/enbseries/menbprepassinternals.fx +++ b/enbseries/menbprepassinternals.fx @@ -19,31 +19,47 @@ static const float3x3 GY = 0, 0, 0, -1,-2,-1 }; -/* radius: 8, std dev: 6 */ +/* radius: 8, std dev: 3 */ static const float gauss8[8] = { - 0.084247, 0.083085, 0.079694, 0.074348, - 0.067460, 0.059533, 0.051099, 0.042657 -}; -/* radius: 16, std dev: 13 */ -static const float gauss16[16] = -{ - 0.040012, 0.039893, 0.039541, 0.038960, - 0.038162, 0.037159, 0.035969, 0.034612, - 0.033109, 0.031485, 0.029764, 0.027971, - 0.026131, 0.024268, 0.022405, 0.020563 + 0.134598, 0.127325, 0.107778, 0.081638, + 0.055335, 0.033562, 0.018216, 0.008847 }; /* SSAO samples */ -static const float3 ssao_samples[16] = +static const float3 ssao_samples[64] = { - float3( 0.0000,-0.0002, 0.0000),float3(-0.0004, 0.0013, 0.0014), - float3(-0.0030, 0.0048,-0.0034),float3( 0.0147, 0.0046,-0.0026), - float3(-0.0097, 0.0275,-0.0092),float3(-0.0178,-0.0072, 0.0491), - float3( 0.0227,-0.0431,-0.0681),float3( 0.1052, 0.0332,-0.0588), - float3( 0.0997, 0.0056, 0.1473),float3(-0.1252, 0.2019, 0.0564), - float3(-0.1054,-0.2072, 0.2271),float3(-0.0542, 0.3096, 0.2814), - float3( 0.0072,-0.3534, 0.4035),float3(-0.0024,-0.2385, 0.6260), - float3(-0.1940, 0.5722,-0.5602),float3(-0.0910,-0.7548,-0.6497) + float3(-0.0051, 0.0021, 0.0146),float3(-0.0197,-0.0213,-0.0116), + float3( 0.0005,-0.0432,-0.0182),float3(-0.0011,-0.0586,-0.0217), + float3(-0.0549, 0.0461, 0.0309),float3(-0.0448,-0.0764,-0.0306), + float3(-0.0366, 0.0758,-0.0699),float3(-0.0770,-0.0707,-0.0686), + float3( 0.1181,-0.0340,-0.0683),float3(-0.0647, 0.0356, 0.1377), + float3(-0.1167, 0.1262, 0.0024),float3(-0.1353,-0.0861, 0.0971), + float3(-0.0096, 0.0936, 0.1800),float3( 0.1311,-0.1013,-0.1429), + float3(-0.1186,-0.0653, 0.1913),float3( 0.1641, 0.0260, 0.1868), + float3(-0.1225,-0.2319, 0.0424),float3( 0.1036,-0.2000, 0.1684), + float3( 0.1656, 0.2022,-0.1408),float3(-0.1809,-0.1673, 0.1922), + float3(-0.2485,-0.1236, 0.1750),float3( 0.1030,-0.0550, 0.3233), + float3(-0.0405, 0.3068, 0.1827),float3(-0.0576, 0.1632, 0.3327), + float3( 0.0392, 0.3583,-0.1505),float3( 0.0082, 0.2865, 0.2879), + float3( 0.0055,-0.2835, 0.3124),float3(-0.2733, 0.1991,-0.2776), + float3( 0.2667, 0.1127,-0.3486),float3(-0.3326, 0.2740,-0.1844), + float3( 0.2887,-0.3838, 0.0630),float3( 0.1088, 0.1546, 0.4629), + float3( 0.0977,-0.3565, 0.3595),float3(-0.4204, 0.0855, 0.3133), + float3(-0.2237,-0.4932, 0.0759),float3( 0.4245, 0.3169,-0.1891), + float3( 0.0084,-0.5682, 0.1062),float3(-0.1489,-0.5296,-0.2235), + float3( 0.0014,-0.4153,-0.4460),float3( 0.0300,-0.4392, 0.4437), + float3( 0.2627, 0.4518, 0.3704),float3(-0.4945, 0.3659, 0.2285), + float3(-0.2550,-0.5311, 0.3230),float3(-0.4477, 0.0828,-0.5151), + float3( 0.4682, 0.4531,-0.2644),float3(-0.1235,-0.0366, 0.7071), + float3( 0.3545, 0.4559, 0.4536),float3(-0.1037,-0.2199,-0.7095), + float3( 0.4269, 0.5299,-0.3510),float3( 0.7051,-0.1468,-0.3027), + float3( 0.4590,-0.5669,-0.3208),float3( 0.2330, 0.1264, 0.7680), + float3(-0.3954, 0.5619,-0.4622),float3( 0.5977,-0.5110, 0.3059), + float3(-0.5800,-0.6306, 0.0672),float3(-0.2211,-0.0332,-0.8460), + float3(-0.3808,-0.2238,-0.7734),float3(-0.5616, 0.6858,-0.1887), + float3(-0.2995, 0.5165,-0.7024),float3( 0.5042,-0.0537, 0.7885), + float3(-0.6477,-0.3691, 0.5938),float3(-0.3969, 0.8815, 0.0620), + float3(-0.4300,-0.8814,-0.0852),float3(-0.1683, 0.9379, 0.3033) }; /* For high quality DOF */ static const float2 poisson32[32] = @@ -76,7 +92,7 @@ texture2D texColor; texture2D texDepth; texture2D texNoise3 < - string ResourceName = "menbnoise2.png"; + string ResourceName = "menbnoise3.png"; >; texture2D texHeat < diff --git a/enbseries/menbprepasssettings.fx b/enbseries/menbprepasssettings.fx index 67939de..fa9c9ad 100644 --- a/enbseries/menbprepasssettings.fx +++ b/enbseries/menbprepasssettings.fx @@ -600,6 +600,163 @@ float edgevradius string UIWidget = "Spinner"; float UIMin = 0.0; > = {1.0}; +bool edgevinv +< + string UIName = "Invert Edgevision"; + string UIWidget = "Checkbox"; +> = {false}; +bool edgevblend +< + string UIName = "Blend Edgevision"; + string UIWidget = "Checkbox"; +> = {false}; +/* use luma edge detection filter */ +string str_com = "Edge Detect"; +bool comenable +< + string UIName = "Enable Edge Detect"; + string UIWidget = "Checkbox"; +> = {false}; +float compow +< + string UIName = "Edge Detect Contrast"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {1.0}; +float commult +< + string UIName = "Edge Detect Intensity"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {1.0}; +float comradius +< + string UIName = "Edge Detect Radius"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {1.0}; +bool cominv +< + string UIName = "Invert Edge Detect"; + string UIWidget = "Checkbox"; +> = {false}; +bool comblend +< + string UIName = "Blend Edge Detect"; + string UIWidget = "Checkbox"; +> = {false}; +/* use edge threshold filter aka "linevision" */ +string str_cont = "Linevision"; +bool contenable +< + string UIName = "Enable Linevision"; + string UIWidget = "Checkbox"; +> = {false}; +/* factors */ +float contfadepow_n +< + string UIName = "Linevision Fade Contrast Night"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {2.0}; +float contfadepow_d +< + string UIName = "Linevision Fade Contrast Day"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {2.0}; +float contfadepow_i +< + string UIName = "Linevision Fade Contrast Interior"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {2.0}; +float contfademult_n +< + string UIName = "Linevision Fade Intensity Night"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {500.0}; +float contfademult_d +< + string UIName = "Linevision Fade Intensity Day"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {500.0}; +float contfademult_i +< + string UIName = "Linevision Fade Intensity Interior"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {500.0}; +float contpow +< + string UIName = "Linevision Contrast"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {1.0}; +float contmult +< + string UIName = "Linevision Intensity"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {2.0}; +float contradius +< + string UIName = "Linevision Radius"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {1.0}; +float contthreshold +< + string UIName = "Linevision Threshold"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {0.05}; +bool continv +< + string UIName = "Invert Linevision"; + string UIWidget = "Checkbox"; +> = {false}; +bool contblend +< + string UIName = "Blend Linevision"; + string UIWidget = "Checkbox"; +> = {false}; +/* fog filter */ +string str_fog = "Custom Fog Filter"; +bool fogenable +< + string UIName = "Enable Custom Fog"; + string UIWidget = "Checkbox"; +> = {false}; +float fogpow +< + string UIName = "Fog Contrast"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {1.0}; +float fogmult +< + string UIName = "Fog Intensity"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {1.0}; +float fogbump +< + string UIName = "Fog Shift"; + string UIWidget = "Spinner"; +> = {0.0}; +float3 fogcolor +< + string UIName = "Fog Color"; + string UIWidget = "Spinner"; +> = {1.0,1.0,1.0}; +bool foglimbo +< + string UIName = "Limbo Mode"; + string UIWidget = "Checkbox"; +> = {false}; /* ssao filter */ string str_ssao = "Ray Marching SSAO"; bool ssaoenable @@ -667,6 +824,11 @@ float ssaopow string UIWidget = "Spinner"; float UIMin = 0.0; > = {1.5}; +float ssaobump +< + string UIName = "SSAO Shift"; + string UIWidget = "Spinner"; +> = {0.0}; float ssaoblend < string UIName = "SSAO Blending"; diff --git a/enbseries/menbvgalut.png b/enbseries/menbvgalut.png deleted file mode 100644 index 1addbb4..0000000 Binary files a/enbseries/menbvgalut.png and /dev/null differ