blob: 3ef11008adfb8f4fc831ac8cd8ba2b90e88ad6d3 (
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
|
/* ******************************************************************* */
/* Resolve Shadow pass */
/* ******************************************************************* */
uniform sampler2D strokeColor;
uniform sampler2D strokeDepth;
uniform sampler2D shadowColor;
uniform sampler2D shadowDepth;
out vec4 FragColor;
void main()
{
ivec2 uv = ivec2(gl_FragCoord.xy);
float stroke_depth = texelFetch(strokeDepth, uv.xy, 0).r;
float shadow_depth = texelFetch(shadowDepth, uv.xy, 0).r;
vec4 stroke_pixel = texelFetch(strokeColor, uv.xy, 0);
vec4 shadow_pixel = texelFetch(shadowColor, uv.xy, 0);
/* copy original pixel */
vec4 outcolor = stroke_pixel;
float outdepth = stroke_depth;
/* if stroke is not on top, copy shadow */
if ((stroke_pixel.a <= 0.2) && (shadow_pixel.a > 0.0)) {
outcolor = shadow_pixel;
outdepth = shadow_depth;
}
gl_FragDepth = outdepth;
FragColor = outcolor;
}
|