Merge pull request #107 from yo6snap/master

New shader based on Sony CRT TV KV-M1420B
This commit is contained in:
hizzlekizzle 2019-06-19 19:28:16 -05:00 committed by GitHub
commit 24f3e6d6c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 139 additions and 0 deletions

View 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

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

View 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);
}

View 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);
}