mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-26 01:11:32 +11:00
Merge pull request #107 from yo6snap/master
New shader based on Sony CRT TV KV-M1420B
This commit is contained in:
commit
24f3e6d6c8
27
crt/crt-yo6-KV-M1420B-sharp.slangp
Normal file
27
crt/crt-yo6-KV-M1420B-sharp.slangp
Normal file
|
@ -0,0 +1,27 @@
|
|||
shaders = 3
|
||||
|
||||
shader0 = "shaders/crt-yo6/crt-yo6-native-resolution.slang"
|
||||
filter_linear0 = true
|
||||
wrap_mode0 = "clamp_to_edge"
|
||||
scale_type0 = "absolute"
|
||||
scale_x0 = 439
|
||||
scale_y0 = 233
|
||||
|
||||
shader1 = "shaders/crt-yo6/crt-yo6-warp.slang"
|
||||
filter_linear1 = true
|
||||
wrap_mode1 = "clamp_to_edge"
|
||||
scale_type1 = "absolute"
|
||||
scale_x1 = 1684
|
||||
scale_y1 = 1329
|
||||
|
||||
shader2 = "../windowed/shaders/jinc2.slang"
|
||||
filter_linear2 = false
|
||||
|
||||
textures = TEX_CRT
|
||||
TEX_CRT = "shaders/crt-yo6/KV-M1420B.png"
|
||||
TEX_CRT_linear = false
|
||||
|
||||
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
|
||||
JINC2_WINDOW_SINC = 0.44
|
||||
JINC2_SINC = 0.82
|
||||
JINC2_AR_STRENGTH = 0.5
|
27
crt/crt-yo6-KV-M1420B.slangp
Normal file
27
crt/crt-yo6-KV-M1420B.slangp
Normal file
|
@ -0,0 +1,27 @@
|
|||
shaders = 3
|
||||
|
||||
shader0 = "shaders/crt-yo6/crt-yo6-native-resolution.slang"
|
||||
filter_linear0 = true
|
||||
wrap_mode0 = "clamp_to_edge"
|
||||
scale_type0 = "absolute"
|
||||
scale_x0 = 439
|
||||
scale_y0 = 233
|
||||
|
||||
shader1 = "shaders/crt-yo6/crt-yo6-warp.slang"
|
||||
filter_linear1 = true
|
||||
wrap_mode1 = "clamp_to_edge"
|
||||
scale_type1 = "absolute"
|
||||
scale_x1 = 1684
|
||||
scale_y1 = 1329
|
||||
|
||||
shader2 = "../windowed/shaders/jinc2.slang"
|
||||
filter_linear2 = false
|
||||
|
||||
textures = TEX_CRT
|
||||
TEX_CRT = "shaders/crt-yo6/KV-M1420B.png"
|
||||
TEX_CRT_linear = false
|
||||
|
||||
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
|
||||
JINC2_WINDOW_SINC = 0.44
|
||||
JINC2_SINC = 0.40
|
||||
JINC2_AR_STRENGTH = 0.0
|
BIN
crt/shaders/crt-yo6/KV-M1420B.png
Normal file
BIN
crt/shaders/crt-yo6/KV-M1420B.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 MiB |
42
crt/shaders/crt-yo6/crt-yo6-native-resolution.slang
Normal file
42
crt/shaders/crt-yo6/crt-yo6-native-resolution.slang
Normal file
|
@ -0,0 +1,42 @@
|
|||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
} params;
|
||||
|
||||
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 float vU;
|
||||
layout(location = 1) out float vY;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vU = TexCoord.x;
|
||||
vY = (TexCoord.y * params.OutputSize.y) -
|
||||
round((params.OutputSize.y - params.SourceSize.y) / 2.0);
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in float vU;
|
||||
layout(location = 1) in float vY;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||
|
||||
void main()
|
||||
{
|
||||
float clip0 = (sign(vY) + 1.0) / 2.0;
|
||||
float clipH = (sign(params.SourceSize.y - vY) + 1.0) / 2.0;
|
||||
vec3 col = texture(Source, vec2(vU, vY / params.SourceSize.y)).rgb;
|
||||
FragColor = vec4(clip0 * clipH * col, 1.0);
|
||||
}
|
43
crt/shaders/crt-yo6/crt-yo6-warp.slang
Normal file
43
crt/shaders/crt-yo6/crt-yo6-warp.slang
Normal file
|
@ -0,0 +1,43 @@
|
|||
#version 450
|
||||
|
||||
layout(push_constant) uniform Push
|
||||
{
|
||||
vec4 SourceSize;
|
||||
vec4 OriginalSize;
|
||||
vec4 OutputSize;
|
||||
uint FrameCount;
|
||||
} params;
|
||||
|
||||
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;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = global.MVP * Position;
|
||||
vTexCoord = TexCoord;
|
||||
}
|
||||
|
||||
#pragma stage fragment
|
||||
layout(location = 0) in vec2 vTexCoord;
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
layout(set = 0, binding = 2) uniform sampler2D Source;
|
||||
layout(set = 0, binding = 3) uniform sampler2D TEX_CRT;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
const vec3 packed = texture(TEX_CRT, vTexCoord).rgb;
|
||||
|
||||
const vec2 dudv = ((packed.rg * 255.0) / 16.0) - 7.0;
|
||||
const vec2 uv0 = vTexCoord * params.SourceSize.xy;
|
||||
const vec2 uv = (uv0 + dudv) / params.SourceSize.xy;
|
||||
|
||||
FragColor = vec4(packed.b * texture(Source, uv).rgb, 1.0);
|
||||
}
|
Loading…
Reference in a new issue