I would like to apply a gaussian blur to my texture. Now, I can already hear you guys saying, “duh, use the image blur effect!” Well, first of all I don’t have Pro and second of all I want the actual pixels of the texture itself to be altered. I suspect this involves something like looping through all the pixels and changing each one based on its neighbors but my math background just isn’t strong enough for me to be able to figure this out myself. halp?
Blurring is usually implemented as a convolution, which is basically a weighted averaging of the neighbourhood of a pixel, repeated for all pixels - so you were on the right track ![]()
The weights used define what the convolution actually does. The matrix of weights used is called a convolution kernel. The simplest gaussian blur would have a kernel like this:
(1 2 1)
(2 4 2) * 1/16
(1 2 1)
The multiplication by 1/16 is just normalization, so that the weights sum up to 1, otherwise the convolution would darken or brighten the image.
If you want more blurring, you can do the blur repeatedly, but this is inefficient. Alternatively you can blur with a bigger kernel, then you will have to calculate the proper weights by sampling the gaussian function.