I'm curious why spherical harmonics are commonly used in real time graphics instead of a spherical Fourier transform.

I get that spherical harmonics are in a sort of frequency space (like FT is) so you can do convolution very efficiently.

I also get that SH is an approximation of a function on a sphere, using up to an infinite series to perfectly reconstruct the original data, but often using only the first few items in the series.

This sounds a lot like a spherical Fourier transform, but the math uses different functions entirely.

What is the benefit of the SH representation over spherical FT?

  • $\begingroup$ Can you clarify what you mean by a "spherical Fourier transform"? I googled, but didn't turn up anything that sounds like it would match this question. $\endgroup$ – Nathan Reed Oct 27 '16 at 4:24
  • $\begingroup$ I'm thinking like taking a unit sphere, breaking it into the two angles that parameterize it, so you have a 2d function, then using 2d DFT on that. $\endgroup$ – Alan Wolfe Oct 27 '16 at 4:30
  • $\begingroup$ Related: math.stackexchange.com/questions/17479/… $\endgroup$ – Alan Wolfe Oct 27 '16 at 5:39

Spherical harmonics really are the "spherical Fourier transform" you're looking for. The kind of hack you mention in comments, of doing a 2D Fourier transform on a lat-long projection, suffers from all the problems you usually have when you try to project a sphere onto a plane: not all spatial relations in the sphere are well-represented in the plane. If you take stretching at the poles as an example, that clearly results in a frequency shift. High-frequency components in the sphere get shifted down to low frequencies in the plane, and when you do the inverse transform, any inaccuracy shows up as high-frequency components at the pole.

Such a transform is useless for analysing the spectrum of the original signal, because it distorts the frequencies (and distorts them differently in different parts of the sphere). It's also poor for representation, because of the introduction of these high-frequency artefacts.

Spherical harmonics use different basis functions so they can work directly on the lat-long without treating it like a plane. If you plot the response of the spherical harmonics on a plane projection of the sphere, they look kooky (like a map of the earth does), but they look much more natural on a sphere. They don't suffer from artefacts at the poles, and they don't frequency-shift signals. They're also rotation-invariant, so it doesn't even matter where you put the poles. They don't even have poles, in the sense of discontinuities, which is a property you can't achieve from a plane projection however many ad hoc co-ordinate transforms you do. Rotation-invariance is useful for applications like environment maps, where you'd like to rotate the spherical-harmonic transform of the environment (light probe, or whatever) into the local co-ordinate system before feeding it to the shader. There isn't a projection onto the plane that has this property.

  • $\begingroup$ Would there be much point in mapping the sphere differently to compensate for the poles problem? Maybe something taking the vertical angle as a percent and squaring it, to pull the sample points towards the equator non linearly? $\endgroup$ – Alan Wolfe Oct 27 '16 at 15:49
  • 1
    $\begingroup$ The other reason why SH is handy is it's a rotationally invariant representation. Rotating an SH basis function (by any axis and angle) transforms it to a linear combination of other SH basis functions of the same order. So, you can rotate an SH-represented function by applying an appropriate matrix to the SH coefficients directly. You don't get this if you do a 2D Fourier transform in lat-long parameter space. $\endgroup$ – Nathan Reed Oct 27 '16 at 17:49
  • 2
    $\begingroup$ @NathanReed Yes, I was thinking about that, but neglected to include it in the answer. I've updated it now with some more thoughts about that. Thanks for mentioning it. $\endgroup$ – Dan Hulme Oct 27 '16 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.