# Spherical Harmonic Lighting

// QUESTION: (1) how does standard textbook introduce spherical harmonics. What is its construction? (2) Why are spherical harmonics basis of spherical functions? (3) What is the connection between this video and usual diagram of spherical harmonics? (4) Why do we rotate the nodal line in the video? (5) How do vibrations connect to quantum mechanics and why do l and m correspond to quantumn numbers? (6) What is its relationship between SO(3) and Lie Group? and Laplace's Equation and Homogeneous Polynomial

How Gary Doskas discovered Spherical Harmonics: Youtube

Keywords: 3D Spherical Fourier Harmonic Descriptors, Associated Legendre Polynomials, Spherical Harmonics, SO(3) and Lie Group, Laplace's Equation and Harmonics, Homogeneous Polynomial

Typical Lighting Implementation: diffuse Surface Reflection for $n$ light sources is

\text{Intensity} = (r, g, b)_{\text{surface}} \cdot \sum_{i = 1}^n (r, g, b)_{\text{light}} \cdot (\vec{N} \cdot \vec{L})

Total amount of incoming light from all directions and scales it by cosine angle between $\vec{N}$ and $\vec{L}$. This is standard of PBR, but difficult to compute

## Rendering Equation

### Definition of Rendering Equation

Rendering Equation:

L_0(x, w_0, \lambda, t) = L_e(x, w_0, \lambda, t) + \int_\Omega f_r(x, w_i, w_0, \lambda, t)L_i(x, w_i, \lambda, t)(w_i \cdot n) dw_i

where

• $L_0(x, w_0, \lambda, t)$ is the total spectral radiance of wavelength $\lambda$ directed outward along direction $w_0$ at time $t$ from particular surface position $x$ we are looking at.

• $x$: the surface coordinate $(x, y, z)$ we are looking at.

• $w_0$: direction of the outgoing light from surface $x$ to camera.

• $\lambda$: wavelength of light

• $t$: time

• $L_e(x, w_0, \lambda, t)$: emitted spectral radiance from surface $x$ itself if $x$ is a light source.

• $\int_\Omega d w_i$: integrate over hemisphere $\Omega$

• $\Omega$: the unit hemisphere centered around surface normal $n$ containing all possible values for $w_i$, the incoming light direction.

• $f_r(x, w_i, w_0, \lambda, t)$: BRDF, the proportion of light reflected from $w_i$ to $w_0$ at position $x$, time $t$, wavelength $\lambda$.

• $w_i$: direction vector of incoming light from other objects to $x$.

• $L_i(x, w_i, \lambda, t)$: the spectral radiance from other objects in the direction of $w_i$ we are integrating. We can only compute $L_0(x, w_0, \lambda, t)$ assume $L_i(x, w_i, \lambda, t)$ is known. But $L_i(x, w_i, \lambda, t)$ must be computed by rendering equation itself, which makes it the recursive part of the rendering equation.

• $n$: surface normal at $x$.

• $w_i \cdot n$: weakening factor of outward irradiance due to incident angle. As the light shoot a surface whose area is larger than the projected area perpendicular to the ray, the light is more distributed and therefore darker. This should not be confused with BRDF which does not take account of $n$.

Bidirectional Reflectance Distribution Function: a function $I = f(\vec{\text{light}}, \vec{\text{camera}})$ that encodes the material intensity of the surface. It encodes how the incoming light beam distribute into a 3D beams in spherical coordinates (spectral radiance):

1. Mirror: output intensity for $\vec{\text{camera}}$ is exact mirror of $\vec{\text{light}}$
2. Diffuse: output intensity for $\vec{\text{camera}}$ is independent from $\vec{\text{light}}$

### Approximating Integrals

We approximate integral using Monte Carlo Estimator: where $w(x_i)$ is the a weighting function.

\int f(x) dx \approx \frac{1}{N} \sum_{i = 1}^N f(x_i) w(x_i)

Usually $w(x_i) = \frac{1}{Pr\{X = x_i\}}$, in the case of a sphere, since the surface of the sphere is $4\pi$, the probability density is $\frac{1}{4\pi}$ for any point on sphere. Therefore, $(\forall i)(w(x_i) = 4\pi)$

To map $(\xi_x, \xi_y) \in \text{Uniform}(0, 1)^2$ onto uniform sphere, we do

(2 \arccos(\sqrt{1 - \xi_x}), 2 \pi \xi_y) \to (\theta, \varphi)

To lower the variance, we can apply stratified random sapling (b) where we divide the space into grids and pick random points in the grid.

### Orthogonal Basis Functions

Here is a review of basis functions:

There are many orthornormal basis that can form polynomials:

• Chebyshev Polynomials

• Jacobi Polynomials

• Hermite Polynomials

• Associated Legendre Polynomials

Table of Content