mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-23 00:01:31 +11:00
add fake-crt-geom-potato (#409)
* add fake-crt-geom-potato * add fake-crt-geom-potato * Update fake-crt-geom.slang Add cheap Color Temperature Control
This commit is contained in:
parent
a61e445a4d
commit
aaf83724d3
5
crt/fake-crt-geom-potato.slangp
Normal file
5
crt/fake-crt-geom-potato.slangp
Normal file
|
@ -0,0 +1,5 @@
|
|||
shaders = 1
|
||||
|
||||
shader0 = shaders/fake-crt-geom-potato.slang
|
||||
filter_linear0 = true
|
||||
scale_type0 = viewport
|
83
crt/shaders/fake-crt-geom-potato.slang
Normal file
83
crt/shaders/fake-crt-geom-potato.slang
Normal file
|
@ -0,0 +1,83 @@
|
|||
#version 450
|
||||
|
||||
// Simple scanlines with curvature and mask effects lifted from crt-geom
|
||||
// original by hunterk, edited by DariusG
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
float SCANLINE;
|
||||
float cgwg;
|
||||
float boost;
|
||||
} params;
|
||||
|
||||
// Parameter lines go here:
|
||||
|
||||
#pragma parameter boost "Bright boost " 1.00 1.00 2.00 0.02
|
||||
#define boost params.boost
|
||||
|
||||
#pragma parameter SCANLINE "Scanline Intensity" 0.30 0.0 1.0 0.05
|
||||
#define SCANLINE params.SCANLINE
|
||||
|
||||
#pragma parameter cgwg "CGWG mask brightness " 0.7 0.0 1.0 0.1
|
||||
#define cgwg params.cgwg
|
||||
|
||||
#define pi 3.141592654
|
||||
|
||||
layout(std140, set = 0, binding = 0) uniform UBO
|
||||
{
|
||||
mat4 MVP;
|
||||
} global;
|
||||
|
||||
#pragma stage vertex
|
||||
layout(location = 0) in vec4 Position;
|
||||
layout(location = 1) in vec2 TexCoord;
|
||||
layout(location = 0) out vec2 vTexCoord;
|
||||
layout(location = 1) out float omega;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = TexCoord * 1.0001;
|
||||
omega = pi * params.SourceSize.y * 2.0;
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 1) in float omega;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(set = 0, binding = 1) uniform sampler2D Source;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// CGWG mask calculation
|
||||
|
||||
vec3 Mask(float pos)
|
||||
{
|
||||
|
||||
float mf = fract(pos * 0.5);
|
||||
|
||||
if (mf <0.5) return vec3(1.0,cgwg,1.0);
|
||||
else return vec3(cgwg,1.0,cgwg);
|
||||
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 pos = vTexCoord.xy;
|
||||
vec3 res = texture(Source, pos).rgb;
|
||||
|
||||
if (params.OriginalSize.y < 400.0)
|
||||
res = res * (1.0 + SCANLINE * sin(pos.y * omega));
|
||||
else res;
|
||||
|
||||
// apply the mask
|
||||
res *= Mask(pos.x*params.OutputSize.x * 1.0001);
|
||||
res *= boost;
|
||||
|
||||
FragColor = vec4(res,1.0);
|
||||
}
|
|
@ -16,7 +16,9 @@ layout(push_constant) uniform Push
|
|||
float cgwg;
|
||||
float boost;
|
||||
float SHARPNESS;
|
||||
float SPEEDUP;
|
||||
float SPEEDUP;
|
||||
float WP;
|
||||
|
||||
} params;
|
||||
|
||||
// Parameter lines go here:
|
||||
|
@ -41,6 +43,9 @@ layout(push_constant) uniform Push
|
|||
#pragma parameter boost "Bright boost " 1.00 1.00 2.00 0.02
|
||||
#define boost params.boost
|
||||
|
||||
#pragma parameter WP "Color Temperature" 0.0 -0.25 0.25 0.01
|
||||
#define WP params.WP
|
||||
|
||||
#pragma parameter SPEEDUP "Speed-up. Warp,Gamma,Corner disabled" 0.0 0.0 1.0 1.0
|
||||
#define SPEEDUP params.SPEEDUP
|
||||
|
||||
|
@ -157,6 +162,7 @@ void main()
|
|||
vec3 color = scanline(pos.y, res);
|
||||
if (SPEEDUP == 0.0) color = pow( color, out_gamma); else color;
|
||||
if (SPEEDUP == 0.0 ) color = color*corner(tc);
|
||||
color.rgb *= vec3(1.0+WP,1.0,1.0-WP);
|
||||
|
||||
FragColor = vec4(color,1.0) ;
|
||||
|
||||
|
|
Loading…
Reference in a new issue