Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

It is possible to implement fragment shader to do one-pass gaussian blur? I have found lot of implementation of two-pass blur (gaussian and box blur):

and so on.

I have been thinking of implementing gaussian blur as convolution (in fact, it is the convolution, the examples above are just aproximations):

http://en.wikipedia.org/wiki/Gaussian_blur

share|improve this question
add comment

1 Answer

up vote 17 down vote accepted

Yes, you can implement Gaussian blur in one pass, by sampling all n^2 pixels in the kernel (for kernel width n). It's usually faster to run it on the rows and columns in two passes, since then you have O(n) pixels to sample rather than O(n^2). This is not an approximation, since Gaussian blur is mathematically separable.

share|improve this answer
    
Thank you, this is exactly what I needed to know. –  martin pilch Apr 3 '12 at 5:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.