6 uniform sampler2DArray image_tex;
7 uniform sampler2D flow_tex;
12 vec2 flow = texture(flow_tex, tc.xy).xy;
13 vec4 I_0 = texture(image_tex, vec3(tc.xy - alpha * flow, 0));
14 vec4 I_1 = texture(image_tex, vec3(tc.xy + (1.0f - alpha) * flow, 1));
16 // Occlusion reasoning:
18 vec2 size = textureSize(image_tex, 0).xy;
20 // Follow the flow back to the initial point (where we sample I_0 from), then forward again.
21 // See how well we match the point we started at, which is out flow consistency.
22 float d0 = alpha * length(size * (texture(flow_tex, vec2(tc.xy - alpha * flow)).xy - flow));
25 float d1 = (1.0f - alpha) * length(size * (texture(flow_tex, vec2(tc.xy + (1.0f - alpha) * flow)).xy - flow));
27 if (max(d0, d1) < 3.0f) { // Arbitrary constant, not all that tuned. The UW paper says 1.0 is fine for ground truth.
28 // Both are visible, so blend.
29 rgba = I_0 + alpha * (I_1 - I_0);