## Re: [Algorithms] Spherical Harmonic Filtering

 Re: [Algorithms] Spherical Harmonic Filtering From: Jon Watte - 2013-04-30 16:34:53 Attachments: Message as HTML ```This is a little late, but better late than never :-) Did you get a reasonable solution? Do you have any images to show? The way I understand it, those functions are both spatial domain functions. The first one is the "sinc()" function, and the second one is the "cosine window" function from sampling theory. Also, when you use the sinc function, you typically want to either cut off at a zero crossing (multiple of pi) or further window the sinc() function, typically with a cosine window. Finally, to adjust the cosine window, you can raise it to some power for a trade-off between "preserving detail" and "removing aliasing"; known as a "raised cosine window function." Sincerely, jw Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 On Fri, Mar 1, 2013 at 1:56 AM, Alen Ladavac wrote: > 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. > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > GDAlgorithms-list mailing list > GDAlgorithms-list@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > ```

 [Algorithms] Spherical Harmonic Filtering From: Alen Ladavac - 2013-03-01 20:47:16 ```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. ```
 Re: [Algorithms] Spherical Harmonic Filtering From: Jon Watte - 2013-04-30 16:34:53 Attachments: Message as HTML ```This is a little late, but better late than never :-) Did you get a reasonable solution? Do you have any images to show? The way I understand it, those functions are both spatial domain functions. The first one is the "sinc()" function, and the second one is the "cosine window" function from sampling theory. Also, when you use the sinc function, you typically want to either cut off at a zero crossing (multiple of pi) or further window the sinc() function, typically with a cosine window. Finally, to adjust the cosine window, you can raise it to some power for a trade-off between "preserving detail" and "removing aliasing"; known as a "raised cosine window function." Sincerely, jw Sincerely, Jon Watte -- "I pledge allegiance to the flag of the United States of America, and to the republic for which it stands, one nation indivisible, with liberty and justice for all." ~ Adopted by U.S. Congress, June 22, 1942 On Fri, Mar 1, 2013 at 1:56 AM, Alen Ladavac wrote: > 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. > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb > _______________________________________________ > GDAlgorithms-list mailing list > GDAlgorithms-list@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > ```