Skip to content
AI360Xpert
Beta

Spherical Harmonics

Spherical harmonics are the Fourier basis for spheres, expanding any spherical signal in rotation-organized tones for 3-D vision and physics.

Low-degree modes capture smooth lobes while higher degrees add finer ripples, and rotation mixes only within each degree band
Low-degree modes capture smooth lobes while higher degrees add finer ripples, and rotation mixes only within each degree band

Why Does This Exist?

Environment lighting, molecular surfaces, 3-D shapes, and climate fields all live on spheres, where planar Fourier bases distort (poles bunch, seams tear). Spherical harmonics YlmY_l^m are the sphere's own orthogonal tones: degree ll sets spatial frequency, order mm (−l≤m≤l-l \le m \le l) sets orientation within the band. Rotations mix only within a band (the 2l+12l+1 block), which is exactly the representation theory structure that makes spherical CNNs steerable. Planar spectra are Fourier; symmetry machinery is groups.

The one idea you need first

Orthogonality on the sphere: ∫YlmYl′m′‾=0\int Y_l^m \overline{Y_{l'}^{m'}} = 0 unless l=l′l = l' and m=m′m = m'. Coefficients clmc_{lm} come from one inner product each, and truncating at degree LL keeps (L+1)2(L+1)^2 numbers: smooth signals concentrate there.

Think of It Like This

Vibration modes of a soap bubble

Tap a soap bubble and it wobbles in standing patterns: uniform breathing (l=0l = 0), sloshing side to side (l=1l = 1, three orientations), rippling quarters (l=2l = 2, five orientations). Each pattern rings at its own spatial frequency, and rotating the bubble swaps orientations within a pattern without creating new ones.

Spherical harmonics are those wobble patterns for data on spheres. Lighting engineers keep the breathing plus sloshing (44 numbers capture 90%90\% of soft daylight); shape matchers add ripples until descriptors discriminate. Rotation never leaks energy between patterns, only within.

How It Actually Works

Ylm(θ,ϕ)Y_l^m(\theta, \phi) combines associated Legendre Plm(cos⁡θ)P_l^m(\cos\theta) with eimϕe^{im\phi}: ll nodal lines total, ∣m∣|m| around the equator. Expansion f=∑l,mclmYlmf = \sum_{l,m} c_{lm} Y_l^m; power per degree El=∑m∣clm∣2E_l = \sum_m |c_{lm}|^2 is rotation-invariant (the descriptor). Wigner D-matrices rotate within bands: cl↦Dl(R)clc_l \mapsto D^l(R) c_l. Truncation at L=3L = 3 (1616 coefficients) captures smooth lighting within 1%1\%; sharp shadows need L≥8L \ge 8 (8181 coefficients).

Worked example

Lambertian room lit from above: radiance f(θ)=max⁡(cos⁡θ,0)f(\theta) = \max(\cos\theta, 0) (clamped cosine lobe). Coefficients: c00=π/2≈0.886c_{00} = \sqrt{\pi}/2 \approx 0.886 (mean), l=1l = 1 band holds ≈0.5\approx 0.5 of remaining energy (the up-down gradient), l=2l = 2 about 0.10.1, tail past l=3l = 3 under 0.010.01. Keep L=2L = 2 (99 numbers): relative error about 1%1\% (0.010.01 residual over unit energy). Rotate the room 9090 degrees: E0,E1,E2E_0, E_1, E_2 unchanged (descriptors stable) while the 33 numbers inside l=1l = 1 permute (orientation tracked, not lost).

Code

import math

def y00() -> float:    return 1 / math.sqrt(4 * math.pi)  # uniform band: constant 0.282

def band_count(bands: int) -> int:    return (bands + 1) ** 2  # total modes through degree L

print(round(y00(), 3))  # -> 0.282print(band_count(2), band_count(3), band_count(8))  # -> 9 16 81

Nine modes through l=2l = 2 hold the lobe within 1%1\%; eighty-one through l=8l = 8 resolve sharp shadows.

Watch Out For

Truncating ringy functions and trusting pointwise values

Clamped lobes and hard shadow boundaries ring like Gibbs (9%9\% overshoot near the clamp circle at finite LL). Relighting with truncated harmonics leaks light past terminators. Clamp in the spatial domain after reconstruction, or raise LL until ringing sits below the noise floor.

Treating band power as orientation

ElE_l is invariant (good for matching) but blind to direction (useless for pose): two rooms lit from opposite sides share all ElE_l. Keep full coefficient vectors when orientation matters; use power spectra only for rotation-proof retrieval.

The Quick Version

  • Spherical harmonics are orthogonal tones on the sphere, organized by degree and order.
  • Rotations mix within bands only, giving steerable features and invariant power spectra.
  • Truncation at LL keeps (L+1)2(L+1)^2 numbers: 99, 1616, 8181 for L=2,3,8L = 2, 3, 8.
  • The clamped-cosine lobe fits within 1%1\% at L=2L = 2 with mean coefficient 0.8860.886.
  • Sharp shadows need L≥8L \ge 8; truncated clamps ring near terminators.
  • Band powers match shapes; full vectors track pose.