A thorough introduction to spherical harmonic (SH) functions aimed at graphics programmers. Covers the mathematical foundations including function spaces, orthonormal bases, associated Legendre polynomials, and the real-valued SH definition used in computer graphics. Includes JavaScript code for evaluating SH basis functions, projecting cubemaps to SH coefficients via Riemann sums with correct solid-angle weighting, and handling ringing/Gibbs artifacts through windowing. Also walks through a practical case study of projecting irradiance to SH for lightmaps, explaining the convolution property of SH and how Frostbite uses L1 SH to support normal-mapped baked lighting.

38m read timeFrom gpfault.net
Post cover image
Table of contents
Why Do We Even Care?Definition of Spherical Harmonic FunctionsObtaining the Spherical Harmonic CoefficientsCase Study: Projecting a Cubemap onto Spherical Harmonic BasisSpherical Harmonic ArtifactsCase Study: Projecting Irradiance to Spherical HarmonicsConclusions and Further Reading

Sort: