Microfacet Modeling and Approximation

Using PBRTv3, I explored generation of microfacet geometry and different rendering approximations for it.
Table of Contents
The Idea
If you've ever used a 3d rendering program with a material interface, you've probably seen specular and diffuse used as inputs that control how light reflects off of a material. The basic idea is to approximate different ways that light reflects off of a surface, with diffuse reflection representing the idea that a rough surface will reflect light in many directions. The point of this project was to explore that idea of microfacet geometry and approximations of it, while getting familiar with the concept of writing BxDFs using PBRTv3, an open-source physically based ray-tracer.

Diffuse reflection.
CC-BY-SA 3.0 -
GianniG46
Image source: https://en.wikipedia.org/wiki/Diffuse_reflection
Generating Geometry
To start, I wanted a baseline of what it looks like to render geometry that actually has microfacets, and so I created a utility tool to generate high vertex count meshes. The utility is currently capable of generating .obj or .pbrt (in order to not have to run files through PBRT's obj2pbrt utility, as this is very slow when the files are very large) files representing either a rectangle or a sphere of given dimensions with the number of polygons and vertex displacement defined by the user at runtime. RMS slope is cal