After I implemented the Rough Conductor BSDF from Microfacet Models for Refraction through Rough Surfaces by Walter et al., I also took the time to implement the Rough Dielectric BSDF from the same paper.
See below for renderings of a dielectric with increasing roughness parameter with their usual Mitsuba comparisons.
There is also a visualization of the BSDF values in the warptest tool together with the results from a chi^2 test to show, that the BSDF is correctly sampled according to its probability density function.
Code:
src/bsdfs/roughdielectric.cpp
As objects can be composed of different materials, I found it useful to have a special kind of Selection BSDF that combines other BSDFs. It takes a grayscale texture as input and selects for each surface point one of several nested BSDFs, depending on the value stored in the texture.
See below for close-up renderings of the crayons from my final scene, which are built out of multiple BSDFs types.
Code:
src/bsdfs/selection.cpp