# Lecture 8: Cook-Torrance GGX

## Power exponent

In traditional Blinn-Phong we had a simple power parameter (usually called shininess) that we used to control the size and intensity of the specular highlight.

In Cook-Torrance we want to have a more general parameter that can be used in multiple places. Cook-Torrance defines a constant $\alpha$ that indicates the roughness of the material, with 0 indicating ideal smooth surfaces and 1 indicating maximum roughness. In practice you never want to use absolute 0 or 1 since these edge cases tend to produce divide-by-zero and other issues.

We can then relate our new $\alpha$ parameter to our old power variable as such:

roughness is one of the material properties defined by our .pov files. We’ll use UE4’s convention for determining $\alpha$ from roughness:

Note that for traditional Blinn-Phong (specifically, not just $D_{blinn}$ but if we aren’t doing Cook-Torrance at all), you should still use the above power equation for shininess, but you don’t need to square the roughness constant:

This is an arbitrary convention but I have found it works reasonably well!

## GGX Equations

### Normal Distribution Function

$\chi^+$ is the positive characteristic function:

$\theta_x$ is the angle between $\hat x$ and $\hat n$.
$tan^2(\theta) = sec^2(\theta) - 1$ $= \frac{1}{cos^2(\theta)} - 1$ $= \frac{1 - cos^2(\theta)}{cos^2(\theta)}$