1
Fork 0

MariENB 1.2015.8.2 (and 1.2015.8.5, which was identical for some reason)

This commit is contained in:
Marisa the Magician 2019-04-07 17:21:22 +02:00
commit f365cc957f
11 changed files with 384 additions and 308 deletions

BIN
enbseries/enbraindrops.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -245,88 +245,6 @@ float4 PS_ASCII( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
}
return res;
}
/* Painting filter */
float4 PS_Paint1( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
{
float2 coord = IN.txcoord.xy;
float4 res = tex2D(SamplerColor,coord);
if ( !paintenable ) return res;
/* Kuwahara filter */
float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
float2 bof = (1.0/bresl)*paintradius;
float n = 16.0;
float3 m[4], s[4], c;
int i, j;
[unroll] for ( i=0; i<4; i++ )
{
m[i] = float3(0,0,0);
s[i] = float3(0,0,0);
}
[unroll] for ( i=-3; i<=0; i++ ) [unroll] for ( j=-3; j<=0; j++ )
{
c = tex2D(SamplerColor,coord+float2(i,j)*bof).rgb;
m[0] += c;
s[0] += c*c;
}
[unroll] for ( i=-3; i<=0; i++ ) [unroll] for ( j=0; j<=3; j++ )
{
c = tex2D(SamplerColor,coord+float2(i,j)*bof).rgb;
m[1] += c;
s[1] += c*c;
}
[unroll] for ( i=0; i<=3; i++ ) [unroll] for ( j=-3; j<=0; j++ )
{
c = tex2D(SamplerColor,coord+float2(i,j)*bof).rgb;
m[2] += c;
s[2] += c*c;
}
[unroll] for ( i=0; i<=3; i++ ) [unroll] 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;
}
float4 PS_Paint2( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
{
float2 coord = IN.txcoord.xy;
float4 res = tex2D(SamplerColor,coord);
if ( !paintenable ) return res;
/* Median filter */
float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
float2 bof = (1.0/bresl)*paintmradius;
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)<luminance(b))?((luminance(b)<luminance(c))?b
:max(a,c)):((luminance(a)<luminance(c))?a:max(b,c));
a = tex2D(SamplerColor,coord+float2(-1, 0)*bof).rgb;
b = tex2D(SamplerColor,coord+float2( 0, 0)*bof).rgb;
c = tex2D(SamplerColor,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 = 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;
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;
}
float4 PS_ChromaKey( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
{
float2 coord = IN.txcoord.xy;
@ -337,40 +255,6 @@ float4 PS_ChromaKey( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
return res;
}
technique PostProcess
{
pass p0
{
VertexShader = compile vs_3_0 VS_Pass();
PixelShader = compile ps_3_0 PS_Paint1();
DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}
technique PostProcess2
{
pass p0
{
VertexShader = compile vs_3_0 VS_Pass();
PixelShader = compile ps_3_0 PS_Paint2();
DitherEnable = FALSE;
ZEnable = FALSE;
CullMode = NONE;
ALPHATESTENABLE = FALSE;
SEPARATEALPHABLENDENABLE = FALSE;
AlphaBlendEnable = FALSE;
StencilEnable = FALSE;
FogEnable = FALSE;
SRGBWRITEENABLE = FALSE;
}
}
technique PostProcess3
{
pass p0
{
@ -387,7 +271,7 @@ technique PostProcess3
SRGBWRITEENABLE = FALSE;
}
}
technique PostProcess4
technique PostProcess2
{
pass p0
{
@ -404,7 +288,7 @@ technique PostProcess4
SRGBWRITEENABLE = FALSE;
}
}
technique PostProcess5
technique PostProcess3
{
pass p0
{

View file

@ -130,24 +130,6 @@ float bsaturation
string UIName = "SaturationMod";
string UIWidget = "Spinner";
> = {1.1};
/* Painting filter, mixes Kuwahara with median for a smooth result */
bool paintenable
<
string UIName = "EnablePainting";
string UIWidget = "Checkbox";
> = {false};
float paintradius
<
string UIName = "PaintingRadius";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {1.0};
float paintmradius
<
string UIName = "PaintingMedianRadius";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {1.0};
/* ASCII art filter */
bool asciienable
<

View file

@ -39,12 +39,12 @@ float3 Sharpen( float3 res, float2 coord )
crawling += tex2D(SamplerColor,coord+float2(0,1)*bof);
crawling *= 0.25;
float3 inmyskin = res-crawling.rgb;
float thesewounds = dot(inmyskin,0.33);
thesewounds = clamp(thesewounds,-sharpclamp,sharpclamp);
float thesewounds = luminance(inmyskin);
thesewounds = clamp(thesewounds,-sharpclamp*0.01,sharpclamp*0.01);
float3 theywillnotheal = res+thesewounds*sharpblend;
return theywillnotheal;
}
/* New and improved edge detection, generally useful for contour shading */
/* New and improved edge detection, for contour shading */
float3 Edge( float3 res, float2 coord )
{
float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
@ -55,6 +55,61 @@ float3 Edge( float3 res, float2 coord )
float edgefademult = lerp(lerp(edgefademult_n,edgefademult_d,tod),
lerp(edgefademult_in,edgefademult_id,tod),ind);
float2 bof = float2(1.0/bresl.x,1.0/bresl.y)*edgeradius;
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(0,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 /= 9.0;
float mud = 0.0;
if ( abs(cont-dep) > (edgethreshold*0.00001) ) mud = 1.0;
float fade = 1.0-tex2D(SamplerDepth,coord).x;
mud *= saturate(pow(fade,edgefadepow)*edgefademult);
mud = saturate(pow(mud,edgepow)*edgemult);
if ( edgedebug ) return 1.0-mud;
return lerp(res,0,mud);
}
/* Secondary "comicbook filter" for additional contour shading */
float3 EdgeColor( 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)*celradius;
float3 col = tex2D(SamplerColor,coord).rgb;
float lum = luminance(col);
float3 ccol = tex2D(SamplerColor,coord+float2(-1,-1)*bof).rgb;
ccol += tex2D(SamplerColor,coord+float2(0,-1)*bof).rgb;
ccol += tex2D(SamplerColor,coord+float2(1,-1)*bof).rgb;
ccol += tex2D(SamplerColor,coord+float2(-1,0)*bof).rgb;
ccol += tex2D(SamplerColor,coord+float2(0,0)*bof).rgb;
ccol += tex2D(SamplerColor,coord+float2(1,0)*bof).rgb;
ccol += tex2D(SamplerColor,coord+float2(-1,1)*bof).rgb;
ccol += tex2D(SamplerColor,coord+float2(0,1)*bof).rgb;
ccol += tex2D(SamplerColor,coord+float2(1,1)*bof).rgb;
ccol /= 9.0;
float clum = luminance(ccol);
float mud = abs(clum-lum);
mud = saturate(pow(mud,celpow)*celmult);
if ( celdebug ) return 1.0-mud;
return lerp(res,0,mud);
}
/* old Edgevision mode */
float3 EdgeView( 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 edgevfadepow = lerp(lerp(edgevfadepow_n,edgevfadepow_d,tod),
lerp(edgevfadepow_in,edgevfadepow_id,tod),ind);
float edgevfademult = lerp(lerp(edgevfademult_n,edgevfademult_d,tod),
lerp(edgevfademult_in,edgevfademult_id,tod),ind);
float2 bof = float2(1.0/bresl.x,1.0/bresl.y)*edgevradius;
float mdx = 0, mdy = 0, mud = 0;
/* this reduces texture fetches by half, big difference */
float3x3 depths;
@ -87,10 +142,9 @@ float3 Edge( 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(fade,edgefadepow)*edgefademult);
mud = saturate(pow(mud,edgepow)*edgemult);
if ( edgeview ) return mud;
return max(0,res-mud);
mud *= saturate(pow(fade,edgevfadepow)*edgevfademult);
mud = saturate(pow(mud,edgevpow)*edgevmult);
return mud;
}
/* the pass that happens before everything else */
float4 PS_FirstPass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
@ -99,6 +153,8 @@ float4 PS_FirstPass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
float4 res = tex2D(SamplerColor,coord);
if ( sharpenable ) res.rgb = Sharpen(res.rgb,coord);
if ( edgeenable ) res.rgb = Edge(res.rgb,coord);
if ( celenable ) res.rgb = EdgeColor(res.rgb,coord);
if ( edgevenable ) res.rgb = EdgeView(res.rgb,coord);
return res;
}
/* Crappy SSAO */
@ -328,7 +384,8 @@ float4 PS_DoFBlurH( VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
float2 coord = IN.txcoord.xy;
if ( dofdisable ) return tex2D(SamplerColor,coord);
float dfc = tex2D(SamplerColor,coord).a;
if ( dofdebug ) return dfc;
if ( dofdebug ) return tex2D(SamplerDepth,coord).x;
if ( dfcdebug ) return dfc;
float bresl = (fixedx>0)?fixedx:ScreenSize.x;
float bof = (1.0/bresl)*dofbradius;
float4 res = float4(0,0,0,0);
@ -369,7 +426,8 @@ float4 PS_DoFBlurV( VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
float2 coord = IN.txcoord.xy;
if ( dofdisable ) return tex2D(SamplerColor,coord);
float dfc = tex2D(SamplerColor,coord).a;
if ( dofdebug ) return dfc;
if ( dofdebug ) return tex2D(SamplerDepth,coord).x;
if ( dfcdebug ) return dfc;
float bresl = (fixedy>0)?fixedy:(ScreenSize.x*ScreenSize.w);
float bof = (1.0/bresl)*dofbradius;
float4 res = float4(0,0,0,0);

View file

@ -577,18 +577,17 @@ bool dofdebug
string UIName = "DebugDepth";
string UIWidget = "Checkbox";
> = {false};
bool dfcdebug
<
string UIName = "DebugFocus";
string UIWidget = "Checkbox";
> = {false};
/* enable edge detect filters */
bool edgeenable
<
string UIName = "EdgeEnable";
string UIWidget = "Checkbox";
> = {false};
/* use "edge vision" instead of contour filter (just because it looks fancy) */
bool edgeview
<
string UIName = "EdgeView";
string UIWidget = "Checkbox";
> = {true};
/* factors */
float edgefadepow_n
<
@ -643,18 +642,131 @@ float edgepow
string UIName = "EdgePower";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {0.5};
> = {1.5};
float edgemult
<
string UIName = "EdgeMultiplier";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {128.0};
> = {1.0};
float edgeradius
<
string UIName = "EdgeRadius";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {0.01};
float edgethreshold
<
string UIName = "EdgeThreshold";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {0.01};
bool edgedebug
<
string UIName = "DebugEdge";
string UIWidget = "Checkbox";
> = {false};
/* use luma edge detection filter */
bool celenable
<
string UIName = "CelEnable";
string UIWidget = "Checkbox";
> = {false};
float celradius
<
string UIName = "CelRadius";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {1.0};
float celmult
<
string UIName = "CelMultiplier";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {4.0};
float celpow
<
string UIName = "CelPower";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {0.5};
bool celdebug
<
string UIName = "DebugCel";
string UIWidget = "Checkbox";
> = {false};
/* use "edge vision" filter */
bool edgevenable
<
string UIName = "EdgeViewEnable";
string UIWidget = "Checkbox";
> = {false};
/* factors */
float edgevfadepow_n
<
string UIName = "EdgeViewFadePowerNight";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {2.0};
float edgevfadepow_d
<
string UIName = "EdgeViewFadePowerDay";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {2.0};
float edgevfadepow_in
<
string UIName = "EdgeViewFadePowerInteriorNight";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {2.0};
float edgevfadepow_id
<
string UIName = "EdgeViewFadePowerInteriorDay";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {2.0};
float edgevfademult_n
<
string UIName = "EdgeViewFadeMultiplierNight";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {500.0};
float edgevfademult_d
<
string UIName = "EdgeViewFadeMultiplierDay";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {500.0};
float edgevfademult_in
<
string UIName = "EdgeViewFadeMultiplierInteriorNight";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {500.0};
float edgevfademult_id
<
string UIName = "EdgeViewFadeMultiplierInteriorDay";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {500.0};
float edgevpow
<
string UIName = "EdgeViewPower";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {0.25};
float edgevmult
<
string UIName = "EdgeViewMultiplier";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {4.0};
float edgevradius
<
string UIName = "EdgeViewRadius";
string UIWidget = "Spinner";
float UIMin = 0.0;
> = {1.0};
/* ssao filter */
bool ssaoenable