summaryrefslogtreecommitdiff
path: root/src/effects/shaders/+glslcore/thresholdmask.frag
blob: 5b331d8624363c58e4b2eafbdf9c0a945fc00a1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#version 150 core
in vec2 qt_TexCoord0;
uniform float qt_Opacity;
uniform sampler2D source;
uniform sampler2D maskSource;
uniform float threshold;
uniform float spread;
out vec4 fragColor;

void main(void) {
    vec4 colorFragment = texture(source, qt_TexCoord0.st);
    vec4 maskFragment = texture(maskSource, qt_TexCoord0.st);
    fragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity;
}