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 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 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 from roughness:

Note that for traditional Blinn-Phong (specifically, not just 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

Cook_Torrance_D_GGX

is the positive characteristic function:

Geometric Shadowing Function

Cook_Torrance_G_GGX

is the angle between and .

Implementation Details

Every dot product in these equations should be “saturated”, i.e. clamped between 0 and 1.