# Week 5: Lighting, Shading [for Rendering/Lighting TDs]

## 5.1 Parameter interpolation

### 5.1.1 Linear interpolation

#### vectors

```* points
* colors (triplets)
* pixel-blending operation!
```

### 5.1.2 Nonlinear interpolation

#### bias

```exp/log and also poly fns
```

#### smoothstep

```* classic smoothstep (cubic eqn), compare w/ 'step'
```

### 5.1.3 Multi-sample interpolation

#### spline interpolation

```* splines
* approx vs interp - Bezier, b-spline, Catmull-Rom (approx vs interp splines)
* tension, bias
```

### 5.1.4 Weighted interpolation

#### blendshapes

```* blendshapes - multi samples, normalized wt scaling
```

#### luminance

```* NTSC luminance formula (vs. simple grayscale)
```

## 5.2 Lighting and shading calculations

### 5.2.1 The standard lighting equation

#### Diffuse

```incl. wrap diffuse
```

#### Specular

```* Blinn, Phong
* Schlick's approx!
```

### 5.2.2 Lighting-related vectors

#### Ray tracing

```* see Shirley's bk - 2 chapters - basics, refraction, distrib. tracing..
```

### 5.2.3 Falloff

#### Light falloff

```* none/linear/quadratic/other
```

## 5.3 Noise

### 5.3.1 fBM

#### Random walk

```See Proc example
```

### 5.3.2 Perlin noise

#### noise function

```* noise() - 1D, 2D, 3D, nD [RSL]
```

#### noise variations

```* lattice noise, RMF noise, gradient noise etc
```

#### Turbulence

```* summation - loop: double freq, halve the strength (to not destroy base pattern) - like a symphony
* when Nyquist limit is reached, stop the loop
```

#### Procedural patterns

```* fractal noise (proc. patterns): marble, spatter, wood
```

### 5.3.3 Cell noise

#### alternate distance metrics

```Manhattan Metric etc
```

### 5.3.4 Wavelet noise

#### Wavelet turbulence

```* http://www.cs.cornell.edu/~tedkim/WTURB/
```

### 5.4.1 Random numbers - spatial distributions

#### Test and reject

```plane: generate, test, accept/reject
```

```plane
```

#### Over a sphere

`Gems article (or Steve CG?) - consider a circular cross section..`

### 5.4.2 Low discrepancy sequences

#### QMC/LDS

```(eg. Sobol)
```

#### Monte Carlo

```Buffon's needle - MC way to get pi :)
GEOMETRIC probability..
http://www.cut-the-knot.org/fta/Buffon/buffon9.shtml
Stamp: http://www.ms.uky.edu/~mai/java/stat/buffon.jpg
Applet: http://www.ms.uky.edu/~mai/java/stat/buff.html and http://www.ventrella.com/Buffon/index.html (in 3D)
```
```Buffon's 'dot' - unif. rnums in [0..1] in x,y, see if they fall inside circle or not (P=area of circle/area of sq)
```

#### uv remapping

```* UV coords, RST of them
```

#### wallpaper groups

```* kaleido (Terrazo, actually!)
```