Files
loop/shader/fullscreen/transparencyComp.frag
T

19 lines
568 B
GLSL

#version 450 core
in vec2 vTexPos;
out vec4 fColor;
layout(binding = 0) uniform sampler2D t0;
layout(binding = 1) uniform sampler2D t1;
layout(binding = 2) uniform sampler2D t2;
layout(binding = 3) uniform sampler2D t3;
vec4 blend (vec4 src, vec4 dst) {
return src + (1-src.a) * dst;
}
void main() {
//fColor = texture(t0, vTexPos) + texture(t2, vTexPos);
vec4 x = texture(t0, vTexPos);
float xz = texture(t1, vTexPos).z;
vec4 y = texture(t2, vTexPos);
float yz = texture(t3, vTexPos).z;
fColor = ( xz > yz ? blend(x,y) : blend(y,x)) ;
}