blob: 010c4ef4a881dd8544051d3e77b92b0f35cbafb9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/* ******************************************************************* */
/* Resolve GLOW pass */
/* ******************************************************************* */
uniform sampler2D strokeColor;
uniform sampler2D strokeDepth;
uniform sampler2D glowColor;
uniform sampler2D glowDepth;
uniform int alpha_mode;
out vec4 FragColor;
void main()
{
vec4 outcolor;
ivec2 uv = ivec2(gl_FragCoord.xy);
float stroke_depth = texelFetch(strokeDepth, uv.xy, 0).r;
vec4 src_pixel= texelFetch(strokeColor, uv.xy, 0);
vec4 glow_pixel= texelFetch(glowColor, uv.xy, 0);
float glow_depth = texelFetch(glowDepth, uv.xy, 0).r;
if (alpha_mode == 0) {
outcolor = src_pixel + glow_pixel;
}
else {
if ((src_pixel.a < 0.1) || (glow_pixel.a < 0.1)) {
outcolor = src_pixel + glow_pixel;
}
else {
outcolor = src_pixel;
}
}
if (src_pixel.a < glow_pixel.a) {
gl_FragDepth = glow_depth;
}
else {
gl_FragDepth = stroke_depth;
}
if (outcolor.a < 0.001) {
discard;
}
FragColor = outcolor;
}
|