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));
p = i + f;
p = (p - vec2(0.5, 0.5)) * registers.SourceSize.zw;
return texture(tex, p);
return texture(tex, p).rgb;
}
#pragma stage vertex

View file

@ -16,9 +16,11 @@ layout(push_constant) uniform Push
vec4 OutputSize;
uint FrameCount;
float magnitude;
float always_on;
} params;
#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
@ -132,8 +134,10 @@ float timer = vec2(params.FrameCount, params.FrameCount).x;
vec3 res = distort(Source, jumpy(vTexCoord), params.magnitude);
float col = nn(-vTexCoord * params.SourceSize.y * 4.0);
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;
res = mix(res, play, overlay_alpha);
float overlay_alpha = texture(overlay, jumpy(vTexCoord)).a;
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);
}