
[ 1 2 1]
[ 2 4 2]
[1 2 1] / 16
To get the filtered result, we can actually do it by 4 times of texture fetching with bilinear filter, which most of graphic cards support.
(
[ 0.25 0.25 0 ]
[ 0.25 0.25 0 ]
[ 0 0 0 ]
+
[ 0 0.25 0.25 ]
[ 0 0.25 0.25 ]
[ 0 0 0 ]
+
[ 0 0 0 ]
[ 0.25 0.25 0 ]
[ 0.25 0.25 0 ]
+
[ 0 0 0 ]
[ 0 0.25 0.25 ]
[ 0 0.25 0.25 ] ) /4
I haven't thought that I can use Gaussian filter at run-time. I wonder why I haven't heard from anybody else or any books. Did I just forget with getting older? :-)
It can be useful on blur or glow effects. It can also help alias problems.
By doing the same trick double times, we can get 5x5 Gaussian result. 5x5 Gaussian filter requires 25 pixel colors for each result pixel. With the trick, it takes only 8 times of texture fetching rather than 25 times. If the PS3 hardware Gaussian filter is fast enough, it will cost only two times of texture fetching.

2 comments:
The PS3 Hardware Gaussian filter works well. It excites me a lot!!
According to XBox360 document, "Both D3DTEXF_PYRAMIDALQUAD and D3DTEXF_GAUSSIANQUAD are unsupported on Xbox 360."
Post a Comment