# How does directional Gaussian blurring work?

In image editing software, you often have the ability to do a directional blur where you can choose and angle and a magnitude of a blur.

How does this actually work in practice with Gaussian blurring?

I could see possibly doing something like making the blur go across the axis specified by the angle and use some sort of texture sampling to find the appropriate sample (bilinear or bicubic sampling), but that seems like it probably isn't correct.

How does directional blurring usually work?

I would say this is in fact motion blur, but I'm asking specifically about the blurring portion, not the whole set up for motion blur within a renderer.

For instance before and after:

(source: gimp.org)

• Is the directional blurring you are referring to motion blur? Commented Aug 15, 2015 at 20:14
• An example before and after image would help confirm what type of blur is being asked about. Commented Aug 15, 2015 at 20:14

If I understand your question, you are asking how to actually perform said directional blur in code? A Gaussian blur is typically done by sampling your image in all directions around your current point (or if in 2 passes, one vertical and one horizontal which equates to the same thing), with a specific set of weights for the falloff.

For a directional blur you just need to change the shape of your kernel to "not be round", for lack of better words.

Say you wanted to smear the image to the left only, you could just accumulate samples (with whatever weights you want) with

currentPixelUV.xy + float2( -1.f * someOffsetScale, 0.f) * invScreenRes.xy * currentIteration;


Bilinear texture filtering will be required for this to work when your resulting uvs are not hitting pixel centers.

The magnitude of the blur is controlled by how far you sample from your original pixel.

• BTW just to help future folk. Bicubic interpolation will give higher quality results than bilinear when taking samples, at a higher computational cost. Commented Aug 16, 2015 at 15:21