
180 III Image Space
1.2.2 Blur Passes
The two blur passes are similar to one another. Each reads a fixed-length set of
adjacent samples, either horizontal or vertical, and computes two weighted sums.
The key outer loop section of the code is shown below.
// Accumulates the blurry image color
blurResult.rgb = float3 (0.0 f);
float blurWeightSum = 0.0f;
// Accumulates the near - field color and coverage
nearResult = float4 (0.0 f);
float nearWeightSum = 0.0f;
// Location of the central filter tap (i .e., "this" pixel ’s location )
// Account for the scaling down by 50% during blur
int2 A = int2 (gl_FragCoord.xy) * (direction + ivec2 (1));
float packedA = texelFetch( ...