X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=densify.frag;h=3bca126b2a458974cdeb5537771065ee480087fc;hp=f9c67ecea6c1b8000d63248de0976833813d395e;hb=3795723be95f2fe82f3c8b8b45b1a905b2c811fd;hpb=1ed10162dcc208c0f95da7f203f51be6ccea0900 diff --git a/densify.frag b/densify.frag index f9c67ec..3bca126 100644 --- a/densify.frag +++ b/densify.frag @@ -1,11 +1,12 @@ #version 450 core in vec2 image_pos; +flat in int image0_layer, image1_layer; flat in vec2 flow_du; flat in float mean_diff; out vec3 flow_contribution; -uniform sampler2D image0_tex, image1_tex; +uniform sampler2DArray image_tex; void main() { @@ -16,7 +17,7 @@ void main() // Note that equation (2) says 1 for the minimum error, but the code says 2.0. // And it says L2 norm, but really, the code does absolute value even for // L2 error norm (it uses a square root formula for L1 norm). - float diff = texture(image0_tex, image_pos).x - texture(image1_tex, image_pos + flow_du).x; + float diff = texture(image_tex, vec3(image_pos, image0_layer)).x - texture(image_tex, vec3(image_pos + flow_du, image1_layer)).x; diff -= mean_diff; float weight = 1.0 / max(abs(diff), 2.0 / 255.0); flow_contribution = vec3(flow_du.x * weight, flow_du.y * weight, weight);