Data: Remove license-incompatible shaders

This commit is contained in:
Stenzek
2024-09-01 20:01:34 +10:00
parent 486f410f43
commit 7df5764835
93 changed files with 47 additions and 31273 deletions

View File

@ -1,151 +0,0 @@
#include "ReShade.fxh"
/*
Deblur-Luma Shader
Copyright (C) 2005 - 2024 guest(r) - guest.r@gmail.com
Luma adaptation by Hyllian
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
uniform float OFFSET <
ui_type = "drag";
ui_min = 0.25;
ui_max = 4.0;
ui_step = 0.25;
ui_label = "Deblur offset";
> = 2.0;
uniform float DEBLUR <
ui_type = "drag";
ui_min = 1.0;
ui_max = 7.0;
ui_step = 0.25;
ui_label = "Deblur str.";
> = 1.75;
uniform float SMART <
ui_type = "drag";
ui_min = 0.0;
ui_max = 1.0;
ui_step = 0.05;
ui_label = "Smart deblur";
> = 1.0;
uniform float2 ViewportSize < source = "viewportsize"; >;
static const float3 luma = float3(0.299,0.587,0.114);
static const float4 res = float4(0.0001, 0.0001, 0.0001, 0.0001);
static const float4 uno = float4(1.,1.,1.,1.);
float min8(float4 a4, float4 b4)
{
float4 ab4 = min(a4, b4); float2 ab2 = min(ab4.xy, ab4.zw); return min(ab2.x, ab2.y);
}
float max8(float4 a4, float4 b4)
{
float4 ab4 = max(a4, b4); float2 ab2 = max(ab4.xy, ab4.zw); return max(ab2.x, ab2.y);
}
struct ST_VertexOut
{
float4 t1 : TEXCOORD1;
float4 t2 : TEXCOORD2;
float4 t3 : TEXCOORD3;
};
// Vertex shader generating a triangle covering the entire screen
void VS_Deblur_Luma(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD, out ST_VertexOut vVARS)
{
texcoord.x = (id == 2) ? 2.0 : 0.0;
texcoord.y = (id == 1) ? 2.0 : 0.0;
position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
float dx = OFFSET/ViewportSize.x;
float dy = OFFSET/ViewportSize.y;
vVARS.t1 = texcoord.xxxy + float4( -dx, 0.0, dx, -dy); // c00 c10 c20
vVARS.t2 = texcoord.xxxy + float4( -dx, 0.0, dx, 0.0); // c01 c11 c21
vVARS.t3 = texcoord.xxxy + float4( -dx, 0.0, dx, dy); // c02 c12 c22
}
float4 PS_Deblur_Luma(float4 vpos: SV_Position, float2 vTexCoord : TEXCOORD, in ST_VertexOut vVARS) : SV_Target
{
float3 c11 = tex2D(ReShade::BackBuffer, vVARS.t2.yw).xyz;
float3 c00 = tex2D(ReShade::BackBuffer, vVARS.t1.xw).xyz;
float3 c20 = tex2D(ReShade::BackBuffer, vVARS.t1.zw).xyz;
float3 c22 = tex2D(ReShade::BackBuffer, vVARS.t3.zw).xyz;
float3 c02 = tex2D(ReShade::BackBuffer, vVARS.t3.xw).xyz;
float3 c10 = tex2D(ReShade::BackBuffer, vVARS.t1.yw).xyz;
float3 c21 = tex2D(ReShade::BackBuffer, vVARS.t2.zw).xyz;
float3 c12 = tex2D(ReShade::BackBuffer, vVARS.t3.yw).xyz;
float3 c01 = tex2D(ReShade::BackBuffer, vVARS.t2.xw).xyz;
float4x3 chv = float4x3(c10, c01, c21, c12);
float4x3 cdi = float4x3(c00, c02, c20, c22);
float4 CHV = mul(chv, luma);
float4 CDI = mul(cdi, luma);
float C11 = dot(c11, luma);
float mn1 = min8(CHV, CDI);
float mx1 = max8(CHV, CDI);
float2 mnmx = float2(min(C11, mn1), max(C11, mx1));
float2 dif = abs(float2(C11, C11) - mnmx) + res.xy;
dif = pow(dif, float2(DEBLUR, DEBLUR));
float D11 = dot(dif, mnmx.yx)/(dif.x + dif.y);
float k11 = 1.0/(abs(C11 - D11) + res.x);
float4 khv = float4(1.0/(abs(CHV-float4(D11, D11, D11, D11)) + res));
float4 kdi = float4(1.0/(abs(CDI-float4(D11, D11, D11, D11)) + res));
float avg = (dot(khv + kdi, uno) + k11)/10.0;
khv = max(khv-float4(avg, avg, avg, avg), float4(0.0, 0.0, 0.0, 0.0));
kdi = max(kdi-float4(avg, avg, avg, avg), float4(0.0, 0.0, 0.0, 0.0));
k11 = max(k11-avg, 0.0);
float3 d11 = (mul(khv, chv) + mul(kdi, cdi) + (k11 + res.x)*c11) / (dot(khv + kdi, uno) + k11 + res.x);
float contrast = mnmx.y - mnmx.x;
c11 = lerp(c11, d11, clamp(1.75*contrast-0.125, 0.0, 1.0));
c11 = lerp(d11, c11, SMART);
return float4(c11, 1.0);
}
technique Deblur_Luma
{
pass
{
VertexShader = VS_Deblur_Luma;
PixelShader = PS_Deblur_Luma;
}
}

View File

@ -1,325 +0,0 @@
#include "ReShade.fxh"
/*
Geom Shader - a modified CRT-Geom without CRT features made to be appended/integrated
into any other shaders and provide curvature/warping/oversampling features.
Adapted by Hyllian (2024).
*/
/*
CRT-interlaced
Copyright (C) 2010-2012 cgwg, Themaister and DOLLS
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
(cgwg gave their consent to have the original version of this shader
distributed under the GPL in this message:
http://board.byuu.org/viewtopic.php?p=26075#p26075
"Feel free to distribute my shaders under the GPL. After all, the
barrel distortion code was taken from the Curvature shader, which is
under the GPL."
)
This shader variant is pre-configured with screen curvature
*/
uniform bool geom_curvature <
ui_type = "radio";
ui_label = "Geom Curvature Toggle";
> = 1.0;
uniform float geom_R <
ui_type = "drag";
ui_min = 0.1;
ui_max = 10.0;
ui_step = 0.1;
ui_label = "Geom Curvature Radius";
> = 2.0;
uniform float geom_d <
ui_type = "drag";
ui_min = 0.1;
ui_max = 3.0;
ui_step = 0.1;
ui_label = "Geom Distance";
> = 1.5;
uniform bool geom_invert_aspect <
ui_type = "radio";
ui_label = "Geom Curvature Aspect Inversion";
> = 0.0;
uniform float geom_cornersize <
ui_type = "drag";
ui_min = 0.001;
ui_max = 1.0;
ui_step = 0.005;
ui_label = "Geom Corner Size";
> = 0.03;
uniform float geom_cornersmooth <
ui_type = "drag";
ui_min = 80.0;
ui_max = 2000.0;
ui_step = 100.0;
ui_label = "Geom Corner Smoothness";
> = 1000.0;
uniform float geom_x_tilt <
ui_type = "drag";
ui_min = -1.0;
ui_max = 1.0;
ui_step = 0.05;
ui_label = "Geom Horizontal Tilt";
> = 0.0;
uniform float geom_y_tilt <
ui_type = "drag";
ui_min = -1.0;
ui_max = 1.0;
ui_step = 0.05;
ui_label = "Geom Vertical Tilt";
> = 0.0;
uniform float geom_overscan_x <
ui_type = "drag";
ui_min = -125.0;
ui_max = 125.0;
ui_step = 0.5;
ui_label = "Geom Horiz. Overscan %";
> = 100.0;
uniform float geom_overscan_y <
ui_type = "drag";
ui_min = -125.0;
ui_max = 125.0;
ui_step = 0.5;
ui_label = "Geom Vert. Overscan %";
> = 100.0;
uniform float centerx <
ui_type = "drag";
ui_min = -100.0;
ui_max = 100.0;
ui_step = 0.1;
ui_label = "Image Center X";
> = 0.00;
uniform float centery <
ui_type = "drag";
ui_min = -100.0;
ui_max = 100.0;
ui_step = 0.1;
ui_label = "Image Center Y";
> = 0.00;
uniform float geom_lum <
ui_type = "drag";
ui_min = 0.5;
ui_max = 2.0;
ui_step = 0.01;
ui_label = "Geom Luminance";
> = 1.0;
uniform float geom_target_gamma <
ui_type = "drag";
ui_min = 0.1;
ui_max = 5.0;
ui_step = 0.1;
ui_label = "Geom Target Gamma";
> = 2.4;
uniform float geom_monitor_gamma <
ui_type = "drag";
ui_min = 0.1;
ui_max = 5.0;
ui_step = 0.1;
ui_label = "Geom Monitor Gamma";
> = 2.2;
uniform float2 BufferToViewportRatio < source = "buffer_to_viewport_ratio"; >;
uniform float2 NormalizedNativePixelSize < source = "normalized_native_pixel_size"; >;
uniform float2 ViewportSize < source = "viewportsize"; >;
uniform float ViewportWidth < source = "viewportwidth"; >;
uniform float ViewportHeight < source = "viewportheight"; >;
sampler2D sBackBuffer{Texture=ReShade::BackBufferTex;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;};
// Comment the next line to disable interpolation in linear gamma (and
// gain speed).
#define LINEAR_PROCESSING
// Enable 3x oversampling of the beam profile; improves moire effect caused by scanlines+curvature
#define OVERSAMPLE
// Use the older, purely gaussian beam profile; uncomment for speed
//#define USEGAUSSIAN
// Macros.
#define FIX(c) max(abs(c), 1e-5);
#define PI 3.141592653589
#ifdef LINEAR_PROCESSING
# define TEX2D(c) pow(tex2D(sBackBuffer, (c)), geom_target_gamma.xxxx)
#else
# define TEX2D(c) tex2D(sBackBuffer, (c))
#endif
// aspect ratio
#define aspect (geom_invert_aspect==true?float2(ViewportHeight/ViewportWidth,1.0):float2(1.0,ViewportHeight/ViewportWidth))
#define overscan (1.01.xx);
struct ST_VertexOut
{
float2 sinangle : TEXCOORD1;
float2 cosangle : TEXCOORD2;
float3 stretch : TEXCOORD3;
float2 TextureSize : TEXCOORD4;
};
float intersect(float2 xy, float2 sinangle, float2 cosangle)
{
float A = dot(xy,xy) + geom_d*geom_d;
float B, C;
B = 2.0*(geom_R*(dot(xy,sinangle) - geom_d*cosangle.x*cosangle.y) - geom_d*geom_d);
C = geom_d*geom_d + 2.0*geom_R*geom_d*cosangle.x*cosangle.y;
return (-B-sqrt(B*B - 4.0*A*C))/(2.0*A);
}
float2 bkwtrans(float2 xy, float2 sinangle, float2 cosangle)
{
float c = intersect(xy, sinangle, cosangle);
float2 point = (c.xx*xy + geom_R.xx*sinangle) / geom_R.xx;
float2 poc = point/cosangle;
float2 tang = sinangle/cosangle;
float A = dot(tang, tang) + 1.0;
float B = -2.0*dot(poc, tang);
float C = dot(poc, poc) - 1.0;
float a = (-B + sqrt(B*B - 4.0*A*C)) / (2.0*A);
float2 uv = (point - a*sinangle) / cosangle;
float r = FIX(geom_R*acos(a));
return uv*r/sin(r/geom_R);
}
float2 fwtrans(float2 uv, float2 sinangle, float2 cosangle)
{
float r = FIX(sqrt(dot(uv, uv)));
uv *= sin(r/geom_R)/r;
float x = 1.0 - cos(r/geom_R);
float D;
D = geom_d/geom_R + x*cosangle.x*cosangle.y + dot(uv,sinangle);
return geom_d*(uv*cosangle - x*sinangle)/D;
}
float3 maxscale(float2 sinangle, float2 cosangle)
{
float2 c = bkwtrans(-geom_R * sinangle / (1.0 + geom_R/geom_d*cosangle.x*cosangle.y), sinangle, cosangle);
float2 a = 0.5.xx*aspect;
float2 lo = float2(fwtrans(float2(-a.x, c.y), sinangle, cosangle).x,
fwtrans(float2( c.x, -a.y), sinangle, cosangle).y)/aspect;
float2 hi = float2(fwtrans(float2(+a.x, c.y), sinangle, cosangle).x,
fwtrans(float2( c.x, +a.y), sinangle, cosangle).y)/aspect;
return float3((hi+lo)*aspect*0.5,max(hi.x-lo.x, hi.y-lo.y));
}
float2 transform(float2 coord, float2 sinangle, float2 cosangle, float3 stretch)
{
coord = (coord - 0.5.xx)*aspect*stretch.z + stretch.xy;
return (bkwtrans(coord, sinangle, cosangle) /
float2(geom_overscan_x / 100.0, geom_overscan_y / 100.0)/aspect + 0.5.xx);
}
// Vertex shader generating a triangle covering the entire screen
void VS_CRT_Geom(in uint id : SV_VertexID, out float4 position : SV_Position, out float2 texcoord : TEXCOORD, out ST_VertexOut vVARS)
{
texcoord.x = (id == 2) ? 2.0 : 0.0;
texcoord.y = (id == 1) ? 2.0 : 0.0;
position = float4(texcoord * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0);
// Screen centering
texcoord = texcoord - float2(centerx,centery)/100.0;
float2 SourceSize = 1.0/NormalizedNativePixelSize;
// Precalculate a bunch of useful values we'll need in the fragment
// shader.
vVARS.sinangle = sin(float2(geom_x_tilt, geom_y_tilt));
vVARS.cosangle = cos(float2(geom_x_tilt, geom_y_tilt));
vVARS.stretch = maxscale(vVARS.sinangle, vVARS.cosangle);
vVARS.TextureSize = float2(SourceSize.x, SourceSize.y);
}
float corner(float2 coord)
{
coord = min(coord, 1.0.xx - coord) * aspect;
float2 cdist = geom_cornersize.xx;
coord = (cdist - min(coord, cdist));
float dist = sqrt(dot(coord, coord));
return clamp((cdist.x - dist)*geom_cornersmooth, 0.0, 1.0);
}
float fwidth(float value)
{
return abs(ddx(value)) + abs(ddy(value));
}
float4 PS_CRT_Geom(float4 vpos: SV_Position, float2 vTexCoord : TEXCOORD, in ST_VertexOut vVARS) : SV_Target
{
// Texture coordinates of the texel containing the active pixel.
float2 xy = (geom_curvature == true) ? transform(vTexCoord, vVARS.sinangle, vVARS.cosangle, vVARS.stretch) : vTexCoord;
float cval = corner((xy-0.5.xx) * BufferToViewportRatio + 0.5.xx);
float2 uv_ratio = frac((xy * vVARS.TextureSize - 0.5.xx) / vVARS.TextureSize);
float4 col = TEX2D(xy);
#ifndef LINEAR_PROCESSING
col = pow(col, geom_target_gamma.xxxx);
#endif
col.rgb *= (geom_lum * step(0.0, uv_ratio.y));
float3 mul_res = col.rgb * cval.xxx;
// Convert the image gamma for display on our output device.
mul_res = pow(mul_res, 1.0 / geom_monitor_gamma.xxx);
return float4(mul_res, 1.0);
}
technique CRT_Geom
{
pass
{
VertexShader = VS_CRT_Geom;
PixelShader = PS_CRT_Geom;
}
}

View File

@ -1,224 +0,0 @@
#ifndef GEOM_PARAMS_H
#define GEOM_PARAMS_H
/*
Geom Shader - a modified CRT-Geom without CRT features made to be appended/integrated
into any other shaders and provide curvature/warping/oversampling features.
Adapted by Hyllian (2024).
*/
/*
CRT-interlaced
Copyright (C) 2010-2012 cgwg, Themaister and DOLLS
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
(cgwg gave their consent to have the original version of this shader
distributed under the GPL in this message:
http://board.byuu.org/viewtopic.php?p=26075#p26075
"Feel free to distribute my shaders under the GPL. After all, the
barrel distortion code was taken from the Curvature shader, which is
under the GPL."
)
This shader variant is pre-configured with screen curvature
*/
uniform bool geom_curvature <
ui_type = "radio";
ui_category = "Geom Curvature";
ui_label = "Geom Curvature Toggle";
> = 0.0;
uniform float geom_R <
ui_type = "drag";
ui_min = 0.1;
ui_max = 10.0;
ui_step = 0.1;
ui_category = "Geom Curvature";
ui_label = "Geom Curvature Radius";
> = 2.0;
uniform float geom_d <
ui_type = "drag";
ui_min = 0.1;
ui_max = 3.0;
ui_step = 0.1;
ui_category = "Geom Curvature";
ui_label = "Geom Distance";
> = 1.5;
uniform bool geom_invert_aspect <
ui_type = "radio";
ui_category = "Geom Curvature";
ui_label = "Geom Curvature Aspect Inversion";
> = 0.0;
uniform float geom_cornersize <
ui_type = "drag";
ui_min = 0.001;
ui_max = 1.0;
ui_step = 0.005;
ui_category = "Geom Curvature";
ui_label = "Geom Corner Size";
> = 0.03;
uniform float geom_cornersmooth <
ui_type = "drag";
ui_min = 80.0;
ui_max = 2000.0;
ui_step = 100.0;
ui_category = "Geom Curvature";
ui_label = "Geom Corner Smoothness";
> = 1000.0;
uniform float geom_x_tilt <
ui_type = "drag";
ui_min = -1.0;
ui_max = 1.0;
ui_step = 0.05;
ui_category = "Geom Curvature";
ui_label = "Geom Horizontal Tilt";
> = 0.0;
uniform float geom_y_tilt <
ui_type = "drag";
ui_min = -1.0;
ui_max = 1.0;
ui_step = 0.05;
ui_category = "Geom Curvature";
ui_label = "Geom Vertical Tilt";
> = 0.0;
uniform float geom_overscan_x <
ui_type = "drag";
ui_min = -125.0;
ui_max = 125.0;
ui_step = 0.5;
ui_category = "Geom Curvature";
ui_label = "Geom Horiz. Overscan %";
> = 100.0;
uniform float geom_overscan_y <
ui_type = "drag";
ui_min = -125.0;
ui_max = 125.0;
ui_step = 0.5;
ui_category = "Geom Curvature";
ui_label = "Geom Vert. Overscan %";
> = 100.0;
uniform float centerx <
ui_type = "drag";
ui_min = -100.0;
ui_max = 100.0;
ui_step = 0.1;
ui_category = "Geom Curvature";
ui_label = "Image Center X";
> = 0.00;
uniform float centery <
ui_type = "drag";
ui_min = -100.0;
ui_max = 100.0;
ui_step = 0.1;
ui_category = "Geom Curvature";
ui_label = "Image Center Y";
> = 0.00;
// Macros.
#define FIX(c) max(abs(c), 1e-5);
// aspect ratio
#define aspect (geom_invert_aspect==true?float2(ViewportHeight/ViewportWidth,1.0):float2(1.0,ViewportHeight/ViewportWidth))
float intersect(float2 xy, float2 sinangle, float2 cosangle)
{
float A = dot(xy,xy) + geom_d*geom_d;
float B, C;
B = 2.0*(geom_R*(dot(xy,sinangle) - geom_d*cosangle.x*cosangle.y) - geom_d*geom_d);
C = geom_d*geom_d + 2.0*geom_R*geom_d*cosangle.x*cosangle.y;
return (-B-sqrt(B*B - 4.0*A*C))/(2.0*A);
}
float2 bkwtrans(float2 xy, float2 sinangle, float2 cosangle)
{
float c = intersect(xy, sinangle, cosangle);
float2 point = (c.xx*xy + geom_R.xx*sinangle) / geom_R.xx;
float2 poc = point/cosangle;
float2 tang = sinangle/cosangle;
float A = dot(tang, tang) + 1.0;
float B = -2.0*dot(poc, tang);
float C = dot(poc, poc) - 1.0;
float a = (-B + sqrt(B*B - 4.0*A*C)) / (2.0*A);
float2 uv = (point - a*sinangle) / cosangle;
float r = FIX(geom_R*acos(a));
return uv*r/sin(r/geom_R);
}
float2 fwtrans(float2 uv, float2 sinangle, float2 cosangle)
{
float r = FIX(sqrt(dot(uv, uv)));
uv *= sin(r/geom_R)/r;
float x = 1.0 - cos(r/geom_R);
float D;
D = geom_d/geom_R + x*cosangle.x*cosangle.y + dot(uv,sinangle);
return geom_d*(uv*cosangle - x*sinangle)/D;
}
float3 maxscale(float2 sinangle, float2 cosangle)
{
float2 c = bkwtrans(-geom_R * sinangle / (1.0 + geom_R/geom_d*cosangle.x*cosangle.y), sinangle, cosangle);
float2 a = 0.5.xx*aspect;
float2 lo = float2(fwtrans(float2(-a.x, c.y), sinangle, cosangle).x,
fwtrans(float2( c.x, -a.y), sinangle, cosangle).y)/aspect;
float2 hi = float2(fwtrans(float2(+a.x, c.y), sinangle, cosangle).x,
fwtrans(float2( c.x, +a.y), sinangle, cosangle).y)/aspect;
return float3((hi+lo)*aspect*0.5,max(hi.x-lo.x, hi.y-lo.y));
}
float2 transform(float2 coord, float2 sinangle, float2 cosangle, float3 stretch)
{
coord = (coord - 0.5.xx)*aspect*stretch.z + stretch.xy;
return (bkwtrans(coord, sinangle, cosangle) /
float2(geom_overscan_x / 100.0, geom_overscan_y / 100.0)/aspect + 0.5.xx);
}
float corner(float2 coord)
{
coord = min(coord, 1.0.xx - coord) * aspect;
float2 cdist = geom_cornersize.xx;
coord = (cdist - min(coord, cdist));
float dist = sqrt(dot(coord, coord));
return clamp((cdist.x - dist)*geom_cornersmooth, 0.0, 1.0);
}
float fwidth(float value)
{
return abs(ddx(value)) + abs(ddy(value));
}
#endif // GEOM_PARAMS_H

View File

@ -1,242 +0,0 @@
#ifndef MASK_PARAMS_H
#define MASK_PARAMS_H
uniform float MASK_DARK_STRENGTH <
ui_type = "drag";
ui_min = 0.0;
ui_max = 1.0;
ui_step = 0.01;
ui_category = "CRT Mask";
ui_label = "MASK DARK SUBPIXEL STRENGTH";
> = 0.5;
uniform float MASK_LIGHT_STRENGTH <
ui_type = "drag";
ui_min = 0.0;
ui_max = 6.0;
ui_step = 0.01;
ui_category = "CRT Mask";
ui_label = "MASK LIGHT SUBPIXEL STRENGTH";
> = 0.5;
/* Mask code pasted from subpixel_masks.h. Masks 3 and 4 added. */
float3 mask_weights(float2 coord, int phosphor_layout, float monitor_subpixels, float mask_light_str, float mask_dark_str){
float3 weights = float3(1.,1.,1.);
float on = 1.+mask_light_str;
// float on = 1.;
float off = 1.-mask_dark_str;
float3 red = monitor_subpixels==1.0 ? float3(on, off, off) : float3(off, off, on );
float3 green = float3(off, on, off);
float3 blue = monitor_subpixels==1.0 ? float3(off, off, on ) : float3(on, off, off);
float3 magenta = float3(on, off, on );
float3 yellow = monitor_subpixels==1.0 ? float3(on, on, off) : float3(off, on, on );
float3 cyan = monitor_subpixels==1.0 ? float3(off, on, on ) : float3(on, on, off);
float3 black = float3(off, off, off);
float3 white = float3(on, on, on );
int w, z = 0;
// This pattern is used by a few layouts, so we'll define it here
float3 aperture_weights = lerp(magenta, green, floor(coord.x % 2.0));
if(phosphor_layout == 0) return weights;
else if(phosphor_layout == 1){
// classic aperture for RGB panels; good for 1080p, too small for 4K+
// aka aperture_1_2_bgr
weights = aperture_weights;
return weights;
}
else if(phosphor_layout == 2){
// Classic RGB layout; good for 1080p and lower
float3 bw3[3] = {red, green, blue};
// float3 bw3[3] = float3[](black, yellow, blue);
z = int(floor(coord.x % 3.0));
weights = bw3[z];
return weights;
}
else if(phosphor_layout == 3){
// black and white aperture; good for weird subpixel layouts and low brightness; good for 1080p and lower
float3 bw3[3] = {black, white, black};
z = int(floor(coord.x % 3.0));
weights = bw3[z];
return weights;
}
else if(phosphor_layout == 4){
// reduced TVL aperture for RGB panels. Good for 4k.
// aperture_2_4_rgb
float3 big_ap_rgb[4] = {red, yellow, cyan, blue};
w = int(floor(coord.x % 4.0));
weights = big_ap_rgb[w];
return weights;
}
else if(phosphor_layout == 5){
// black and white aperture; good for weird subpixel layouts and low brightness; good for 4k
float3 bw4[4] = {black, black, white, white};
z = int(floor(coord.x % 4.0));
weights = bw4[z];
return weights;
}
else if(phosphor_layout == 6){
// aperture_1_4_rgb; good for simulating lower
float3 ap4[4] = {red, green, blue, black};
z = int(floor(coord.x % 4.0));
weights = ap4[z];
return weights;
}
else if(phosphor_layout == 7){
// 2x2 shadow mask for RGB panels; good for 1080p, too small for 4K+
// aka delta_1_2x1_bgr
float3 inverse_aperture = lerp(green, magenta, floor(coord.x % 2.0));
weights = lerp(aperture_weights, inverse_aperture, floor(coord.y % 2.0));
return weights;
}
else if(phosphor_layout == 8){
// delta_2_4x1_rgb
float3 delta[8] = {
red, yellow, cyan, blue,
cyan, blue, red, yellow
};
w = int(floor(coord.y % 2.0));
z = int(floor(coord.x % 4.0));
weights = delta[4*w+z];
return weights;
}
else if(phosphor_layout == 9){
// delta_1_4x1_rgb; dunno why this is called 4x1 when it's obviously 4x2 /shrug
float3 delta1[8] = {
red, green, blue, black,
blue, black, red, green
};
w = int(floor(coord.y % 2.0));
z = int(floor(coord.x % 4.0));
weights = delta1[4*w+z];
return weights;
}
else if(phosphor_layout == 10){
// delta_2_4x2_rgb
float3 delta[16] = {
red, yellow, cyan, blue,
red, yellow, cyan, blue,
cyan, blue, red, yellow,
cyan, blue, red, yellow
};
w = int(floor(coord.y % 4.0));
z = int(floor(coord.x % 4.0));
weights = delta[4*w+z];
return weights;
}
else if(phosphor_layout == 11){
// slot mask for RGB panels; looks okay at 1080p, looks better at 4K
float3 slotmask[24] = {
red, green, blue, red, green, blue,
red, green, blue, black, black, black,
red, green, blue, red, green, blue,
black, black, black, red, green, blue,
};
w = int(floor(coord.y % 4.0));
z = int(floor(coord.x % 6.0));
// use the indexes to find which color to apply to the current pixel
weights = slotmask[6*w+z];
return weights;
}
else if(phosphor_layout == 12){
// slot mask for RGB panels; looks okay at 1080p, looks better at 4K
float3 slotmask[24] = {
black, white, black, black, white, black,
black, white, black, black, black, black,
black, white, black, black, white, black,
black, black, black, black, white, black
};
w = int(floor(coord.y % 4.0));
z = int(floor(coord.x % 6.0));
// use the indexes to find which color to apply to the current pixel
weights = slotmask[6*w+z];
return weights;
}
else if(phosphor_layout == 13){
// based on MajorPainInTheCactus' HDR slot mask
float3 slot[32] = {
red, green, blue, black, red, green, blue, black,
red, green, blue, black, black, black, black, black,
red, green, blue, black, red, green, blue, black,
black, black, black, black, red, green, blue, black
};
w = int(floor(coord.y % 4.0));
z = int(floor(coord.x % 8.0));
weights = slot[8*w+z];
return weights;
}
else if(phosphor_layout == 14){
// same as above but for RGB panels
float3 slot2[40] = {
red, yellow, green, blue, blue, red, yellow, green, blue, blue ,
black, green, green, blue, blue, red, red, black, black, black,
red, yellow, green, blue, blue, red, yellow, green, blue, blue ,
red, red, black, black, black, black, green, green, blue, blue
};
w = int(floor(coord.y % 4.0));
z = int(floor(coord.x % 10.0));
weights = slot2[10*w+z];
return weights;
}
else if(phosphor_layout == 15){
// slot_3_7x6_rgb
float3 slot[84] = {
red, red, yellow, green, cyan, blue, blue, red, red, yellow, green, cyan, blue, blue,
red, red, yellow, green, cyan, blue, blue, red, red, yellow, green, cyan, blue, blue,
red, red, yellow, green, cyan, blue, blue, black, black, black, black, black, black, black,
red, red, yellow, green, cyan, blue, blue, red, red, yellow, green, cyan, blue, blue,
red, red, yellow, green, cyan, blue, blue, red, red, yellow, green, cyan, blue, blue,
black, black, black, black, black, black, black, black, red, red, yellow, green, cyan, blue
};
w = int(floor(coord.y % 6.0));
z = int(floor(coord.x % 14.0));
weights = slot[14*w+z];
return weights;
}
else return weights;
}
#endif // MASK_PARAMS_H