MariENB FROST 3.5.0
This commit is contained in:
parent
7402eaaade
commit
65b822a8f6
11 changed files with 88 additions and 725 deletions
|
|
@ -6,35 +6,6 @@
|
|||
*/
|
||||
#include "menbglobaldefs.fx"
|
||||
|
||||
/* Paint filter */
|
||||
string str_paint = "Painting Filter";
|
||||
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};
|
||||
/* new SMAA filter */
|
||||
string str_smaa = "SMAA";
|
||||
bool smaaenable
|
||||
|
|
@ -118,69 +89,6 @@ float lsharpblend
|
|||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.2};
|
||||
/* 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
|
||||
<
|
||||
string UIName = "Enable Blur";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {false};
|
||||
float bssblurradius
|
||||
<
|
||||
string UIName = "Blur Sampling Range";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {0.25};
|
||||
bool bsssharpenable
|
||||
<
|
||||
string UIName = "Enable Sharp";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {false};
|
||||
float bsssharpradius
|
||||
<
|
||||
string UIName = "Sharp Sampling Range";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.0};
|
||||
float bsssharpamount
|
||||
<
|
||||
string UIName = "Sharpening Amount";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {6.0};
|
||||
bool bssshiftenable
|
||||
<
|
||||
string UIName = "Enable Shift";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {false};
|
||||
float bssshiftradius
|
||||
<
|
||||
string UIName = "Shift Sampling Range";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {0.75};
|
||||
/* very cinematic black bars */
|
||||
string str_box = "Black Bars";
|
||||
bool boxenable
|
||||
|
|
@ -581,101 +489,6 @@ float4 PS_ChromaKey( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
|||
return res;
|
||||
}
|
||||
|
||||
/* that's right, CRT curvature */
|
||||
float4 PS_Curvature( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,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(TextureColor.Sample(SamplerB,rcoord).r,
|
||||
TextureColor.Sample(SamplerB,gcoord).g,
|
||||
TextureColor.Sample(SamplerB,bcoord).b);
|
||||
res.rgb = idist.rgb;
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Why am I doing this */
|
||||
float4 PS_Blur( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,coord);
|
||||
if ( !bssblurenable ) return res;
|
||||
float2 ofs[16] =
|
||||
{
|
||||
float2(1.0,1.0), float2(-1.0,-1.0),
|
||||
float2(-1.0,1.0), float2(1.0,-1.0),
|
||||
|
||||
float2(1.0,0.0), float2(-1.0,0.0),
|
||||
float2(0.0,1.0), float2(0.0,-1.0),
|
||||
|
||||
float2(1.41,0.0), float2(-1.41,0.0),
|
||||
float2(0.0,1.41), float2(0.0,-1.41),
|
||||
|
||||
float2(1.41,1.41), float2(-1.41,-1.41),
|
||||
float2(-1.41,1.41), float2(1.41,-1.41)
|
||||
};
|
||||
float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
|
||||
float2 bof = (1.0/bresl)*bssblurradius;
|
||||
int i;
|
||||
[unroll] for ( i=0; i<16; i++ )
|
||||
res += TextureColor.Sample(Sampler,coord+ofs[i]*bof);
|
||||
res /= 17.0;
|
||||
res.a = 1.0;
|
||||
return res;
|
||||
}
|
||||
float4 PS_Sharp( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,coord);
|
||||
if ( !bsssharpenable ) return res;
|
||||
float2 ofs[8] =
|
||||
{
|
||||
float2(1.0,1.0), float2(-1.0,-1.0),
|
||||
float2(-1.0,1.0), float2(1.0,-1.0),
|
||||
|
||||
float2(1.41,1.41), float2(-1.41,-1.41),
|
||||
float2(-1.41,1.41), float2(1.41,-1.41)
|
||||
};
|
||||
float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
|
||||
float2 bof = (1.0/bresl)*bsssharpradius;
|
||||
float4 tcol = res;
|
||||
int i;
|
||||
[unroll] for ( i=0; i<8; i++ )
|
||||
tcol += TextureColor.Sample(Sampler,coord+ofs[i]*bof);
|
||||
tcol /= 9.0;
|
||||
float4 orig = res;
|
||||
res = orig*(1.0+dot(orig.rgb-tcol.rgb,0.333333)*bsssharpamount);
|
||||
float rg = clamp(pow(orig.b,3.0),0.0,1.0);
|
||||
res = lerp(res,orig,rg);
|
||||
res.a = 1.0;
|
||||
return res;
|
||||
}
|
||||
float4 PS_Shift( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,coord);
|
||||
if ( !bssshiftenable ) return res;
|
||||
float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
|
||||
float2 bof = (1.0/bresl)*bssshiftradius;
|
||||
res.g = TextureColor.Sample(Sampler,coord).g;
|
||||
res.r = TextureColor.Sample(Sampler,coord+float2(0,-bof.y)).r;
|
||||
res.b = TextureColor.Sample(Sampler,coord+float2(0,bof.y)).b;
|
||||
res.a = 1.0;
|
||||
return res;
|
||||
}
|
||||
|
||||
/* That "luma sharpen" thingy, added just because someone might want it */
|
||||
float4 PS_LumaSharp( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
|
|
@ -754,132 +567,6 @@ float4 PS_Vignette( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
|||
return clamp(res,0.0,1.0);
|
||||
}
|
||||
|
||||
/* paint filter */
|
||||
float4 PS_Kuwahara( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,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 = TextureColor.Sample(Sampler,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 = TextureColor.Sample(Sampler,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 = TextureColor.Sample(Sampler,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 = TextureColor.Sample(Sampler,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_Median( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,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 = TextureColor.Sample(Sampler,coord+float2(-1,-1)*bof).rgb;
|
||||
b = TextureColor.Sample(Sampler,coord+float2( 0,-1)*bof).rgb;
|
||||
c = TextureColor.Sample(Sampler,coord+float2( 1,-1)*bof).rgb;
|
||||
m1 = (luminance(a)<luminance(b))?((luminance(b)<luminance(c))?b
|
||||
:max(a,c)):((luminance(a)<luminance(c))?a:max(b,c));
|
||||
a = TextureColor.Sample(Sampler,coord+float2(-1, 0)*bof).rgb;
|
||||
b = TextureColor.Sample(Sampler,coord+float2( 0, 0)*bof).rgb;
|
||||
c = TextureColor.Sample(Sampler,coord+float2( 1, 0)*bof).rgb;
|
||||
m2 = (luminance(a)<luminance(b))?((luminance(b)<luminance(c))?b
|
||||
:max(a,c)):((luminance(a)<luminance(c))?a:max(b,c));
|
||||
a = TextureColor.Sample(Sampler,coord+float2(-1, 1)*bof).rgb;
|
||||
b = TextureColor.Sample(Sampler,coord+float2( 0, 1)*bof).rgb;
|
||||
c = TextureColor.Sample(Sampler,coord+float2( 1, 1)*bof).rgb;
|
||||
m3 = (luminance(a)<luminance(b))?((luminance(b)<luminance(c))?b
|
||||
:max(a,c)):((luminance(a)<luminance(c))?a:max(b,c));
|
||||
res.rgb = (luminance(m1)<luminance(m2))?((luminance(m2)<luminance(m3))
|
||||
?m2:max(m1,m3)):((luminance(m1)<luminance(m3))?m1:max(m2,m3));
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Legacy MariENB FXAA, useful for further smoothing the paint filter */
|
||||
float4 PS_FXAA( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = float2(IN.txcoord.x,IN.txcoord.y);
|
||||
float4 res = TextureColor.Sample(Sampler,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 = TextureColor.Sample(Sampler,coord+float2(-1,-1)*bof).rgb;
|
||||
float3 rgbNE = TextureColor.Sample(Sampler,coord+float2(1,-1)*bof).rgb;
|
||||
float3 rgbSW = TextureColor.Sample(Sampler,coord+float2(-1,1)*bof).rgb;
|
||||
float3 rgbSE = TextureColor.Sample(Sampler,coord+float2(1,1)*bof).rgb;
|
||||
float3 rgbM = TextureColor.Sample(Sampler,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)*(TextureColor.Sample(Sampler,coord+dir
|
||||
*(1.0/3.0-0.5)).rgb+TextureColor.Sample(Sampler,coord+dir
|
||||
*(2.0/3.0-0.5)).rgb);
|
||||
float3 rgbB = rgbA*(1.0/2.0)+(1.0/4.0)*(TextureColor.Sample(Sampler,
|
||||
coord+dir*(0.0/3.0-0.5)).rgb+TextureColor.Sample(Sampler,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;
|
||||
}
|
||||
|
||||
/* Colour matrix */
|
||||
float3 ColorMatrix( float3 res )
|
||||
{
|
||||
|
|
@ -1116,23 +803,7 @@ technique11 ExtraFilters <string UIName="MariENB";>
|
|||
SetPixelShader(CompileShader(ps_5_0,PS_Append()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters1
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_Kuwahara()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters2
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_Median()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters3 <string RenderTarget="RenderTargetRGBA32";>
|
||||
technique11 ExtraFilters1 <string RenderTarget="RenderTargetRGBA32";>
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
|
|
@ -1142,7 +813,7 @@ technique11 ExtraFilters3 <string RenderTarget="RenderTargetRGBA32";>
|
|||
SetBlendState(NoBlending,float4(0.0,0.0,0.0,0.0),0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters4 <string RenderTarget="RenderTargetRGBA64";>
|
||||
technique11 ExtraFilters2 <string RenderTarget="RenderTargetRGBA64";>
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
|
|
@ -1152,7 +823,7 @@ technique11 ExtraFilters4 <string RenderTarget="RenderTargetRGBA64";>
|
|||
SetBlendState(NoBlending, float4(0.0,0.0,0.0,0.0),0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters5
|
||||
technique11 ExtraFilters3
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
|
|
@ -1160,7 +831,7 @@ technique11 ExtraFilters5
|
|||
SetPixelShader(CompileShader(ps_5_0,PS_ToSRGB()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters6
|
||||
technique11 ExtraFilters4
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
|
|
@ -1168,15 +839,7 @@ technique11 ExtraFilters6
|
|||
SetPixelShader(CompileShader(ps_5_0,SMAANeighborhoodBlendingWrapPS()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters7
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_FXAA()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters8
|
||||
technique11 ExtraFilters5
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
|
|
@ -1184,31 +847,7 @@ technique11 ExtraFilters8
|
|||
SetPixelShader(CompileShader(ps_5_0,PS_LumaSharp()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters9
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_Blur()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters10
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_Sharp()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters11
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_Shift()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters12
|
||||
technique11 ExtraFilters6
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
|
|
@ -1216,7 +855,7 @@ technique11 ExtraFilters12
|
|||
SetPixelShader(CompileShader(ps_5_0,PS_ChromaKey()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters13
|
||||
technique11 ExtraFilters7
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
|
|
@ -1224,15 +863,7 @@ technique11 ExtraFilters13
|
|||
SetPixelShader(CompileShader(ps_5_0,PS_Vignette()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters14
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_Curvature()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters15
|
||||
technique11 ExtraFilters8
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
|
|
@ -1240,3 +871,5 @@ technique11 ExtraFilters15
|
|||
SetPixelShader(CompileShader(ps_5_0,PS_Cinematic()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Reference in a new issue