mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-26 01:11:32 +11:00
various changes/additions (#384)
* Update crt-consumer.slangp * change default parameters * add mono display option & fix interlacing * fix interlacing
This commit is contained in:
parent
6c3249c63b
commit
7d64554c36
|
@ -1,6 +1,6 @@
|
|||
shaders = "1"
|
||||
shader0 = "shaders/crt-consumer.slang"
|
||||
filter_linear0 = "true"
|
||||
filter_linear0 = "false"
|
||||
wrap_mode0 = "clamp_to_border"
|
||||
mipmap_input0 = "false"
|
||||
alias0 = ""
|
||||
|
|
|
@ -8,38 +8,38 @@ layout(push_constant) uniform Push
|
|||
} params;
|
||||
|
||||
// Parameter lines go here:
|
||||
#pragma parameter blurx "Convergence X" 0.25 -4.0 4.0 0.05
|
||||
#pragma parameter blury "Convergence Y" -0.15 -4.0 4.0 0.05
|
||||
#pragma parameter blurx "Convergence X" 0.9 -4.0 4.0 0.05
|
||||
#pragma parameter blury "Convergence Y" 0.0 -4.0 4.0 0.05
|
||||
#pragma parameter warpx "Curvature X" 0.03 0.0 0.12 0.01
|
||||
#pragma parameter warpy "Curvature Y" 0.04 0.0 0.12 0.01
|
||||
#pragma parameter corner "Corner size" 0.01 0.0 0.10 0.01
|
||||
#pragma parameter smoothness "Border Smoothness" 400.0 25.0 600.0 5.0
|
||||
#pragma parameter scanlow "Beam low" 6.0 1.0 15.0 1.0
|
||||
#pragma parameter scanhigh "Beam high" 8.0 1.0 15.0 1.0
|
||||
#pragma parameter beamlow "Scanlines dark" 1.35 0.5 2.5 0.05
|
||||
#pragma parameter beamhigh "Scanlines bright" 1.05 0.5 2.5 0.05
|
||||
#pragma parameter brightboost1 "Bright boost dark pixels" 1.1 0.0 3.0 0.05
|
||||
#pragma parameter scanhigh "Beam high" 10.0 1.0 15.0 1.0
|
||||
#pragma parameter beamlow "Scanlines dark" 1.650.5 2.5 0.05
|
||||
#pragma parameter beamhigh "Scanlines bright" 1.25 0.5 2.5 0.05
|
||||
#pragma parameter brightboost1 "Bright boost dark pixels" 1.5 0.0 3.0 0.05
|
||||
#pragma parameter brightboost2 "Bright boost bright pixels" 1.05 0.0 3.0 0.05
|
||||
#pragma parameter Shadowmask "Mask Type" 7.0 -1.0 8.0 1.0
|
||||
#pragma parameter masksize "Mask Size" 1.0 1.0 2.0 1.0
|
||||
#pragma parameter MaskDark "Mask dark" 0.5 0.0 2.0 0.1
|
||||
#pragma parameter MaskDark "Mask dark" 0.3 0.0 2.0 0.1
|
||||
#pragma parameter MaskLight "Mask light" 1.5 0.0 2.0 0.1
|
||||
#pragma parameter slotmask "Slot Mask Strength" 0.0 0.0 1.0 0.05
|
||||
#pragma parameter slotwidth "Slot Mask Width" 2.0 1.0 6.0 0.5
|
||||
#pragma parameter double_slot "Slot Mask Height: 2x1 or 4x1" 1.0 1.0 2.0 1.0
|
||||
#pragma parameter slotms "Slot Mask Size" 1.0 1.0 2.0 1.0
|
||||
#pragma parameter GAMMA_IN "Gamma In" 2.5 0.0 4.0 0.1
|
||||
#pragma parameter GAMMA_IN "Gamma In" 2.6 0.0 4.0 0.1
|
||||
#pragma parameter GAMMA_OUT "Gamma Out" 2.2 0.0 4.0 0.1
|
||||
#pragma parameter postbr "Post Brightness" 1.3 0.0 2.5 0.02
|
||||
#pragma parameter glow "Glow Strength" 0.05 0.0 0.5 0.01
|
||||
#pragma parameter Size "Glow Size" 1.0 0.1 4.0 0.05
|
||||
#pragma parameter sat "Saturation" 1.1 0.0 2.0 0.05
|
||||
#pragma parameter sat "Saturation" 1.3 0.0 2.0 0.05
|
||||
#pragma parameter contrast "Contrast, 1.0:Off" 1.0 0.00 2.00 0.05
|
||||
#pragma parameter nois "Noise" 0.0 0.0 32.0 1.0
|
||||
#pragma parameter WP "Color Temperature %" 0.0 -100.0 100.0 5.0
|
||||
#pragma parameter nois "Noise" 8.0 0.0 32.0 1.0
|
||||
#pragma parameter WP "Color Temperature %" 30.0 -100.0 100.0 5.0
|
||||
#pragma parameter inter "Interlacing Toggle" 1.0 0.0 1.0 1.0
|
||||
#pragma parameter vignette "Vignette On/Off" 1.0 0.0 1.0 1.0
|
||||
#pragma parameter vpower "Vignette Power" 0.2 0.0 1.0 0.01
|
||||
#pragma parameter vpower "Vignette Power" 0.15 0.0 1.0 0.01
|
||||
#pragma parameter vstr "Vignette strength" 40.0 0.0 50.0 1.0
|
||||
#pragma parameter alloff "Switch off shader" 0.0 0.0 1.0 1.0
|
||||
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
|
||||
float brightboost;
|
||||
float sat;
|
||||
float glow;
|
||||
|
@ -46,6 +44,10 @@ layout(push_constant) uniform Push
|
|||
float warpY;
|
||||
float gamma_out;
|
||||
float vignette;
|
||||
float mono;
|
||||
float R;
|
||||
float G;
|
||||
float B;
|
||||
} params;
|
||||
|
||||
// Parameter lines go here:
|
||||
|
@ -105,7 +107,17 @@ layout(push_constant) uniform Push
|
|||
#pragma parameter vignette "Vignette On/Off" 0.0 0.0 1.0 1.0
|
||||
#define vignette params.vignette
|
||||
|
||||
#pragma parameter mono "Mono Display On/Off" 0.0 0.0 1.0 1.0
|
||||
#define mono params.mono
|
||||
|
||||
#pragma parameter R "Mono Red/Channel" 1.0 0.0 2.0 0.01
|
||||
#define R params.R
|
||||
|
||||
#pragma parameter G "Mono Green/Channel" 1.0 0.0 2.0 0.01
|
||||
#define G params.G
|
||||
|
||||
#pragma parameter B "Mono Blue/Channel" 1.0 0.0 2.0 0.01
|
||||
#define B params.B
|
||||
|
||||
|
||||
|
||||
|
@ -114,6 +126,8 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
|||
mat4 MVP;
|
||||
vec4 FinalViewportSize;
|
||||
vec4 OutputSize;
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
} global;
|
||||
|
||||
#pragma stage vertex
|
||||
|
@ -142,6 +156,18 @@ float sw(float x, float l)
|
|||
return d;
|
||||
}
|
||||
|
||||
vec3 toGrayscale(vec3 color)
|
||||
{
|
||||
float average = (color.r + color.g + color.b) / 3.0;
|
||||
return vec3(average);
|
||||
}
|
||||
|
||||
vec3 colorize(vec3 grayscale, vec3 color)
|
||||
{
|
||||
return (grayscale * color);
|
||||
}
|
||||
|
||||
|
||||
// Shadow mask (1-4 from PD CRT Lottes shader).
|
||||
vec3 Mask(vec2 pos, vec3 c)
|
||||
{
|
||||
|
@ -409,7 +435,7 @@ void main()
|
|||
vec2 pos = Warp(vTexCoord);
|
||||
|
||||
// HSM Added
|
||||
vec4 SourceSize = params.SourceSize;
|
||||
vec4 SourceSize = global.SourceSize;
|
||||
|
||||
vec2 ps = SourceSize.zw;
|
||||
vec2 OGL2Pos = pos * SourceSize.xy;
|
||||
|
@ -437,7 +463,11 @@ void main()
|
|||
float luma1 = length(color1)*0.57735;
|
||||
float luma2 = length(color2)*0.57735;
|
||||
|
||||
|
||||
vec3 color = color1*sw(f,luma1) + color2*sw(1.0-f,luma2);
|
||||
vec4 OriginalSize = global.OriginalSize;
|
||||
|
||||
if (OriginalSize.y >= 400.0) {color = (color1 + color2)/2.0;}
|
||||
|
||||
color = min(color, 1.0);
|
||||
color = color * Mask(vTexCoord * global.OutputSize.xy, color);
|
||||
|
@ -449,5 +479,16 @@ void main()
|
|||
|
||||
color = saturation(color);
|
||||
color*= vign(lum);
|
||||
|
||||
|
||||
if (mono == 1.0)
|
||||
{
|
||||
vec3 col1 = toGrayscale (color);
|
||||
vec3 c = vec3(R, G, B);
|
||||
color = colorize (col1, c);
|
||||
}
|
||||
|
||||
else color = color;
|
||||
|
||||
FragColor = vec4(color, 1.0);
|
||||
}
|
||||
|
|
|
@ -381,6 +381,7 @@ void main()
|
|||
float luma2 = length(color2)*0.57735;
|
||||
|
||||
vec3 color = color1*sw(f,luma1) + color2*sw(1.0-f,luma2);
|
||||
if (params.OriginalSize.y >= 400.0) {color = (color1 + color2)/2.0;}
|
||||
|
||||
color = min(color, 1.0);
|
||||
color = color * Mask(vTexCoord * global.OutputSize.xy, color);
|
||||
|
|
Loading…
Reference in a new issue