summaryrefslogtreecommitdiff
path: root/src/effects/shaders/thresholdmask.frag
blob: b979589b6b86b80fca40ae0e128d1e00b0a6fef2 (plain)
1
2
3
4
5
6
7
8
9
10
11
varying highp vec2 qt_TexCoord0;
uniform highp float qt_Opacity;
uniform lowp sampler2D source;
uniform lowp sampler2D maskSource;
uniform highp float threshold;
uniform highp float spread;
void main(void) {
    lowp vec4 colorFragment = texture2D(source, qt_TexCoord0.st);
    lowp vec4 maskFragment = texture2D(maskSource, qt_TexCoord0.st);
    gl_FragColor = colorFragment * smoothstep(threshold * (1.0 + spread) - spread, threshold * (1.0 + spread), maskFragment.a) * qt_Opacity;
}