Algorithms for spherical harmonic lighting
Ian G. Lisle, S.-L. Tracy Huang · 2007
Spherical harmonic (SH) lighting models require efficient and general libraries for evaluation of SH functions and of Wigner matrices for rotation. We introduce an efficient algebraic recurrence for evaluation of SH functions, and also implement SH rotation via Wigner matrices constructed for the real SH basis by a recurrence. Using these algorithms, we provide a freely distributable C / OpenGL implementation for SH diffuse unshadowed, shadowed and inter-reflected models. Our implementation allows flexible switching of scene, light probe, SH degree and lighting model at run time.