Anti-Aliasing question

zhugel_007

Newcomer
Hi,

I am currently working on a full screen effect. I basically render the effect into a texture, than draw a full screen quad with this effect texture on it.

Since memory wise, it is pretty heavy, I was thinking to optimize it by using half resolution render target. (I was using screen's resolution before.) But i am facing the aliasing problem now. :( I have tried simply blur the texture: use the average value of the adjacent texels while sampling the texture. The result still looks ugly.

My question is: what is the general&best way of solving this kind of aliasing problem?

Thanks!
 
I think that there aren't other ways to solve this than gaussian blur - so you have to check if it's faster to use gaussian blur, or using bigger resolution. And then use the faster;)
 
thanks for your reply Vilem. :)
I was using 5x5 gaussian filter which looks really nice but insanely slow. :(
I guess i will leave it with 3x3 gaussian... :p
 
Thanks Anteru for reminding me this.

I have thought about this, but I actually didn't quite understand it. I have to render twice to take the advantage of gaussian's separable property, right? Wouldn't it be slower than just one pass?
 
No. The overhead of doing an additional pass is much less than the cost of performing the gaussian blur. If you do it in one pass, you have to perform W*H number of lookups per pixel. If you do it in 2 passes, you only need to perform W+H number of lookups per pixel. That's a massive saving, especially if you have a large kernel.
 
gaussian is separable, so you can first blur in x, then in y, which is quite a bit faster.
You can allegedly also get a pretty good approximation to a gaussian using a few box filters - but I've not tried it myself.
 
I've tried some 2x2 box filters,but it doesn't look good. :(
By the way, I've tried using 2 passes (horizontal&vertical) instead of one pass, it is faster.
Thanks guys! :)
 
I don't think anything hierarchical is actually required. You should just be able to apply multiple box filters repeatedly to the image. After a few passes, it'll approximate a gaussian blur quite well.

But the difference in processing power between a gaussian and box blur is very little. In a box blur, you sample the pixels along a line and then simply average them. In a gaussian blur, you sample the pixels along the line and apply a weighted average (as you should always precompute the gaussian kernel to get the sample weights).

The difference between the two is something like a single multiply per sample - which isn't very much. The cost of performing multiple passes may negate the small performance benefit.
 
I agree with Sc4freak. I think I won't get much benefit from multiple pass box filters unless there are some other tricks there. :)
 
Thanks for the link, Simon F. :)
It seems the rolling box filter is a Cuda specific implementation. :(
But still, really good document for image processing. :)
 
Back
Top