I want to average/blur pixels of a texture in an n*n square. For this purpose I have one shader for horizontal and one for vertical averaging. My question is how profitable using a single pass becomes when n is small.
For example, when n is 4, I can do everything in one pass with 4 samples (by sampling on shared corners of pixels with GL_LINEAR
, getting a free equally weighted average) instead of in two passes with 2 samples each.
If n was 10, it would be obvious to go for two passes with 5 samples each, totalling 10, rather than one pass with 25 samples.
But how about i.e. n of 6? This would be 2*3=6 samples in two passes, or 9 samples in one pass. Is there a rule of thumb of how additional sampling balances out against the flat cost of doing an additional render to texture?