Detecting edges with the Sobel edge-detection filter
In this recipe we will implement a single pass 3x3 Sobel convolution filter. This is the first convolution filter we will look at that does not implement a simple "sum of products" calculation as well as not being separable.
To keep things simple, this implementation has not undergone the same level of optimization as the separable convolution filter compute shaders; however, it would be a fairly simple task to modify it to work with the group-shared memory approach.
Getting ready
This recipe makes use of the constant buffer and the lerpKeepAlpha
function that we implemented in the Adjusting the contrast and brightness recipe.
You will also use the LUMINANCE
#define
macro we created in the Running ...
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.