## [GAMES202] Lecture Notes 6

### IBL Shadowing

#### Different Perspetives

**A many-light problem**? (cost linearly to nLights)

**A sampling problem**?
1 to figure out an arbitrarily complex visibility ;
2 needs to be extracted from ? ( may not satisfy the accurate condition of the approximation!)

#### Solutions

**Industrial Solution (a compromise)**:
Generate one (or more) shadows from the brightest light sources (e.g. the sun)

**Related Research**:
Imperfect shadow maps (shadow for indirect lighting)
Light Cuts (many-lights in offline rendering)
RTRT, Real-time Ray Tracing (path-tracing + denoising)
PRT, Precomputed Radiance Transfer

### Precomputed Radiance Transfer

Related papers Precomputation-Based Rendering Precomputed Radiance Transfer

#### Preliminaries

**Convolutions**
Filtering: the minimum frequency of and is reserved.

**Basis Functions** and **Reconstruction**

**Orthogonal** Basis Functions

**Projection** to Orthogonal Functions

We can do Monte Carlo integration to get .

#### Spherical Harmonics

All details see the supplement material: SH Lighting: The Gritty Details

Q: *Why SH instead of 2D Fourier Transform?*
A: *(I don’t know ヽ(。>д<)ｐ) Guess: is it because low-order Fourier Transform is hard to represent the high frequency changes nearing the edges of 2D images? But why don’t use cube map instead?*

**Rotating SH Functions**

If we wanted to rotate the projected function , we can rotate all it’s SH basis functions then reconstruct it.

A rotated SH basis function can be representated as __a linear combination of the SH basis functions at the same order__. Thus we can get the projected at once, without do the sampling (i.e. integration with basis functions) again.

More over, the SH functions are *rotationally invariant*, i.e. rotate before SH projecting a function is the same as directly rotate the projected function.
Specifically, if we rotate the original funtion then SH project it to , we will get .

#### Example: Diffuse IBL using SH?

Diffuse BRDF is smooth (low-frequency), so __it acts like a low pass filter__ (when do dot product on frequency domain or convolution on spatial domain).

Thus when integrating diffuse BRDF with radiance: the resulting function value is always smooth (in convolution only the lowest frequency of the two functions is reserved).

Thus we don’t need a high-order SH to describe environment lighting when being integrated with a diffuse BRDF. (*3 order SH IBL has RMS Error*)

SH IBL in RTR (without texture, SH order ):

#### SH IBL with Shadows

Solving the triple-product integration: (3 cubemap / equirectangular images)

The **two-part** rendering equation perspective:
Lighting:
Light transport:

**Assumption:**
Static scene(the light transport part), dynamic lighting (each environment map needs to be pre-computed) (rotating envmap can be performed once)

##### Basic Steps:

**Precompute**: project *each lighting* and *light transport* to SH basis space, usually we compute a SH vector for each vertex. At runtime, we can interpolate the shading or the SH vector for every point within the triangle.

**Runtime**:
Diffuse case: constant BRDF

Glossy case: leave to next class…

Banner by 将 from

Arknights.