Alen Ladavac
2013-03-01 09:56:16 UTC
Hi all,
I was revisiting some of our old shader code (order 2, i.e. 9-coefficients) trying to fix ringing in some high contrast environments. I am looking at Stupid Spherical Harmonics (SH) Tricks by Peter-Pike Sloan, the section about Windowing.
The Lanczos and Han functions mentioned are of form:
sin(pi*x/w)/(x/w)
and
(1+cos(pi*x/w))/2
respectively, for a given filtering window of width "w". The rest of text, as far as I can see, seems to imply that w should be equal to the order of SH used. (w=6 for 6th order).
Initially, I would expecting filtering to be done by convolution in spatial domain, by projecting the filter function to the SH basis and then multiplying its y[l,0] coefficients into appropriate bands (y[l,m]) of the filtered function. However, all the other notions in there seem to point to this actually being done as multiplication in frequency domain. More specifically, as if the filtering function as presented here above _already is_ the frequency domain presentation. So it would just multiply of y(l,m) coefficients of the filtered function by values of the filter evaluated at integers.
This looks rather unusual to me, but I guess there is some reasoning behind all that.
As a side note, I got some ok-ish results with filtering in spatial domain (aka. bluring) using Han function as above (*) with value w=1.5 through convolution as described above. (Where the number w=1.5 was "tuned" by manual binary search with visual assessment of results to minimize visible ringing without introducing "too much" blur.) While on the other hand, using the multiplication directly in frequency domain looked way too blurry for w=3 and was ringing too much if I tried increasing the number (as with multiplication in the frequency domain wider "window" leads to less blur, while it opposite happens in the spatial domain.)
I would appreciate if anyone can shed a bit of light onto this.
Thanks a lot in advance,
Alen
(*) That form of the function does look strange for spatial domain but 1.5 is an arbitrary "hand-tuned" factor anyway.
I was revisiting some of our old shader code (order 2, i.e. 9-coefficients) trying to fix ringing in some high contrast environments. I am looking at Stupid Spherical Harmonics (SH) Tricks by Peter-Pike Sloan, the section about Windowing.
The Lanczos and Han functions mentioned are of form:
sin(pi*x/w)/(x/w)
and
(1+cos(pi*x/w))/2
respectively, for a given filtering window of width "w". The rest of text, as far as I can see, seems to imply that w should be equal to the order of SH used. (w=6 for 6th order).
Initially, I would expecting filtering to be done by convolution in spatial domain, by projecting the filter function to the SH basis and then multiplying its y[l,0] coefficients into appropriate bands (y[l,m]) of the filtered function. However, all the other notions in there seem to point to this actually being done as multiplication in frequency domain. More specifically, as if the filtering function as presented here above _already is_ the frequency domain presentation. So it would just multiply of y(l,m) coefficients of the filtered function by values of the filter evaluated at integers.
This looks rather unusual to me, but I guess there is some reasoning behind all that.
As a side note, I got some ok-ish results with filtering in spatial domain (aka. bluring) using Han function as above (*) with value w=1.5 through convolution as described above. (Where the number w=1.5 was "tuned" by manual binary search with visual assessment of results to minimize visible ringing without introducing "too much" blur.) While on the other hand, using the multiplication directly in frequency domain looked way too blurry for w=3 and was ringing too much if I tried increasing the number (as with multiplication in the frequency domain wider "window" leads to less blur, while it opposite happens in the spatial domain.)
I would appreciate if anyone can shed a bit of light onto this.
Thanks a lot in advance,
Alen
(*) That form of the function does look strange for spatial domain but 1.5 is an arbitrary "hand-tuned" factor anyway.