PDA

View Full Version : Any resource about "Cone Filter"?



LangFox
08-31-2009, 04:52 AM
Hi guys,

Can anybody introduce some articles/links/codes to do cone filter in shader? I know it samples pixels and weights them on distance, but without details.

ZbuffeR
08-31-2009, 01:14 PM
Found only this :
http://www.ph.tn.tudelft.nl/Courses/FIP/noframes/fip-Smoothin.html

the cone filter looks pretty simple : weight is max at the center, then decrease linearly with distance, down to zero.

implementation : like any other blur, take a number of samples around center, average according to weights.
look for any GLSL blur tutorial for this step.

However the advantage of the (better looking) gaussian blur is that it is 'separable'. You can filter in X direction as first pass, then Y direction in second pass. So for a 5 pixel wide blur, instead of doing 5x5=25 samples, it needs only 5 + 5 = 10 samples. Much faster for wide blur.


Do you have a good reason to use specifically a cone filter ?

LangFox
08-31-2009, 06:50 PM
Thanks.

I'm trying the inferred shading. The ppt says they use cone filter for better result than bilinear filter.

In inferred shading, the filter is used to test if each sample pixel is the same DSF id, not for blurring.

For now, I do 5x5 samples arround current pixel. The result is good, but fps suffers from heavy texture fetching.

Lighting without normal group id:
http://i724.photobucket.com/albums/ww246/LangFox/without_normal_group.jpg

Lighting with normal group id:
http://i724.photobucket.com/albums/ww246/LangFox/with_normal_group.jpg