fix image-adjustment and add option for always-on OSD in VCR shader

This commit is contained in:
hunterk 2016-12-06 16:24:04 -06:00
parent 9c99a6083c
commit 1f9f26397c
2 changed files with 8 additions and 4 deletions

View file

@ -76,7 +76,7 @@ vec3 sharp(sampler2D tex, vec2 texCoord){
f = f * f * f * (f * (f * 6.0 - vec2(15.0, 15.0)) + vec2(10.0, 10.0)); f = f * f * f * (f * (f * 6.0 - vec2(15.0, 15.0)) + vec2(10.0, 10.0));
p = i + f; p = i + f;
p = (p - vec2(0.5, 0.5)) * registers.SourceSize.zw; p = (p - vec2(0.5, 0.5)) * registers.SourceSize.zw;
return texture(tex, p); return texture(tex, p).rgb;
} }
#pragma stage vertex #pragma stage vertex

View file

@ -16,9 +16,11 @@ layout(push_constant) uniform Push
vec4 OutputSize; vec4 OutputSize;
uint FrameCount; uint FrameCount;
float magnitude; float magnitude;
float always_on;
} params; } params;
#pragma parameter magnitude "Distortion Magnitude" 0.9 0.0 25.0 0.1 #pragma parameter magnitude "Distortion Magnitude" 0.9 0.0 25.0 0.1
#pragma parameter always_on "OSD Always On" 0.0 0.0 1.0 1.0
#define framecount vec2(params.FrameCount, params.FrameCount).x #define framecount vec2(params.FrameCount, params.FrameCount).x
@ -132,8 +134,10 @@ float timer = vec2(params.FrameCount, params.FrameCount).x;
vec3 res = distort(Source, jumpy(vTexCoord), params.magnitude); vec3 res = distort(Source, jumpy(vTexCoord), params.magnitude);
float col = nn(-vTexCoord * params.SourceSize.y * 4.0); float col = nn(-vTexCoord * params.SourceSize.y * 4.0);
vec3 play = distort(overlay, jumpy(vTexCoord), params.magnitude); vec3 play = distort(overlay, jumpy(vTexCoord), params.magnitude);
float overlay_alpha = (mod(timer, 100.0) < 50.0) && (timer < 500.0) ? texture(overlay, jumpy(vTexCoord)).a : 0.0; float overlay_alpha = texture(overlay, jumpy(vTexCoord)).a;
res = mix(res, play, overlay_alpha); float show_overlay = (mod(timer, 100.0) < 50.0) && (timer < 500.0) ? texture(overlay, jumpy(vTexCoord)).a : 0.0;
show_overlay = clamp(show_overlay + params.always_on * overlay_alpha, 0.0, 1.0);
res = mix(res, play, show_overlay);
FragColor = vec4(res + clamp(vec3(col), 0.0, 0.5), 1.0); FragColor = vec4(res + clamp(vec3(col), 0.0, 0.5), 1.0);
} }