Circular Blur Method

Okay…this made my head hurt. I definitely do not understand most of it.

cool idea. i’ve been doing some seperable blur graphics programming on my current project to make a highlighting system for various objects. I’m no genius and half of this shit is just nonsense to me. But what hes basically showing is, using multiple passes, how would you fake a circular blur kernel.

cool property of blurring that makes it affordable for realtime is that concept of “seperable”

so to do a simple big blur, find every pixel in a 200x200 window, add them all together, divide by the number of samples.

blur = 0
samples = 200
so, while x < samples ;
while y < samples
blur += getColor (uv + (samples - samples*.5) * width)

blur /= samples

… roughly…

so think about how crazy expensive that is. 200x200 loop in the fragment shader. would kill any gpu.

so a cool property of blurring is that you can blur something, then blur that, then blur that, then blur that… and the result is a really blurry image, but you used waaay fewer resources. Once you combine that with performing those blurs at ever lower and lower resolutions ( mips work for this really well), you can get big nice soft blurs for very little cost compared to the brute force method. Whats even cheaper is to seperate it in X and Y

blur horizontally
blur vertically
blur horizontally
blur vertically

even using 4 samples for each pass will get you a really lovely blur for very little cost. that is the meaning of “seperable”

downside is increased complexity and memory overhead to store the buffers to ping pong back and forth from.

but its pretty simple to do these kind of blurs.

now while your blurring, you can essentially apply a filter to the value of the pixel your adding to your accumulation to get different kind of effects. a “gaussian” blur is one of these filters. so its a little kernel thats kind of like… hey based on my distance from the origin, compute some weights based on a little formula. it can make things softer, or make things appear cool and different (or like circles). and this article is a look at how to compute a little function that would still make cirlces even if you did it horizontally, then vertically, then horizontally, then vertically


That helped me a lot in understanding what’s going on even if i have no eye towards programming it. :slight_smile: