Jump to content
  • Advertisement
Sign in to follow this  

Spherical Harmonics comparison

This topic is 2759 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I'd like to know if there is a correct way to compare 2 spherical harmonics: I have a set of SH (3rd order = 9 coefs) and - for a given SH - I'd like to find out which SH in the set are "similar" to the given one.

I did a basic L2 distance on coefs set but it is obviously not correct, and I have no idea of which value my threshold should have.

I guess there's already smart solution for this problem but my friend google doesn't know where to look.

Any suggestions ?

Share this post

Link to post
Share on other sites
You could take the difference between the coefficients of the two, then integrate over the sphere with these new coefficients, but using the absolute value of the function, to get the L1 distance. To integrate I'd say probably just do a basic Monte Carlo integration by having a set of a few dozen or so points on the unit sphere that you can plug into the resulting difference SH function. This should work because the L1 distance between two functions is something like

[eqn]\iint_S | \hat{f}(s) - \hat{g}(s) | ds[/eqn]

where [eqn]\hat{f}(s) = \sum_{i} c_i y_i(s)[/eqn] and [eqn]\hat{g}(s) = \sum_{i} d_i y_i(s)[/eqn]

[eqn]\Rightarrow \hat{f}(s) - \hat{g}(s) = \sum_{i}(c_i - d_i) y_i(s)[/eqn]

Here, c and d are your coefficients, and the y's are the SH basis functions. So a Monte Carlo integration would be something like

[eqn]\frac{1}{N} \sum_{j}^{N} |\sum_{i}(c_i - d_i) y_i(x_j)| w(x_j)[/eqn]

for a set of N points (uniformly distributed) on the unit sphere. Here w(x) is a weight function, which would be equal to 4pi if you use a uniform distribution on the sphere.

You could also replace taking the absolute value with an L2 norm to get the L2 distance. I think I got all that right... hope that helps.


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!