mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-22 15:51:30 +11:00
fix image-adjustment and add option for always-on OSD in VCR shader
This commit is contained in:
parent
9c99a6083c
commit
1f9f26397c
|
@ -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
|
||||||
|
@ -127,4 +127,4 @@ else
|
||||||
conColor = vec3(0.0);
|
conColor = vec3(0.0);
|
||||||
|
|
||||||
FragColor = vec4(conColor, 1.0);
|
FragColor = vec4(conColor, 1.0);
|
||||||
}
|
}
|
|
@ -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);
|
||||||
}
|
}
|
Loading…
Reference in a new issue