# Difference between Spherical Harmonics and Spherical Harmonics Lighting

What is the difference between Spherical Harmonics and Spherical Harmonics Lighting in OpenGL?

Spherical harmonics lighting use spherical harmonics to approximate a lighting lobe on an object.

It has property that make it cheap to compute in real time (dot product vs the normal) and to store (7floats per channels generally, for example in unity engine, but it vary based on the use, The movie avatar used spherical harmonics with 81floats per channel). However it's low frequency and don't handle specular well, so it is use mostly for diffuse representation (incoming radiance). It's a cheap and compressed representation for lights.

There is several uses:

1. To compute a lot of diffuse lights at a single object.

Because each light need a pass, it's cheaper to accumulate lights in a single spherical harmonic representation and apply it to objects. However this does not handle specular lighting, so you need passes for at each principal lights.

2. To store baked global illumination.

Spherical Harmonics can be blended linearly to quadrilinearly in a volume. It allow to store light in point of space then interpolate to find the light at objects position.

3. To store lightmap

Being able to be interpolate linearly makes spherical harmonics good candidate for lightmap intensity as you can store second order spherical harmonics (4 floats) in a regular rgba texture (could be stored at vertex value too). It works like above and allow to modify or move normal of a surface, or tesselate it, and retain the correct baked global illumination. Basically it allow to add correctly lit high frequencies for cheap.

4. More

It can be use to store better AO map, secondary bounce for radiosity, thickness map, smooth shadow casting (the last of us), time of day etc ...

Spherical harmonics is well documented at that point but all are very math heavy, I understand the overall idea, but I can't manipulate it because it's written in an opaque manner and the community was VERY unhelpful so far, pointing at document without clarifications. It mean that the entry level stays high unlike other aspect of learning shader (like physically based rendering).

So if you can find a competent mentor, cherish him!

Spherical harmonics is a general mathematical concept that can be applied to a number of problems. One of those problems is modeling the behavior of light for use in 3D rendering. There's not really a difference, just a scoping of the application. It's sort of like asking "What's the difference between Fourier Analysis and Fourier Analysis of Sound Signals?"