# Tools for working with spherical harmonics. 

Mostly intended for shading and global illumination.

## De-ringing
There are basically 3 approaches,
* one is filtering using some kind of a smoothing function such as Lanczos
* Optimization of the polynomial (generally to remove negative values)
* Piece-wise reconstruction

## Coefficients of SH basis
see [3] (Stupid Spherical Harmonics)

        1.0 / (2.0 * M_SQRT_PI),    // 0: 0  0
        -M_SQRT_3 / (2.0 * M_SQRT_PI),    // 1: 1 -1
        M_SQRT_3 / (2.0 * M_SQRT_PI),    // 2: 1  0
        -M_SQRT_3 / (2.0 * M_SQRT_PI),    // 3: 1  1
        M_SQRT_15 / (2.0 * M_SQRT_PI),    // 4: 2 -2
        -M_SQRT_15 / (2.0 * M_SQRT_PI),    // 5: 2 -1
        M_SQRT_5 / (4.0 * M_SQRT_PI),    // 6: 2  0
        -M_SQRT_15 / (2.0 * M_SQRT_PI),    // 7: 2  1
        M_SQRT_15 / (4.0 * M_SQRT_PI)     // 8: 2  2

### References:

---
* [1] 2008 - GDC - Stupid Spherical Harmonics (SH) Tricks by Peter-Pike Sloan
* [2] [Computing product of 2 sphecial harmonics](https://github.com/ruba/cortex-vfx/blob/c256b7274516a02fa64a0260351b86f1d6ebe8c2/include/IECore/SphericalHarmonicsAlgo.inl)
* [3] Stupid Spherical Harmonics