Introduction to Spherical Harmonics for Graphics Programmers
published on Apr 12 2026
This post requires JavaScript to properly render mathematics (like $\int f(x) dx$, $Y_\ell^m$). It's not likely to work in your browser's "reader mode".
On your computer graphics journey, you will eventually run into some paper or code mentioning spherical harmonic functions. They are indeed a very useful tool: with just a few coefficients, they allow us to approximate a given function defined on a sphere. This can be very useful for modeling complex lighting.
While spherical harmonics are a very well studied subject, trying to make sense of them can still be a bit intimidating. However, I think that understanding the applications of spherical harmonics in the field of realtime computer graphics need not be that difficult.
In this article, I will try my hand at explaining spherical harmonics the way I wish they had been explained to me. I hope that by the end readers will be ready to digest more advanced technical material that uses or talks about spherical harmonics.
While the reader is expected to have some baseline level of familiarity with realtime rendering, linear algebra and integrals, it's nothing too crazy - we won't be doing any rigorous proofs, and any derivations we'll do are simple basic algebra.
Why Do We Even Care?
Before we start, I guess it should be properly explained why we, as practitioners of computer graphics, are even interested in spherical harmonics.
Any function that associates some quantity/value with a direction in 3D space can be thought of as a function defined on the domain of a unit sphere. Indeed, a "direction" is a unit vector, and the endpoint of that vector is always some point on the surface of a unit sphere centered at the origin. Going forward we will use "function of direction", "function defined on a sphere", and "function defined on the surface of a unit sphere" interchangeably.
... continue reading