add crt-potato-BVM (#400)

* add crt-potato-BVM
This commit is contained in:
metallic77 2023-04-22 18:13:11 +03:00 committed by GitHub
parent 277521abcb
commit c4a15d2c26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 0 deletions

19
crt/crt-potato-BVM.slangp Normal file
View file

@ -0,0 +1,19 @@
shaders = "1"
shader0 = shaders/crt-potato/shader-files/ultra_potato.slang
filter_linear0 = "false"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = "PASS0"
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
scale_type_x0 = "viewport"
scale_x0 = "1.000000"
scale_type_y0 = "viewport"
scale_y0 = "1.000000"
textures = "MASK"
MASK = shaders/crt-potato/resources/mask1.png
MASK_wrap_mode = "clamp_to_border"
MASK_linear = "true"
MASK_mipmap = "false"

Binary file not shown.

After

Width:  |  Height:  |  Size: 884 B

View file

@ -0,0 +1,57 @@
#version 450
// crt-potato mod by DariusG
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;
// Largest integer scale of input video that will fit in the current output (y axis would typically be limiting on widescreens)
#define video_scale floor(params.OutputSize.y * params.SourceSize.w)
#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 vec2 dot_size;
layout(location = 2) out vec2 one_texel;
void main()
{
gl_Position = global.MVP * Position;
vTexCoord = TexCoord;
dot_size = params.SourceSize.zw;
one_texel = 1.0 / (params.SourceSize.xy * video_scale);
}
#pragma stage fragment
layout(location = 0) in vec2 vTexCoord;
layout(location = 1) in vec2 dot_size;
layout(location = 2) in vec2 one_texel;
layout(location = 0) out vec4 FragColor;
layout(set = 0, binding = 2) uniform sampler2D Source;
layout(set = 0, binding = 3) uniform sampler2D MASK;
#define maskSize vec2(2., floor(params.OutputSize.y / params.SourceSize.y + 0.000001))
void main()
{
vec4 res =texture(Source, vTexCoord);
float lum = max((res.r,res.g),res.b);
lum = mix(1.0,0.3,lum);
vec4 mask = texture(MASK, fract((vTexCoord.xy * params.OutputSize.xy) / maskSize));
mask = pow(mask,vec4(lum));
res *= mix(1.0,1.2,lum);
vec4 color = mask * res;
FragColor = color;
}