Spherical Harmonics

A key aspect of color representation is the use of Spherical Harmonics (Spherical Harmonics, SH). Spherical harmonics are solutions to Laplace's equation in spherical coordinates and form a complete orthogonal basis for functions defined on the surface of a sphere. A function $L(\theta,\phi)$ can therefore be represented as


\begin{displaymath}
L(\mathbf{d}) \simeq L(\theta,\phi) =
\sum_{l=0}^{L}
\sum_{m=-l}^{l}
k_l^m Y_l^m(\theta,\phi),
\end{displaymath} (10.108)

where $\mathbf{d}$ denotes the direction, $l$ is the degree of the harmonic, $m$ its order, and $k_l^m$ the corresponding coefficient. In a numerical approximation, a finite maximum degree $L$ is generally used.

For real spherical harmonics, which are also commonly used to represent color in Gaussian Splatting, the following definition can be used. For $l \geq 0$ and $-l \leq m \leq l$:


\begin{displaymath}
Y_l^m(\theta,\phi) =
\begin{cases}
\sqrt{2}\,K_l^m P_l^m(\co...
...m\vert}(\cos\theta)\sin(\vert m\vert\phi),
& m < 0,
\end{cases}\end{displaymath} (10.109)

where


\begin{displaymath}
K_l^m =
\sqrt{
\frac{2l+1}{4\pi}
\frac{(l-m)!}{(l+m)!}
},
\qquad m \geq 0,
\end{displaymath} (10.110)

and $P_l^m$ are the associated Legendre polynomials, defined using the convention that includes the Condon–Shortley phase factor 10.6

For $l=0$, there is a single harmonic, constant over the sphere:


\begin{displaymath}
Y_0^0 =
\frac{1}{\sqrt{4\pi}}
=
\frac{1}{2}\sqrt{\frac{1}{\pi}}
\approx 0.2821.
\end{displaymath} (10.111)

For a maximum degree of $L$, the total number of harmonics is


\begin{displaymath}
N_{\mathrm{SH}} =
\sum_{l=0}^{L}(2l+1)
=
(L+1)^2.
\end{displaymath} (10.112)

Consequently, each color channel can be represented using $(L+1)^2$ coefficients. For example, with $L=0$, one coefficient is used; with $L=1$, four coefficients; and with $L=2$, nine coefficients.

In computer graphics, spherical harmonics are used to compactly represent direction-dependent functions. In neural rendering, they can therefore be used to describe how color depends on the viewing direction. The coefficients of the representation determine the function's variation as the direction changes.

The idea is to select a maximum degree $L$ and represent each color channel—red, green, and blue—as a linear combination of spherical harmonics, using the viewing direction $(\theta,\phi)$ as the variable; that is, the direction of the optical ray connecting the point to the observer.

For each color channel, we obtain, for example, the following expression for the red channel:

\begin{displaymath}
C_R(\mathbf{d}) =
\sum_{l=0}^{L}
\sum_{m=-l}^{l}
k_{l,m}^{R} Y_l^m(\mathbf{d}),
\end{displaymath} (10.113)

Similarly, $C_G(\mathbf{d})$ and $C_B(\mathbf{d})$ are computed, giving the RGB color $\mathbf{c}(\mathbf{d}) =
[C_R(\mathbf{d}),C_G(\mathbf{d}),C_B(\mathbf{d})]^\top$.



Footnotes

... factor10.6
Note that different conventions for ordering and the signs of real spherical harmonics are used in the literature; the same convention must therefore be used both when generating the functions and when interpreting the coefficients.
Paolo medici
2026-10-19