I've never tried blur until recently, and by that i've noticed fps drop when doing box blur. My fps will go down from 4000-5000 fps to 1000-1500 fps. Currently rendering at 853x480 frame buffer and window size.

Is this normal? Oh, and i'm only rendering a basic triangle. Here's the fragment shader code (pretty much the same from open.gl):

#version 150

in vec2 fTexCoord;

out vec4 finalColor;

uniform sampler2D tex;

const float blurSizeX = 1.0f / 853.0f;
const float blurSizeY = 1.0f / 480.0f;

void main() {
    vec4 col = vec4(0.0f);
    for (int y = -3; y < 4; y++) {
        for (int x = -3; x < 4; x++) {
            col += texture(tex, vec2(fTexCoord.x + x * blurSizeX, fTexCoord.y + y * blurSizeY)) / 49.0f;
    finalColor = col;

Thank you in advance.


1 Answer 1


Yes and no.
Yes, generally: the convolution operation is usually very computationally heavy and if you are sampling 7x7 area, that is 49 times more samples than you would usually do.

No, in your case: One important thing about FPS is that it is inverse of a function. Because with 5000 FPS the time to render a frame is 0.20 ms and with 1500 FPS it is 0.66 ms the assumption the blur will always take away 3500fps (flat) is wrong. The blur just took 0.46 ms extra, with 60fps(=16.66 ms) target it is less than 3% of frame time.

I am not sure if it is worth it for post-processing effect with small radius, because you would have to re-create the image every frame, but there is an optimization using integral images reducing it from O(n^2) to constant complexity(per pixel) but it is a two-pass partially serial algorithm and it could prove difficult to implement in shaders.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .