Skip to main content

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: