<p>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.</p>

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

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

<pre><code>currentPixelUV.xy + float2( -1.f * someOffsetScale, 0.f) * invScreenRes.xy * currentIteration;
</code></pre>

<p>Bilinear texture filtering will be required for this to work when your resulting <em>uv</em>s are not hitting pixel centers.</p>

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

CC BY-SA 3.0
2015-08-16T15:21:07.823Z
BTW just to help future folk. Bicubic interpolation will give higher quality results than bilinear when taking samples, at a higher computational cost.
Alan Wolfe
CC BY-SA 3.0
2015-08-16T10:57:32.917Z
2015-08-16T12:54:36.177Z
2015-08-16T12:54:36.177Z
Fred Richardson
<p>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.</p>
<p>How does this actually work in practice with Gaussian blurring?</p>
<p>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.</p>
<p>How does directional blurring usually work?</p>
<p>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.</p>
<p>For instance before and after:</p>
<p><img src="https://docs.gimp.org/en_GB/images/filters/examples/taj_orig.jpg" alt="enter image description here" />
<a href="https://i.sstatic.net/KWH12.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/KWH12.jpg" alt="enter image description here" /></a><br />
<sub>(source: <a href="https://docs.gimp.org/en_GB/images/filters/examples/blur-taj-mblur-linear.jpg" rel="nofollow noreferrer">gimp.org</a>)</sub></p>

CC BY-SA 3.0
2015-08-15T20:14:08.747Z
Is the directional blurring you are referring to motion blur?
trichoplax is on Codidact now
CC BY-SA 3.0
2015-08-15T20:14:44.000Z
An example before and after image would help confirm what type of blur is being asked about.
trichoplax is on Codidact now
<real-time><post-processing><gaussian-blur><blur>
How does directional Gaussian blurring work?
Alan Wolfe
# How does directional Gaussian blurring work?

(Asked by: username_0 on 2015-08-15)

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:

![enter image description here](https://docs.gimp.org/en_GB/images/filters/examples/taj_orig.jpg)
[![enter image description here](https://i.sstatic.net/KWH12.jpg)](https://i.sstatic.net/KWH12.jpg)  
(source: [gimp.org](https://docs.gimp.org/en_GB/images/filters/examples/blur-taj-mblur-linear.jpg))

**Tags:** real-time, post-processing, gaussian-blur, blur

> **Comments:**
> **username_1**: Is the directional blurring you are referring to motion blur?  
> **username_1**: An example before and after image would help confirm what type of blur is being asked about.  

---

## 1 answers

### Answer by username_2 on 2015-08-16. Score: 5 | Accepted answer

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 *uv*s are not hitting pixel centers.

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

> **Comments:**
> **username_0**: BTW just to help future folk. Bicubic interpolation will give higher quality results than bilinear when taking samples, at a higher computational cost.  

---

