blob: 1805cb5a7f509d512dc932aa6e48db6f62576b19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#pragma BLENDER_REQUIRE(gpu_shader_compositor_texture_utilities.glsl)
void main()
{
ivec2 texel = ivec2(gl_GlobalInvocationID.xy);
ivec2 input_size = texture_size(input_tx);
/* Add 0.5 to evaluate the input sampler at the center of the pixel. */
vec2 coordinates = vec2(texel) + vec2(0.5);
/* For each iteration, accumulate the input at the normalize coordinates, hence the divide by
* input size, then transform the coordinates for the next iteration. */
vec4 accumulated_color = vec4(0.0);
for (int i = 0; i < iterations; i++) {
accumulated_color += texture(input_tx, coordinates / input_size);
coordinates = (mat3(inverse_transformation) * vec3(coordinates, 1.0)).xy;
}
/* Write the accumulated color divided by the number of iterations. */
imageStore(output_img, texel, accumulated_color / iterations);
}
|