Spherical Harmonic lighting is a real-time rendering technique that uses a pre-process step — the projection of the lights, of the model and of the transfer function onto the spherical harmonic basis — to render scenes realistically using any type of light source. It is primarily used to reproduce diffuse lighting. The basic idea is to evaluate an approximation of the rendering equation at each vertex of the geometry by projecting its components onto the spherical harmonic basis during a pre-process step.
SH diffuse unshadowed
The geometric term reduces to the cosine term — the dot product between the surface normal and the light direction. Identical to standard diffuse lighting under Lambert's law, except the normal is encoded in the SH coefficients.
SH diffuse shadowed
The visibility term is added to determine shadowing at a given vertex, easily achieved with a raytracer. Realistic shadows for the same scene, at the cost of extra calculation time.
SH diffuse inter-reflected
Lighting arriving indirectly from other objects is taken into account. The pre-process handles direct and indirect lighting, giving global illumination for the scene.
Once coefficients exist for all three modes, the rendering equation is reconstructed at runtime by adding and multiplying them together. Outgoing radiance is calculated per vertex, and Gouraud shading renders the full scene in real time.
Requires HDRI light probes in spherical .hdr format from Paul Debevec's site — not the vertical cross cube format.







