Implementing a Gaussian blur filter

In this recipe, we use the separability of the Gaussian blur convolution filter to apply a Gaussian blur in two passes for a vertical and horizontal Gaussian blur.

The Gaussian blur is used in many image processing and 3D graphics operations. The filter can be used to soften edges, apply blurring during depth of field operations, or for use within the Bloom lighting technique.

Getting ready

This recipe begins with the completed horizontal and vertical filter compute shaders and C# code to execute them from the Implementing box blur using separable convolution filters recipe.

How to do it…

By adjusting the kernel values, we can create a Gaussian blur filter. For each of the following kernels, the center weight (weight ...

Get Direct3D Rendering Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.