MariENB FROST 3.2.1b
This commit is contained in:
parent
e516bebcec
commit
ff9462ea24
10 changed files with 244 additions and 462 deletions
|
|
@ -108,17 +108,15 @@ int vgapal
|
|||
-1 : No dithering, just raw banding
|
||||
0 : 2x2 checkerboard dithering, looks like ass
|
||||
1 : 2x2 ordered dithering
|
||||
2 : 3x3 ordered dithering
|
||||
3 : 4x4 ordered dithering
|
||||
4 : 8x8 ordered dithering
|
||||
2 : 8x8 ordered dithering
|
||||
*/
|
||||
int dither
|
||||
<
|
||||
string UIName = "Dithering Pattern";
|
||||
string UIWidget = "Spinner";
|
||||
int UIMin = -1;
|
||||
int UIMax = 4;
|
||||
> = {4};
|
||||
int UIMax = 2;
|
||||
> = {2};
|
||||
/* gamma modifier for base color, lower values raise midtones and viceversa */
|
||||
float bgamma
|
||||
<
|
||||
|
|
@ -306,6 +304,25 @@ float lsharpblend
|
|||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.2};
|
||||
/* very cinematic black bars */
|
||||
string str_box = "Black Bars";
|
||||
bool boxenable
|
||||
<
|
||||
string UIName = "Enable Black Bars";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {false};
|
||||
float boxh
|
||||
<
|
||||
string UIName = "Box Horizontal Ratio";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 1.0;
|
||||
> = {2.39};
|
||||
float boxv
|
||||
<
|
||||
string UIName = "Box Vertical Ratio";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 1.0;
|
||||
> = {1.0};
|
||||
|
||||
/*
|
||||
dithering threshold maps
|
||||
|
|
@ -323,23 +340,6 @@ static const float ordered2[4] =
|
|||
d(4),d(2)
|
||||
};
|
||||
#undef d
|
||||
#define d(x) x/9.0
|
||||
static const float ordered3[9] =
|
||||
{
|
||||
d(2),d(6),d(3),
|
||||
d(5),d(0),d(8),
|
||||
d(1),d(7),d(4)
|
||||
};
|
||||
#undef d
|
||||
#define d(x) x/16.0
|
||||
static const float ordered4[16] =
|
||||
{
|
||||
d( 0),d( 8),d( 2),d(10),
|
||||
d(12),d( 4),d(14),d( 6),
|
||||
d( 3),d(11),d( 1),d( 9),
|
||||
d(15),d( 7),d(13),d( 5)
|
||||
};
|
||||
#undef d
|
||||
#define d(x) x/64.0
|
||||
static const float ordered8[64] =
|
||||
{
|
||||
|
|
@ -363,14 +363,6 @@ float4 ScreenSize;
|
|||
Texture2D TextureOriginal;
|
||||
Texture2D TextureColor;
|
||||
Texture2D TextureDepth;
|
||||
Texture2D TextureFont
|
||||
<
|
||||
string ResourceName = "menbvgaluma.png";
|
||||
>;
|
||||
Texture2D TextureDots
|
||||
<
|
||||
string ResourceName = "menbdots.png";
|
||||
>;
|
||||
Texture2D TextureCGA
|
||||
<
|
||||
string ResourceName = "menbcgalut.png";
|
||||
|
|
@ -396,22 +388,6 @@ SamplerState SamplerB
|
|||
AddressU = Border;
|
||||
AddressV = Border;
|
||||
};
|
||||
SamplerState SamplerFont
|
||||
{
|
||||
Filter = MIN_LINEAR_MAG_MIP_POINT;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
MaxLOD = 0;
|
||||
MinLOD = 0;
|
||||
};
|
||||
SamplerState SamplerDots
|
||||
{
|
||||
Filter = MIN_MAG_MIP_LINEAR;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
MaxLOD = 0;
|
||||
MinLOD = 0;
|
||||
};
|
||||
SamplerState SamplerLUT
|
||||
{
|
||||
Filter = MIN_MAG_MIP_POINT;
|
||||
|
|
@ -473,10 +449,6 @@ float4 ReducePrepass( in float4 col, in float2 coord )
|
|||
else if ( dither == 1 )
|
||||
col += bdbump+ordered2[int(coord.x%2)+2*int(coord.y%2)]*bdmult;
|
||||
else if ( dither == 2 )
|
||||
col += bdbump+ordered3[int(coord.x%3)+3*int(coord.y%3)]*bdmult;
|
||||
else if ( dither == 3 )
|
||||
col += bdbump+ordered4[int(coord.x%4)+4*int(coord.y%4)]*bdmult;
|
||||
else if ( dither == 4 )
|
||||
col += bdbump+ordered8[int(coord.x%8)+8*int(coord.y%8)]*bdmult;
|
||||
col = saturate(col);
|
||||
return col;
|
||||
|
|
@ -574,41 +546,6 @@ float4 PS_Retro( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
|||
return res;
|
||||
}
|
||||
|
||||
/* ASCII art (more like CP437 art) */
|
||||
float4 PS_ASCII( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,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 = TextureOriginal.Sample(Sampler,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 = TextureFont.Sample(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, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
|
|
@ -619,87 +556,6 @@ float4 PS_ChromaKey( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
|||
return res;
|
||||
}
|
||||
|
||||
/* 2x2 RGBI dot matrix, not even close to anything that exists IRL but meh */
|
||||
float4 PS_DotMatrix( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,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 = TextureDots.Sample(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, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,coord);
|
||||
if ( !curveenable ) return res;
|
||||
float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
|
||||
float2 bof = (1.0/bresl)*curvesoft;
|
||||
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;
|
||||
float4 idist = float4(0,0,0,0);
|
||||
/*
|
||||
sticking a 5x5 gaussian blur with a tweakable radius in here to
|
||||
attempt to reduce moire patterns in some cases. Supersampling would
|
||||
be more useful for that, but ENB sucks ass through a crazy straw in
|
||||
that aspect, so it would be more desirable to use GeDoSaTo (I sure
|
||||
hope I can port all my stuff to it one day, at least the damn thing
|
||||
is FOSS).
|
||||
*/
|
||||
[unroll] for ( i=-2; i<=2; i++ ) [unroll] for ( j=-2; j<=2; j++ )
|
||||
{
|
||||
idist += gauss3[abs(i)]*gauss3[abs(j)]
|
||||
*float4(TextureColor.Sample(Sampler,rcoord+bof
|
||||
*float2(i,j)).r,TextureColor.Sample(SamplerB,gcoord+bof
|
||||
*float2(i,j)).g,TextureColor.Sample(SamplerB,bcoord+bof
|
||||
*float2(i,j)).b,TextureColor.Sample(SamplerB,float2(x,
|
||||
y)+bof*float2(i,j)).a);
|
||||
}
|
||||
res.rgb = idist.rgb;
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Why am I doing this */
|
||||
float4 PS_Blur( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
|
|
@ -790,6 +646,24 @@ float4 PS_LumaSharp( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
|||
return theywillnotheal;
|
||||
}
|
||||
|
||||
/* ultimate super-cinematic immersive black bars */
|
||||
float4 PS_Cinematic( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
float4 res = TextureColor.Sample(Sampler,coord);
|
||||
if ( !boxenable ) return res;
|
||||
float2 bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
|
||||
float sar = bresl.x/bresl.y;
|
||||
float tar = boxh/boxv;
|
||||
float2 box = (sar<tar)?float2(0.0,(bresl.y-(bresl.x/tar))*0.5)
|
||||
:float2((bresl.x-(bresl.y*tar))*0.5,0.0);
|
||||
box /= bresl;
|
||||
/* this is some kind of advanced black magic I can't understand */
|
||||
float2 test = saturate((coord*coord-coord)-(box*box-box));
|
||||
if ( -test.x != test.y ) res *= 0.0;
|
||||
return res;
|
||||
}
|
||||
|
||||
technique11 ExtraFilters <string UIName="MariENB";>
|
||||
{
|
||||
pass p0
|
||||
|
|
@ -843,22 +717,6 @@ technique11 ExtraFilters6
|
|||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_ASCII()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters7
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_DotMatrix()));
|
||||
}
|
||||
}
|
||||
technique11 ExtraFilters8
|
||||
{
|
||||
pass p0
|
||||
{
|
||||
SetVertexShader(CompileShader(vs_5_0,VS_PostProcess()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_Curvature()));
|
||||
SetPixelShader(CompileShader(ps_5_0,PS_Cinematic()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue