BRDF based lighting

Nvidia has an awesome example of how to implement BRDF lighting using two cube maps.
However, there is a lot of code, and complexity in their example, and it is a little difficult in trying to break it down.

Nvidia’s whitepaper on the theory + implementation of BRDF is fine. I was just looking for a simpler example that I could digest a bit more easily.