diff --git a/enbseries.ini b/enbseries.ini index 0205ebf..ee7ff91 100644 --- a/enbseries.ini +++ b/enbseries.ini @@ -546,22 +546,22 @@ MoonDesaturationInteriorDay=0.35 MoonDesaturationInteriorNight=0.14 [OBJECT] IgnoreWeatherSystem=true -SubSurfaceScatteringMultiplierDawn=0.0 -SubSurfaceScatteringMultiplierSunrise=0.0 -SubSurfaceScatteringMultiplierDay=0.0 -SubSurfaceScatteringMultiplierSunset=0.0 -SubSurfaceScatteringMultiplierDusk=0.0 -SubSurfaceScatteringMultiplierNight=0.0 -SubSurfaceScatteringMultiplierInteriorDay=0.0 -SubSurfaceScatteringMultiplierInteriorNight=0.0 -SubSurfaceScatteringPowerDawn=1.0 -SubSurfaceScatteringPowerSunrise=1.0 -SubSurfaceScatteringPowerDay=1.0 -SubSurfaceScatteringPowerSunset=1.0 -SubSurfaceScatteringPowerDusk=1.0 -SubSurfaceScatteringPowerNight=1.0 -SubSurfaceScatteringPowerInteriorDay=1.0 -SubSurfaceScatteringPowerInteriorNight=1.0 +SubSurfaceScatteringMultiplierDawn=0.86 +SubSurfaceScatteringMultiplierSunrise=0.81 +SubSurfaceScatteringMultiplierDay=0.76 +SubSurfaceScatteringMultiplierSunset=0.82 +SubSurfaceScatteringMultiplierDusk=0.87 +SubSurfaceScatteringMultiplierNight=0.91 +SubSurfaceScatteringMultiplierInteriorDay=0.78 +SubSurfaceScatteringMultiplierInteriorNight=0.93 +SubSurfaceScatteringPowerDawn=1.71 +SubSurfaceScatteringPowerSunrise=1.61 +SubSurfaceScatteringPowerDay=1.55 +SubSurfaceScatteringPowerSunset=1.62 +SubSurfaceScatteringPowerDusk=1.75 +SubSurfaceScatteringPowerNight=1.85 +SubSurfaceScatteringPowerInteriorDay=1.47 +SubSurfaceScatteringPowerInteriorNight=1.92 SpecularAmountMultiplierDawn=1.32 SpecularAmountMultiplierSunrise=1.18 SpecularAmountMultiplierDay=1.08 @@ -575,7 +575,7 @@ SpecularPowerMultiplierSunrise=1.15 SpecularPowerMultiplierDay=1.12 SpecularPowerMultiplierSunset=1.19 SpecularPowerMultiplierDusk=1.25 -SpecularPowerMultiplierNight=1.43 +SpecularPowerMultiplierNight=1.44 SpecularPowerMultiplierInteriorDay=1.18 SpecularPowerMultiplierInteriorNight=1.52 [VEGETATION] @@ -614,22 +614,22 @@ SpecularPowerMultiplierInteriorDay=1.18 SpecularPowerMultiplierInteriorNight=0.84 [EYES] IgnoreWeatherSystem=true -SubSurfaceScatteringMultiplierDawn=0.0 -SubSurfaceScatteringMultiplierSunrise=0.0 -SubSurfaceScatteringMultiplierDay=0.0 -SubSurfaceScatteringMultiplierSunset=0.0 -SubSurfaceScatteringMultiplierDusk=0.0 -SubSurfaceScatteringMultiplierNight=0.0 -SubSurfaceScatteringMultiplierInteriorDay=0.0 -SubSurfaceScatteringMultiplierInteriorNight=0.0 -SubSurfaceScatteringPowerDawn=1.0 -SubSurfaceScatteringPowerSunrise=1.0 -SubSurfaceScatteringPowerDay=1.0 -SubSurfaceScatteringPowerSunset=1.0 -SubSurfaceScatteringPowerDusk=1.0 -SubSurfaceScatteringPowerNight=1.0 -SubSurfaceScatteringPowerInteriorDay=1.0 -SubSurfaceScatteringPowerInteriorNight=1.0 +SubSurfaceScatteringMultiplierDawn=1.74 +SubSurfaceScatteringMultiplierSunrise=1.55 +SubSurfaceScatteringMultiplierDay=1.31 +SubSurfaceScatteringMultiplierSunset=1.56 +SubSurfaceScatteringMultiplierDusk=1.75 +SubSurfaceScatteringMultiplierNight=1.88 +SubSurfaceScatteringMultiplierInteriorDay=1.27 +SubSurfaceScatteringMultiplierInteriorNight=1.92 +SubSurfaceScatteringPowerDawn=1.29 +SubSurfaceScatteringPowerSunrise=1.17 +SubSurfaceScatteringPowerDay=1.11 +SubSurfaceScatteringPowerSunset=1.18 +SubSurfaceScatteringPowerDusk=1.26 +SubSurfaceScatteringPowerNight=1.38 +SubSurfaceScatteringPowerInteriorDay=1.12 +SubSurfaceScatteringPowerInteriorNight=1.41 SpecularAmountMultiplierDawn=1.49 SpecularAmountMultiplierSunrise=1.39 SpecularAmountMultiplierDay=1.32 @@ -832,15 +832,15 @@ MotionTransparency=0.6 IgnoreWeatherSystem=true Quality=1 Radius=7.64 -Amount=0.36 -EpidermalAmount=0.73 -SubdermalAmount=1.55 -EpidermalDiffuseSaturation=0.64 -SubdermalDiffuseSaturation=0.74 -EpidermalMix=0.18 -SubdermalMix=0.56 -SubdermalTranslucency=0.73 -SubdermalPhase=0.53 +Amount=0.69 +EpidermalAmount=1.47 +SubdermalAmount=1.86 +EpidermalDiffuseSaturation=-0.18 +SubdermalDiffuseSaturation=0.21 +EpidermalMix=0.66 +SubdermalMix=0.51 +SubdermalTranslucency=0.75 +SubdermalPhase=0.71 EnableTextureAlpha=true [WATER] IgnoreWeatherSystem=true diff --git a/enbseries/VERSION b/enbseries/VERSION index 255288a..53304ac 100644 --- a/enbseries/VERSION +++ b/enbseries/VERSION @@ -1 +1 @@ -2.5.1sk "Alone In The Prepass" +2.6.0sk "Suddenly Volumes" diff --git a/enbseries/effect.txt.ini b/enbseries/effect.txt.ini index 824bac0..566dcb9 100644 --- a/enbseries/effect.txt.ini +++ b/enbseries/effect.txt.ini @@ -45,3 +45,26 @@ Border Blur Contrast=2.25 Border Blur Intensity=1.52 Border Blur Shift=0.0 Border Blur Radius=1.0 +Enable Oil=false +Oil Radius=1.0 +Oil Smoothing Radius=1.0 +Enable ASCII=false +ASCII Monochrome=true +ASCII Blend=0.0 +Enable Dot Matrix=false +Dot Size=1 +Dot Blend=0.4 +Dot Intensity=2.41 +Dot Contrast=1.25 +Enable Curvature=false +Curve Chromatic Aberration=0.62 +Curve Zooming=50.34 +Curve Distortion=0.0 +Selected Filter=1 +Van Gogh Sky=false +Van Gogh Animation Speed=0.0 +Enable Oil Filter=false +Enable FXAA=false +FXAA Span Max=4.0 +FXAA Reduce Mul=16.0 +FXAA Reduce Min=128.0 diff --git a/enbseries/enbeffect.fx.ini b/enbseries/enbeffect.fx.ini index b151ebb..f7da364 100644 --- a/enbseries/enbeffect.fx.ini +++ b/enbseries/enbeffect.fx.ini @@ -2,13 +2,13 @@ TECHNIQUE=0 Fixed Resolution Width=1920 Fixed Resolution Height=1080 -Distortion Chromatic Aberration=41.52 +Distortion Chromatic Aberration=15.980001 Enable Screen Frost=true Frost Contrast=1.22 Frost Strength=0.19 Frost Radial Contrast=1.17 Frost Radial Intensity=0.87 -Frost Radial Offset=-0.71 +Frost Radial Offset=-0.96 Frost Texture Blend=1.51 Frost Texture Blend Contrast=6.51 Frost Texture Size=0.8 @@ -194,3 +194,9 @@ Technicolor Blend=0.6 Enable Post Dither=true Dither Pattern=2 Display Bloom=false +Enable Dirt=false +Dirt Factor=0.35 +Dirt Coord Factor=0.34 +Dirt Luminance Factor=-0.37 +Dirt Coord Zoom=3.38 +Dirt Luminance Zoom=1.19 diff --git a/enbseries/enbeffectprepass.fx.ini b/enbseries/enbeffectprepass.fx.ini index 5ea4dec..ea3a1f6 100644 --- a/enbseries/enbeffectprepass.fx.ini +++ b/enbseries/enbeffectprepass.fx.ini @@ -14,9 +14,9 @@ Heat Fade Intensity=1.09 Heat Fade Offset=-0.78 Heat Intensity=0.18 Heat Contrast=1.0 -Heat Factor Night=0.0 +Heat Factor Night=-0.58 Heat Factor Day=1.15 -Heat Factor Interior Night=0.0 +Heat Factor Interior Night=-0.47 Heat Factor Interior Day=0.52 Heat Always Enable=false Enable Edgevision=false @@ -24,24 +24,24 @@ Edgevision Fade Contrast Night=1.82 Edgevision Fade Contrast Day=1.86 Edgevision Fade Contrast Interior Night=2.9 Edgevision Fade Contrast Interior Day=3.0 -Edgevision Fade Intensity Night=700.0 -Edgevision Fade Intensity Day=800.0 -Edgevision Fade Intensity Interior Night=500.0 -Edgevision Fade Intensity Interior Day=600.0 +Edgevision Fade Intensity Night=692.630005 +Edgevision Fade Intensity Day=793.580017 +Edgevision Fade Intensity Interior Night=484.679993 +Edgevision Fade Intensity Interior Day=590.840027 Edgevision Contrast=0.25 Edgevision Intensity=8.0 Edgevision Radius=1.0 Enable SSAO=false SSAO Radius=0.05 SSAO Noise=0 -SSAO Fade Contrast Night=0.46 -SSAO Fade Contrast Day=0.41 -SSAO Fade Contrast Interior Night=0.58 -SSAO Fade Contrast Interior Day=0.53 -SSAO Fade Intensity Night=1.27 -SSAO Fade Intensity Day=1.08 -SSAO Fade Intensity Interior Night=1.3 -SSAO Fade Intensity Interior Day=1.05 +SSAO Fade Contrast Night=0.97 +SSAO Fade Contrast Day=0.93 +SSAO Fade Contrast Interior Night=0.98 +SSAO Fade Contrast Interior Day=0.94 +SSAO Fade Intensity Night=631.659973 +SSAO Fade Intensity Day=716.929993 +SSAO Fade Intensity Interior Night=481.650024 +SSAO Fade Intensity Interior Day=573.030029 SSAO Intensity=1.25 SSAO Contrast=0.65 SSAO Blending=0.8 @@ -132,3 +132,56 @@ Grading Value Contrast Day=0.78 Grading Value Contrast Interior Night=0.58 Grading Value Contrast Interior Day=0.64 Colorize After HSV=true +Invert Edgevision=false +Enable Edge Detect=false +Edge Detect Contrast=0.85 +Edge Detect Intensity=0.25 +Edge Detect Radius=1.0 +Invert Edge Detect=false +Enable Linevision=false +Linevision Fade Contrast Night=1.24 +Linevision Fade Contrast Day=1.12 +Linevision Fade Contrast Interior Night=1.41 +Linevision Fade Contrast Interior Day=1.33 +Linevision Fade Intensity Night=692.630005 +Linevision Fade Intensity Day=793.580017 +Linevision Fade Intensity Interior Night=484.679993 +Linevision Fade Intensity Interior Day=590.840027 +Linevision Contrast=1.0 +Linevision Intensity=1.0 +Linevision Radius=1.0 +Linevision Threshold=0.1 +Invert Linevision=false +Enable Spooky Fog=false +Limbo Contrast=0.65 +Limbo Intensity=10.0 +Enable Cardboard=false +Cardboard Fade Contrast Night=1.82 +Cardboard Fade Contrast Day=1.86 +Cardboard Fade Contrast Interior Night=2.9 +Cardboard Fade Contrast Interior Day=3.0 +Cardboard Fade Intensity Night=700.0 +Cardboard Fade Intensity Day=800.0 +Cardboard Fade Intensity Interior Night=500.0 +Cardboard Fade Intensity Interior Day=600.0 +Cardboard Contrast=1.0 +Cardboard Intensity=1.0 +Invert Cardboard=false +Blend Edgevision=false +Blend Edge Detect=false +Blend Linevision=false +Limbo ColorX=1.0 +Limbo ColorY=1.0 +Limbo ColorZ=1.0 +Blend Limbo=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 +SSAO Shift=-0.25 +Debug Mask Texture=-1 +Debug Test=-1 diff --git a/enbseries/menbdepthoffieldinternals.fx b/enbseries/menbdepthoffieldinternals.fx index 45b54f2..e65a101 100644 --- a/enbseries/menbdepthoffieldinternals.fx +++ b/enbseries/menbdepthoffieldinternals.fx @@ -39,7 +39,7 @@ texture2D texColor; texture2D texDepth; texture2D texNoise3 < - string ResourceName = "menbnoise2.png"; + string ResourceName = "menbnoise3.png"; >; texture2D texFocus; texture2D texCurr; diff --git a/enbseries/menbdots.png b/enbseries/menbdots.png new file mode 100644 index 0000000..2027ba1 Binary files /dev/null and b/enbseries/menbdots.png differ diff --git a/enbseries/menbeffectfilters.fx b/enbseries/menbeffectfilters.fx index cfa1bbe..9ffc7c1 100644 --- a/enbseries/menbeffectfilters.fx +++ b/enbseries/menbeffectfilters.fx @@ -331,12 +331,18 @@ float3 GradingGame( float3 res ) /* LUT colour grading */ float3 GradingLUT( float3 res ) { +#ifdef VOLUME_LUTS /* - 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 */ + float3 tcl_n = tex3D(SamplerLUTN,res).rgb; + float3 tcl_d = tex3D(SamplerLUTD,res).rgb; + float3 tcl_in = tex3D(SamplerLUTIN,res).rgb; + float3 tcl_id = tex3D(SamplerLUTID,res).rgb; + float3 tcol = tod_ind(tcl); +#else #ifdef LUTMODE_LEGACY float3 tcol = clamp(res,0.08,0.92); tcol.rg = tcol.rg*0.5+0.25; @@ -386,6 +392,7 @@ float3 GradingLUT( float3 res ) float3 tcl1 = tod_ind(tcl1); float3 tcl2 = tod_ind(tcl2); tcol = lerp(tcl1,tcl2,dec); +#endif float lutblend = tod_ind(lutblend); return lerp(res,tcol,lutblend); } @@ -479,6 +486,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 { @@ -529,6 +549,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 ac10f82..c97d19a 100644 --- a/enbseries/menbeffectinternals.fx +++ b/enbseries/menbeffectinternals.fx @@ -48,14 +48,56 @@ texture2D texs2; texture2D texs3; texture2D texs4; texture2D texs7; -texture2D texNoise2 +texture2D texNoise1 < string ResourceName = "menbnoise1.png"; >; -texture2D texNoise3 +texture2D texNoise2 < string ResourceName = "menbnoise2.png"; >; +texture2D texNoise3 +< + string ResourceName = "menbnoise3.png"; +>; +#ifdef VOLUME_LUTS +texture3D texLUTN +< +#ifdef LUTMODE_16 + string ResourceName = "menblut16v_night.dds"; +#endif +#ifdef LUTMODE_64 + string ResourceName = "menblut64v_night.dds"; +#endif +>; +texture3D texLUTD +< +#ifdef LUTMODE_16 + string ResourceName = "menblut16v_day.dds"; +#endif +#ifdef LUTMODE_64 + string ResourceName = "menblut64v_day.dds"; +#endif +>; +texture3D texLUTIN +< +#ifdef LUTMODE_16 + string ResourceName = "menblut16v_interiornight.dds"; +#endif +#ifdef LUTMODE_64 + string ResourceName = "menblut64v_interiornight.dds"; +#endif +>; +texture3D texLUTID +< +#ifdef LUTMODE_16 + string ResourceName = "menblut16v_interiorday.dds"; +#endif +#ifdef LUTMODE_64 + string ResourceName = "menblut64v_interiorday.dds"; +#endif +>; +#else #ifdef LUTMODE_LEGACY texture2D texLUT < @@ -99,6 +141,7 @@ texture2D texLUTID #endif >; #endif +#endif texture2D texTonemap < string ResourceName = "menbfilmlut.png"; @@ -183,6 +226,18 @@ sampler2D _s7 = sampler_state MaxMipLevel = 0; MipMapLodBias = 0; }; +sampler2D SamplerNoise1 = sampler_state +{ + Texture = ; + MinFilter = POINT; + MagFilter = POINT; + MipFilter = NONE; + AddressU = Wrap; + AddressV = Wrap; + SRGBTexture = FALSE; + MaxMipLevel = 0; + MipMapLodBias = 0; +}; sampler2D SamplerNoise2 = sampler_state { Texture = ; @@ -207,6 +262,60 @@ sampler2D SamplerNoise3 = sampler_state MaxMipLevel = 0; MipMapLodBias = 0; }; +#ifdef VOLUME_LUTS +sampler3D SamplerLUTN = sampler_state +{ + Texture = ; + MinFilter = LINEAR; + MagFilter = LINEAR; + MipFilter = NONE; + AddressU = Clamp; + AddressV = Clamp; + AddressW = Clamp; + SRGBTexture = FALSE; + MaxMipLevel = 0; + MipMapLodBias = 0; +}; +sampler3D SamplerLUTD = sampler_state +{ + Texture = ; + MinFilter = LINEAR; + MagFilter = LINEAR; + MipFilter = NONE; + AddressU = Clamp; + AddressV = Clamp; + AddressW = Clamp; + SRGBTexture = FALSE; + MaxMipLevel = 0; + MipMapLodBias = 0; +}; +sampler3D SamplerLUTIN = sampler_state +{ + Texture = ; + MinFilter = LINEAR; + MagFilter = LINEAR; + MipFilter = NONE; + AddressU = Clamp; + AddressV = Clamp; + AddressW = Clamp; + SRGBTexture = FALSE; + MaxMipLevel = 0; + MipMapLodBias = 0; +}; +sampler3D SamplerLUTID = sampler_state +{ + Texture = ; + MinFilter = LINEAR; + MagFilter = LINEAR; + MipFilter = NONE; + AddressU = Clamp; + AddressV = Clamp; + AddressW = Clamp; + SRGBTexture = FALSE; + MaxMipLevel = 0; + MipMapLodBias = 0; +}; +#else #ifdef LUTMODE_LEGACY sampler2D SamplerLUT = sampler_state { @@ -270,6 +379,7 @@ sampler2D SamplerLUTID = sampler_state MipMapLodBias = 0; }; #endif +#endif sampler2D SamplerTonemap = sampler_state { Texture = ; diff --git a/enbseries/menbeffectsettings.fx b/enbseries/menbeffectsettings.fx index 8e69516..8f1d7a2 100644 --- a/enbseries/menbeffectsettings.fx +++ b/enbseries/menbeffectsettings.fx @@ -217,6 +217,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 diff --git a/enbseries/menbextrafilters.fx b/enbseries/menbextrafilters.fx index 190acbe..a8cad61 100644 --- a/enbseries/menbextrafilters.fx +++ b/enbseries/menbextrafilters.fx @@ -34,7 +34,7 @@ float3 hsv2rgb( float3 c ) /* prepass */ float4 ReducePrepass( in float4 col, in float2 coord ) { - float3 hsv = rgb2hsv(col); + float3 hsv = rgb2hsv(col.rgb); hsv.y = clamp(hsv.y*bsaturation,0.0,1.0); hsv.z = pow(max(0,hsv.z),bgamma); col.rgb = hsv2rgb(saturate(hsv)); @@ -133,6 +133,40 @@ float4 PS_Retro( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR res.a = 1.0; return res; } +/* ASCII art (more like CP437 art) */ +float4 PS_ASCII( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR +{ + float2 coord = IN.txcoord.xy; + float4 res = tex2D(SamplerColor,coord); + if ( !asciienable ) return res; + float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); + float2 fresl = float2(FONT_WIDTH,FONT_HEIGHT); + float2 cresl = float2(GLYPH_WIDTH,GLYPH_HEIGHT); + float2 bscl = floor(bresl/cresl); + /* + Here I use the "cheap" method, based on the overall luminance of + each glyph, rather than attempt to search for the best fitting glyph + for each cell. If you want to know why, take a look at the ASCII + filter bundled with the Dolphin emulator, and be prepared for the + resulting seconds per frame it runs at. The calculations needed for + such a filter are completely insane even for the highest-end GPUs. + */ + float3 col = tex2D(SamplerColor,floor(bscl*coord)/bscl).rgb; + int lum = clamp(luminance(col)*FONT_LEVELS,0,FONT_LEVELS); + float2 itx = floor(coord*bresl); + float2 blk = floor(itx/cresl)*cresl; + float2 ofs = itx-blk; + ofs.y += lum*cresl.y; + ofs /= fresl; + float gch = tex2D(SamplerFont,ofs).x; + if ( gch < 0.5 ) res.rgb = res.rgb*asciiblend; + else + { + if ( asciimono ) res.rgb = 1.0; + else res.rgb = col; + } + return res; +} float4 PS_ChromaKey( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR { float2 coord = IN.txcoord.xy; @@ -146,6 +180,69 @@ float4 PS_ChromaKey( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR return float4(maskr,maskg,maskb,1.0); return res; } +/* 2x2 RGBI dot matrix, not even close to anything that exists IRL but meh */ +float4 PS_DotMatrix( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR +{ + float2 coord = IN.txcoord.xy; + float4 res = tex2D(SamplerColor,coord); + if ( !dotenable ) return res; + float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); + bresl.xy *= 1.0/(dotsize*2.0); + float4 dac = float4(res.r*0.5,res.g*0.5,res.b*0.5, + (res.r+res.g+res.b)/6.0); + /* + There are two types of CRTs: aperture grille and shadow mask. + The former is blurry and has scanlines (rather big ones, even), but + is cheap to emulate; while the latter is the one most known for its + crisp, square pixels with minimal distortion. Most individuals into + this whole "retro graphics" stuff prefer aperture grille, which + looks like shit, then again, that's the sort of visual quality they + want. The main issue with shadow mask CRTs is that it's impossible + to accurately emulate them unless done on a screen with a HUGE + resolution. After all, the subpixels need to be clearly visible, and + if on top of it you add curvature distortion, you need to reduce + moire patterns that will inevitably show up at low resolutions. + + It would be more desirable to eventually have flat panels that can + display arbitrary resolutions using a form of scaling that preserves + square pixels with unnoticeable distortion (typically, with nearest + neighbour you'd get some pixels that are bigger/smaller than others + if the upscale resolution isn't an integer multiple of the real + resolution. + + This 2x2 RGBI thing is a rather naïve filter I made many years ago, + it looks unlike any real CRT, but scales well. Its only problem is + moire patterns when using the default size of 2x2. + */ + float4 dots = tex2D(SamplerDots,coord*bresl)*dac; + float3 tcol = pow(max(0,dots.rgb+dots.a),dotpow)*dotmult; + res.rgb = res.rgb*(1-dotblend)+tcol*dotblend; + return res; +} +/* that's right, CRT curvature */ +float4 PS_Curvature( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR +{ + float2 coord = IN.txcoord.xy; + float4 res = tex2D(SamplerColor,coord); + if ( !curveenable ) return res; + float3 eta = float3(1+chromaab*0.009,1+chromaab*0.006,1+chromaab + *0.003); + float2 center = float2(coord.x-0.5,coord.y-0.5); + float zfact = 100.0/lenszoom; + float r2 = center.x*center.x+center.y*center.y; + float f = 1+r2*lensdist*0.01; + float x = f*zfact*center.x+0.5; + float y = f*zfact*center.y+0.5; + float2 rcoord = (f*eta.r)*zfact*(center.xy*0.5)+0.5; + float2 gcoord = (f*eta.g)*zfact*(center.xy*0.5)+0.5; + float2 bcoord = (f*eta.b)*zfact*(center.xy*0.5)+0.5; + int i,j; + float3 idist = float3(tex2D(SamplerColorb,rcoord).r, + tex2D(SamplerColorb,gcoord).g, + tex2D(SamplerColorb,bcoord).b); + res.rgb = idist.rgb; + return res; +} /* Why am I doing this */ float4 PS_Blur( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR { @@ -235,8 +332,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 @@ -255,7 +352,7 @@ float4 PS_Vignette( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR int i,j; [unroll] for ( i=-3; i<4; i++ ) [unroll] for ( j=-3; j<4; j++ ) res.rgb += gauss4[abs(i)]*gauss4[abs(j)] - *tex2D(SamplerColor,coord+float2(i,j)*bof); + *tex2D(SamplerColor,coord+float2(i,j)*bof).rgb; } /* apply color */ if ( vigenable ) @@ -271,13 +368,88 @@ 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; -}*/ +} +/* remove speckles from kuwahara filter */ +float4 PS_MedianSmooth( 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; + float3 m1, m2, m3; + float3 a, b, c; + a = tex2D(SamplerColor,coord+float2(-1,-1)*bof).rgb; + b = tex2D(SamplerColor,coord+float2( 0,-1)*bof).rgb; + c = tex2D(SamplerColor,coord+float2( 1,-1)*bof).rgb; + m1 = (luminance(a) 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 +530,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_MedianSmooth(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -335,7 +547,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_FXAA(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -352,7 +564,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_Blur(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -369,7 +581,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_Sharp(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -381,13 +593,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_Shift(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -400,6 +611,108 @@ technique PostProcess6 } } technique PostProcess7 +{ + pass p0 + { + VertexShader = compile vs_3_0 VS_Pass(); + PixelShader = compile ps_3_0 PS_ChromaKey(); + DitherEnable = FALSE; + ZEnable = FALSE; + CullMode = NONE; + ALPHATESTENABLE = FALSE; + SEPARATEALPHABLENDENABLE = FALSE; + AlphaBlendEnable = FALSE; + StencilEnable = FALSE; + FogEnable = FALSE; + SRGBWRITEENABLE = FALSE; + } +} +technique PostProcess8 +{ + 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 PostProcess9 +{ + pass p0 + { + VertexShader = compile vs_3_0 VS_Pass(); + PixelShader = compile ps_3_0 PS_Retro(); + DitherEnable = FALSE; + ZEnable = FALSE; + CullMode = NONE; + ALPHATESTENABLE = FALSE; + SEPARATEALPHABLENDENABLE = FALSE; + AlphaBlendEnable = FALSE; + StencilEnable = FALSE; + FogEnable = FALSE; + SRGBWRITEENABLE = FALSE; + } +} +technique PostProcess10 +{ + pass p0 + { + VertexShader = compile vs_3_0 VS_Pass(); + PixelShader = compile ps_3_0 PS_ASCII(); + DitherEnable = FALSE; + ZEnable = FALSE; + CullMode = NONE; + ALPHATESTENABLE = FALSE; + SEPARATEALPHABLENDENABLE = FALSE; + AlphaBlendEnable = FALSE; + StencilEnable = FALSE; + FogEnable = FALSE; + SRGBWRITEENABLE = FALSE; + } +} +technique PostProcess11 +{ + pass p0 + { + VertexShader = compile vs_3_0 VS_Pass(); + PixelShader = compile ps_3_0 PS_DotMatrix(); + DitherEnable = FALSE; + ZEnable = FALSE; + CullMode = NONE; + ALPHATESTENABLE = FALSE; + SEPARATEALPHABLENDENABLE = FALSE; + AlphaBlendEnable = FALSE; + StencilEnable = FALSE; + FogEnable = FALSE; + SRGBWRITEENABLE = FALSE; + } +} +technique PostProcess12 +{ + pass p0 + { + VertexShader = compile vs_3_0 VS_Pass(); + PixelShader = compile ps_3_0 PS_Curvature(); + DitherEnable = FALSE; + ZEnable = FALSE; + CullMode = NONE; + ALPHATESTENABLE = FALSE; + SEPARATEALPHABLENDENABLE = FALSE; + AlphaBlendEnable = FALSE; + StencilEnable = FALSE; + FogEnable = FALSE; + SRGBWRITEENABLE = FALSE; + } +} +technique PostProcess13 { pass p0 { diff --git a/enbseries/menbextrainternals.fx b/enbseries/menbextrainternals.fx index 1141662..53a486d 100644 --- a/enbseries/menbextrainternals.fx +++ b/enbseries/menbextrainternals.fx @@ -43,9 +43,18 @@ static const float ordered8[64] = float4 ScreenSize; float ENightDayFactor; float EInteriorFactor; +float4 Timer; /* samplers and textures */ texture2D texColor; texture2D texDepth; +texture2D texFont +< + string ResourceName = "menbvgaluma.png"; +>; +texture2D texDots +< + string ResourceName = "menbdots.png"; +>; texture2D texCGA < string ResourceName = "menbcgalut.png"; @@ -102,6 +111,30 @@ sampler2D SamplerDepth = sampler_state MaxMipLevel = 0; MipMapLodBias = 0; }; +sampler2D SamplerFont = sampler_state +{ + Texture = ; + MinFilter = LINEAR; + MagFilter = POINT; + MipFilter = NONE; + AddressU = Wrap; + AddressV = Wrap; + SRGBTexture = FALSE; + MaxMipLevel = 0; + MipMapLodBias = 0; +}; +sampler2D SamplerDots = sampler_state +{ + Texture = ; + MinFilter = LINEAR; + MagFilter = LINEAR; + MipFilter = NONE; + AddressU = Wrap; + AddressV = Wrap; + SRGBTexture = FALSE; + MaxMipLevel = 0; + MipMapLodBias = 0; +}; sampler2D SamplerCGA = sampler_state { Texture = ; diff --git a/enbseries/menbextrasettings.fx b/enbseries/menbextrasettings.fx index da1c8ef..ad65346 100644 --- a/enbseries/menbextrasettings.fx +++ b/enbseries/menbextrasettings.fx @@ -140,6 +140,63 @@ float bdmult string UIWidget = "Spinner"; float UIMin = 0.0; > = {0.25}; +/* + Paint filters: + -1 : Disabled + 0 : Oil painting filter, mixes Kuwahara with median for a smooth result + 1 : "Van Gogh" filter, ported from https://www.shadertoy.com/view/MdGSDG + with some small changes + 2 : "Watercolor" filter, ported from https://www.shadertoy.com/view/ltyGRV + also with some small changes + +*/ +string str_paint = "Painting Filters"; +bool oilenable +< + string UIName = "Enable Oil Filter"; + string UIWidget = "Checkbox"; +> = {false}; +/* legacy FXAA filter */ +string str_fxaa = "FXAA"; +bool fxaaenable +< + string UIName = "Enable FXAA"; + string UIWidget = "Checkbox"; +> = {false}; +float fxaaspanmax +< + string UIName = "FXAA Span Max"; + string UIWidget = "Checkbox"; +> = {4.0}; +float fxaareducemul +< + string UIName = "FXAA Reduce Mul"; + string UIWidget = "Checkbox"; +> = {16.0}; +float fxaareducemin +< + string UIName = "FXAA Reduce Min"; + string UIWidget = "Checkbox"; +> = {128.0}; +/* ASCII art filter */ +string str_ascii = "Luma ASCII Art Filter"; +bool asciienable +< + string UIName = "Enable ASCII"; + string UIWidget = "Checkbox"; +> = {false}; +bool asciimono +< + string UIName = "ASCII Monochrome"; + string UIWidget = "Checkbox"; +> = {true}; +float asciiblend +< + string UIName = "ASCII Blend"; + string UIWidget = "Spinner"; + float UIMin = 0.0; + float UIMax = 1.0; +> = {0.0}; /* Depth-cutting chroma key */ string str_mask = "Depth Chroma Key"; bool maskenable @@ -200,6 +257,60 @@ float masktilty string UIName = "Chroma Key Depth Vertical Tilt"; string UIWidget = "Spinner"; > = {0.0}; +/* cheap dot matrix */ +string str_dot = "RGBI Dot Matrix"; +bool dotenable +< + string UIName = "Enable Dot Matrix"; + string UIWidget = "Checkbox"; +> = {false}; +int dotsize +< + string UIName = "Dot Size"; + string UIWidget = "Spinner"; + int UIMin = 1; +> = {1}; +float dotblend +< + string UIName = "Dot Blend"; + string UIWidget = "Spinner"; + float UIMin = 0.0; + float UIMax = 1.0; +> = {0.4}; +float dotmult +< + string UIName = "Dot Intensity"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {1.0}; +float dotpow +< + string UIName = "Dot Contrast"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {1.0}; +/* lens curve with chromatic aberration */ +string str_curve = "Lens Curvature"; +bool curveenable +< + string UIName = "Enable Curvature"; + string UIWidget = "Checkbox"; +> = {false}; +float chromaab +< + string UIName = "Curve Chromatic Aberration"; + string UIWidget = "Spinner"; +> = {0.0}; +float lenszoom +< + string UIName = "Curve Zooming"; + string UIWidget = "Spinner"; +> = {50.0}; +float lensdist +< + string UIName = "Curve Distortion"; + string UIWidget = "Spinner"; +> = {0.0}; /* BlurSharpShift, some people are obsessed with this nonsense */ string str_bss = "BlurSharpShift"; bool bssblurenable diff --git a/enbseries/menbglobaldefs.fx b/enbseries/menbglobaldefs.fx index b1cb1cd..d77143e 100644 --- a/enbseries/menbglobaldefs.fx +++ b/enbseries/menbglobaldefs.fx @@ -65,16 +65,31 @@ ?isfog(WeatherAndTime.y)?(1.0):(WeatherAndTime.z)\ :isfog(WeatherAndTime.y)?(1.0-WeatherAndTime.z):(0.0)) /* asset definitions */ +/* ascii art font */ +#define FONT_WIDTH 8 +#define FONT_HEIGHT 4096 +#define GLYPH_WIDTH 8 +#define GLYPH_HEIGHT 16 +#define FONT_LEVELS 255 +/* + aspect correction for certain overlays + uncommented : the textures are 1:1 and must be corrected + commented : the textures are 16:9 or whatever ratio you use +*/ +//#define ASPECT_LENSDIRT /* texture sizes */ #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 */ +/* LUT mode (use only one) */ //#define LUTMODE_LEGACY //#define LUTMODE_16 #define LUTMODE_64 +/* !NEW! volume map option, faster and more precise, no legacy tex support */ +#define VOLUME_LUTS /* some textures can be provided as DDS rather than PNG to save space */ //#define HEAT_DDS +//#define LENSDIRT_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 dfe0ada..0000000 Binary files a/enbseries/menblut64_day.png and /dev/null differ diff --git a/enbseries/menblut64_interiorday.png b/enbseries/menblut64_interiorday.png deleted file mode 100644 index b4bbd51..0000000 Binary files a/enbseries/menblut64_interiorday.png and /dev/null differ diff --git a/enbseries/menblut64_interiornight.png b/enbseries/menblut64_interiornight.png deleted file mode 100644 index b3148b3..0000000 Binary files a/enbseries/menblut64_interiornight.png and /dev/null differ diff --git a/enbseries/menblut64_night.png b/enbseries/menblut64_night.png deleted file mode 100644 index 1de9faa..0000000 Binary files a/enbseries/menblut64_night.png and /dev/null differ diff --git a/enbseries/menblut64v_day.dds b/enbseries/menblut64v_day.dds new file mode 100644 index 0000000..3885c54 Binary files /dev/null and b/enbseries/menblut64v_day.dds differ diff --git a/enbseries/menblut64v_interiorday.dds b/enbseries/menblut64v_interiorday.dds new file mode 100644 index 0000000..804b00a Binary files /dev/null and b/enbseries/menblut64v_interiorday.dds differ diff --git a/enbseries/menblut64v_interiornight.dds b/enbseries/menblut64v_interiornight.dds new file mode 100644 index 0000000..79fbd9a Binary files /dev/null and b/enbseries/menblut64v_interiornight.dds differ diff --git a/enbseries/menblut64v_night.dds b/enbseries/menblut64v_night.dds new file mode 100644 index 0000000..828b624 Binary files /dev/null and b/enbseries/menblut64v_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 0a27dbc..4211ee1 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,19 @@ 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_DepthGrading( 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 */ + 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; @@ -200,17 +290,17 @@ float4 PS_EdgePlusSSAOPrepass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR else bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w); float3 normal = pseudonormal(depth,coord); float2 nc = coord*(bresl/256.0); - float2 bof = float2(1.0/bresl.x,1.0/bresl.y)*ssaoradius; + float2 bof = (1.0/bresl)*ssaoradius; float2 nc2 = tex2D(SamplerNoise3,nc+48000.0*Timer.x*ssaonoise).xy; float3 rnormal = tex2D(SamplerNoise3,nc2).xyz*2.0-1.0; rnormal = normalize(rnormal); float occ = 0.0; int i; float3 sample; - float sdepth, so, delta; - float sclamp = ssaoclamp/100000.0; - float sclampmin = ssaoclampmin/100000.0; - [unroll] for ( i=0; i<16; i++ ) + float sdepth, delta; + float so; + float sclamp = ssaoclamp/100000.0, sclampmin = ssaoclampmin/100000.0; + [loop] for ( i=0; i<64; i++ ) { sample = reflect(ssao_samples[i],rnormal); sample *= sign(dot(normal,sample)); @@ -221,13 +311,23 @@ 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; } +float4 PS_EdgeFilters( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR +{ + float2 coord = IN.txcoord.xy; + float4 res = tex2D(SamplerColor,coord); + if ( fogenable ) res.rgb = Limbo(res.rgb,coord); + if ( edgevenable ) res.rgb = EdgeView(res.rgb,coord); + if ( comenable ) res.rgb = EdgeDetect(res.rgb,coord); + if ( contenable ) res.rgb = LineView(res.rgb,coord); + return res; +} /* Distant hot air refraction. Not very realistic, but does the job. */ float2 DistantHeat( float2 coord ) { @@ -276,35 +376,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); @@ -314,20 +393,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); @@ -339,7 +418,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_EdgeFilters(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -356,7 +435,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_DepthGrading(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -373,7 +452,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_SSAOPrepass(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -390,7 +469,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_Distortion(); DitherEnable = FALSE; ZEnable = FALSE; CullMode = NONE; @@ -402,3 +481,20 @@ technique PostProcess4 SRGBWRITEENABLE = FALSE; } } +technique PostProcess5 +{ + pass p0 + { + VertexShader = compile vs_3_0 VS_Pass(); + PixelShader = compile ps_3_0 PS_SSAOBlur(); + DitherEnable = FALSE; + ZEnable = FALSE; + CullMode = NONE; + ALPHATESTENABLE = FALSE; + SEPARATEALPHABLENDENABLE = FALSE; + AlphaBlendEnable = FALSE; + StencilEnable = FALSE; + FogEnable = FALSE; + SRGBWRITEENABLE = FALSE; + } +} \ No newline at end of file diff --git a/enbseries/menbprepassinternals.fx b/enbseries/menbprepassinternals.fx index 15c3866..53e1a93 100644 --- a/enbseries/menbprepassinternals.fx +++ b/enbseries/menbprepassinternals.fx @@ -19,37 +19,54 @@ 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) }; /* standard stuff */ float4 ScreenSize; float ENightDayFactor; float EInteriorFactor; float4 Timer; +float FieldOfView; float4 WeatherAndTime; /* this still doesn't do anything */ extern float fWaterLevel; @@ -58,7 +75,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 2998f8f..27f475d 100644 --- a/enbseries/menbprepasssettings.fx +++ b/enbseries/menbprepasssettings.fx @@ -188,6 +188,175 @@ 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_in +< + string UIName = "Linevision Fade Contrast Interior Night"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {2.0}; +float contfadepow_id +< + string UIName = "Linevision Fade Contrast Interior Day"; + 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_in +< + string UIName = "Linevision Fade Intensity Interior Night"; + string UIWidget = "Spinner"; + float UIMin = 0.0; +> = {500.0}; +float contfademult_id +< + string UIName = "Linevision Fade Intensity Interior Day"; + 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 @@ -267,6 +436,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/menbvgaluma.png b/enbseries/menbvgaluma.png new file mode 100644 index 0000000..ff6cccf Binary files /dev/null and b/enbseries/menbvgaluma.png differ